Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: sky/shell/ui/engine.h

Issue 932283002: Port touch-demo.sky to Dart and make it work in SkyShell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SKY_SHELL_UI_ENGINE_H_ 5 #ifndef SKY_SHELL_UI_ENGINE_H_
6 #define SKY_SHELL_UI_ENGINE_H_ 6 #define SKY_SHELL_UI_ENGINE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "mojo/public/cpp/bindings/binding.h"
12 #include "mojo/public/cpp/system/core.h" 13 #include "mojo/public/cpp/system/core.h"
13 #include "skia/ext/refptr.h" 14 #include "skia/ext/refptr.h"
14 #include "sky/engine/public/web/WebFrameClient.h" 15 #include "sky/engine/public/web/WebFrameClient.h"
15 #include "sky/engine/public/web/WebViewClient.h" 16 #include "sky/engine/public/web/WebViewClient.h"
16 #include "sky/shell/gpu_delegate.h" 17 #include "sky/shell/gpu_delegate.h"
17 #include "sky/shell/ui_delegate.h" 18 #include "sky/shell/ui_delegate.h"
18 #include "third_party/skia/include/core/SkPicture.h" 19 #include "third_party/skia/include/core/SkPicture.h"
19 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
20 21
21 namespace sky { 22 namespace sky {
22 namespace shell { 23 namespace shell {
23 class Animator; 24 class Animator;
24 class PlatformImpl; 25 class PlatformImpl;
25 26
26 class Engine : public UIDelegate, 27 class Engine : public UIDelegate,
28 public ViewportObserver,
27 public blink::WebFrameClient, 29 public blink::WebFrameClient,
28 public blink::WebViewClient { 30 public blink::WebViewClient {
29 public: 31 public:
30 struct Config { 32 struct Config {
31 base::WeakPtr<GPUDelegate> gpu_delegate; 33 base::WeakPtr<GPUDelegate> gpu_delegate;
32 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner; 34 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner;
33 }; 35 };
34 36
35 explicit Engine(const Config& config); 37 explicit Engine(const Config& config);
36 ~Engine() override; 38 ~Engine() override;
37 39
38 base::WeakPtr<Engine> GetWeakPtr(); 40 base::WeakPtr<Engine> GetWeakPtr();
39 41
40 void Init(mojo::ScopedMessagePipeHandle service_provider); 42 void Init(mojo::ScopedMessagePipeHandle service_provider);
41 43
42 void BeginFrame(base::TimeTicks frame_time); 44 void BeginFrame(base::TimeTicks frame_time);
43 skia::RefPtr<SkPicture> Paint(); 45 skia::RefPtr<SkPicture> Paint();
44 46
45 private: 47 private:
46 // UIDelegate methods: 48 // UIDelegate methods:
47 void OnViewportMetricsChanged(const gfx::Size& physical_size, 49 void ConnectToViewportObserver(
50 mojo::InterfaceRequest<ViewportObserver> request) override;
51
52 // ViewportObserver:
53 void OnViewportMetricsChanged(int width, int height,
48 float device_pixel_ratio) override; 54 float device_pixel_ratio) override;
55 void OnInputEvent(InputEventPtr event) override;
49 56
50 // WebViewClient methods: 57 // WebViewClient methods:
51 void initializeLayerTreeView() override; 58 void initializeLayerTreeView() override;
52 void scheduleVisualUpdate() override; 59 void scheduleVisualUpdate() override;
53 60
54 scoped_ptr<PlatformImpl> platform_impl_; 61 scoped_ptr<PlatformImpl> platform_impl_;
55 scoped_ptr<Animator> animator_; 62 scoped_ptr<Animator> animator_;
56 blink::WebView* web_view_; 63 blink::WebView* web_view_;
64 float device_pixel_ratio_;
57 gfx::Size physical_size_; 65 gfx::Size physical_size_;
66 mojo::Binding<ViewportObserver> viewport_observer_binding_;
58 67
59 base::WeakPtrFactory<Engine> weak_factory_; 68 base::WeakPtrFactory<Engine> weak_factory_;
60 69
61 DISALLOW_COPY_AND_ASSIGN(Engine); 70 DISALLOW_COPY_AND_ASSIGN(Engine);
62 }; 71 };
63 72
64 } // namespace shell 73 } // namespace shell
65 } // namespace sky 74 } // namespace sky
66 75
67 #endif // SKY_SHELL_UI_ENGINE_H_ 76 #endif // SKY_SHELL_UI_ENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698