OLD | NEW |
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/bindings/binding.h" |
13 #include "mojo/public/cpp/system/core.h" | 13 #include "mojo/public/cpp/system/core.h" |
| 14 #include "mojo/services/navigation/public/interfaces/navigation.mojom.h" |
14 #include "skia/ext/refptr.h" | 15 #include "skia/ext/refptr.h" |
| 16 #include "sky/engine/public/platform/ServiceProvider.h" |
15 #include "sky/engine/public/web/WebFrameClient.h" | 17 #include "sky/engine/public/web/WebFrameClient.h" |
16 #include "sky/engine/public/web/WebViewClient.h" | 18 #include "sky/engine/public/web/WebViewClient.h" |
17 #include "sky/shell/gpu_delegate.h" | 19 #include "sky/shell/gpu_delegate.h" |
18 #include "sky/shell/ui_delegate.h" | 20 #include "sky/shell/ui_delegate.h" |
19 #include "third_party/skia/include/core/SkPicture.h" | 21 #include "third_party/skia/include/core/SkPicture.h" |
20 #include "ui/gfx/geometry/size.h" | 22 #include "ui/gfx/geometry/size.h" |
21 | 23 |
22 namespace sky { | 24 namespace sky { |
23 class PlatformImpl; | 25 class PlatformImpl; |
24 namespace shell { | 26 namespace shell { |
25 class Animator; | 27 class Animator; |
26 | 28 |
27 class Engine : public UIDelegate, | 29 class Engine : public UIDelegate, |
28 public ViewportObserver, | 30 public ViewportObserver, |
| 31 public blink::ServiceProvider, |
| 32 public mojo::NavigatorHost, |
29 public blink::WebFrameClient, | 33 public blink::WebFrameClient, |
30 public blink::WebViewClient { | 34 public blink::WebViewClient { |
31 public: | 35 public: |
32 struct Config { | 36 struct Config { |
33 base::WeakPtr<GPUDelegate> gpu_delegate; | 37 base::WeakPtr<GPUDelegate> gpu_delegate; |
34 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner; | 38 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner; |
35 }; | 39 }; |
36 | 40 |
37 explicit Engine(const Config& config); | 41 explicit Engine(const Config& config); |
38 ~Engine() override; | 42 ~Engine() override; |
(...skipping 10 matching lines...) Expand all Loading... |
49 void ConnectToViewportObserver( | 53 void ConnectToViewportObserver( |
50 mojo::InterfaceRequest<ViewportObserver> request) override; | 54 mojo::InterfaceRequest<ViewportObserver> request) override; |
51 | 55 |
52 // ViewportObserver: | 56 // ViewportObserver: |
53 void OnViewportMetricsChanged(int width, int height, | 57 void OnViewportMetricsChanged(int width, int height, |
54 float device_pixel_ratio) override; | 58 float device_pixel_ratio) override; |
55 void OnInputEvent(InputEventPtr event) override; | 59 void OnInputEvent(InputEventPtr event) override; |
56 void LoadURL(const mojo::String& url) override; | 60 void LoadURL(const mojo::String& url) override; |
57 | 61 |
58 // WebViewClient methods: | 62 // WebViewClient methods: |
| 63 void frameDetached(blink::WebFrame*) override; |
59 void initializeLayerTreeView() override; | 64 void initializeLayerTreeView() override; |
60 void scheduleVisualUpdate() override; | 65 void scheduleVisualUpdate() override; |
61 blink::WebScreenInfo screenInfo() override; | 66 blink::WebScreenInfo screenInfo() override; |
| 67 blink::ServiceProvider* services() override; |
| 68 |
| 69 // Services methods: |
| 70 mojo::NavigatorHost* NavigatorHost() override; |
| 71 |
| 72 // NavigatorHost methods: |
| 73 void RequestNavigate(mojo::Target target, |
| 74 mojo::URLRequestPtr request) override; |
| 75 void DidNavigateLocally(const mojo::String& url) override; |
62 | 76 |
63 void UpdateWebViewSize(); | 77 void UpdateWebViewSize(); |
64 | 78 |
65 scoped_ptr<PlatformImpl> platform_impl_; | 79 scoped_ptr<PlatformImpl> platform_impl_; |
66 scoped_ptr<Animator> animator_; | 80 scoped_ptr<Animator> animator_; |
67 blink::WebView* web_view_; | 81 blink::WebView* web_view_; |
68 float device_pixel_ratio_; | 82 float device_pixel_ratio_; |
69 gfx::Size physical_size_; | 83 gfx::Size physical_size_; |
70 mojo::Binding<ViewportObserver> viewport_observer_binding_; | 84 mojo::Binding<ViewportObserver> viewport_observer_binding_; |
71 | 85 |
72 base::WeakPtrFactory<Engine> weak_factory_; | 86 base::WeakPtrFactory<Engine> weak_factory_; |
73 | 87 |
74 DISALLOW_COPY_AND_ASSIGN(Engine); | 88 DISALLOW_COPY_AND_ASSIGN(Engine); |
75 }; | 89 }; |
76 | 90 |
77 } // namespace shell | 91 } // namespace shell |
78 } // namespace sky | 92 } // namespace sky |
79 | 93 |
80 #endif // SKY_SHELL_UI_ENGINE_H_ | 94 #endif // SKY_SHELL_UI_ENGINE_H_ |
OLD | NEW |