window.h 1.8 KB
Newer Older
1 2 3 4
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6
#ifndef FLUTTER_LIB_UI_WINDOW_WINDOW_H_
#define FLUTTER_LIB_UI_WINDOW_WINDOW_H_
7

8
#include "flutter/lib/ui/semantics/semantics_update.h"
9
#include "flutter/lib/ui/window/platform_message.h"
10
#include "flutter/lib/ui/window/pointer_data_packet.h"
11
#include "flutter/services/engine/sky_engine.mojom.h"
12 13
#include "lib/ftl/time/time_point.h"
#include "lib/tonic/dart_persistent_value.h"
14

15 16 17 18
namespace tonic {
class DartLibraryNatives;
}  // namespace tonic

19 20 21 22 23 24 25
namespace blink {
class Scene;

class WindowClient {
 public:
  virtual void ScheduleFrame() = 0;
  virtual void Render(Scene* scene) = 0;
26
  virtual void UpdateSemantics(SemanticsUpdate* update) = 0;
27
  virtual void HandlePlatformMessage(ftl::RefPtr<PlatformMessage> message) = 0;
28 29 30 31 32 33 34 35 36 37 38 39 40

 protected:
  virtual ~WindowClient();
};

class Window {
 public:
  explicit Window(WindowClient* client);
  ~Window();

  WindowClient* client() const { return client_; }

  void DidCreateIsolate();
41
  void UpdateWindowMetrics(const sky::ViewportMetricsPtr& metrics);
42 43
  void UpdateLocale(const std::string& language_code,
                    const std::string& country_code);
44
  void UpdateSemanticsEnabled(bool enabled);
45
  void DispatchPointerDataPacket(const PointerDataPacket& packet);
46
  void DispatchSemanticsAction(int32_t id, SemanticsAction action);
A
Adam Barth 已提交
47
  void BeginFrame(ftl::TimePoint frameTime);
48

A
Adam Barth 已提交
49 50 51
  void PushRoute(const std::string& route);
  void PopRoute();

52 53
  void OnAppLifecycleStateChanged(sky::AppLifecycleState state);

54
  static void RegisterNatives(tonic::DartLibraryNatives* natives);
55 56 57

 private:
  WindowClient* client_;
58
  tonic::DartPersistentValue library_;
59 60 61 62
};

}  // namespace blink

63
#endif  // FLUTTER_LIB_UI_WINDOW_WINDOW_H_