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/public/interfaces/application/service_provider.mojom.h" | 14 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
15 #include "mojo/services/navigation/public/interfaces/navigation.mojom.h" | 15 #include "mojo/services/navigation/public/interfaces/navigation.mojom.h" |
16 #include "skia/ext/refptr.h" | 16 #include "skia/ext/refptr.h" |
17 #include "sky/engine/public/platform/ServiceProvider.h" | 17 #include "sky/engine/public/platform/ServiceProvider.h" |
18 #include "sky/engine/public/web/WebFrameClient.h" | 18 #include "sky/engine/public/web/WebFrameClient.h" |
19 #include "sky/engine/public/web/WebViewClient.h" | 19 #include "sky/engine/public/web/WebViewClient.h" |
20 #include "sky/shell/gpu_delegate.h" | 20 #include "sky/shell/gpu_delegate.h" |
21 #include "sky/shell/ui_delegate.h" | 21 #include "sky/shell/ui_delegate.h" |
| 22 #include "sky/shell/service_provider.h" |
22 #include "third_party/skia/include/core/SkPicture.h" | 23 #include "third_party/skia/include/core/SkPicture.h" |
23 #include "ui/gfx/geometry/size.h" | 24 #include "ui/gfx/geometry/size.h" |
24 | 25 |
25 namespace sky { | 26 namespace sky { |
26 class PlatformImpl; | 27 class PlatformImpl; |
27 namespace shell { | 28 namespace shell { |
28 class Animator; | 29 class Animator; |
29 | 30 |
30 class Engine : public UIDelegate, | 31 class Engine : public UIDelegate, |
31 public ViewportObserver, | 32 public ViewportObserver, |
32 public blink::ServiceProvider, | 33 public blink::ServiceProvider, |
33 public mojo::NavigatorHost, | 34 public mojo::NavigatorHost, |
34 public blink::WebFrameClient, | 35 public blink::WebFrameClient, |
35 public blink::WebViewClient { | 36 public blink::WebViewClient { |
36 public: | 37 public: |
37 struct Config { | 38 struct Config { |
38 scoped_refptr<base::SingleThreadTaskRunner> java_task_runner; | 39 ServiceProviderContext* service_provider_context; |
39 | 40 |
40 base::WeakPtr<GPUDelegate> gpu_delegate; | 41 base::WeakPtr<GPUDelegate> gpu_delegate; |
41 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner; | 42 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner; |
42 }; | 43 }; |
43 | 44 |
44 explicit Engine(const Config& config); | 45 explicit Engine(const Config& config); |
45 ~Engine() override; | 46 ~Engine() override; |
46 | 47 |
47 base::WeakPtr<Engine> GetWeakPtr(); | 48 base::WeakPtr<Engine> GetWeakPtr(); |
48 | 49 |
(...skipping 26 matching lines...) Expand all Loading... |
75 | 76 |
76 // Services methods: | 77 // Services methods: |
77 mojo::NavigatorHost* NavigatorHost() override; | 78 mojo::NavigatorHost* NavigatorHost() override; |
78 | 79 |
79 // NavigatorHost methods: | 80 // NavigatorHost methods: |
80 void RequestNavigate(mojo::Target target, | 81 void RequestNavigate(mojo::Target target, |
81 mojo::URLRequestPtr request) override; | 82 mojo::URLRequestPtr request) override; |
82 void DidNavigateLocally(const mojo::String& url) override; | 83 void DidNavigateLocally(const mojo::String& url) override; |
83 void RequestNavigateHistory(int32_t delta) override; | 84 void RequestNavigateHistory(int32_t delta) override; |
84 | 85 |
85 mojo::ServiceProviderPtr CreateServiceProvider(); | |
86 void UpdateWebViewSize(); | 86 void UpdateWebViewSize(); |
87 | 87 |
88 Config config_; | 88 Config config_; |
89 mojo::ServiceProviderPtr service_provider_; | 89 mojo::ServiceProviderPtr service_provider_; |
90 scoped_ptr<PlatformImpl> platform_impl_; | 90 scoped_ptr<PlatformImpl> platform_impl_; |
91 scoped_ptr<Animator> animator_; | 91 scoped_ptr<Animator> animator_; |
92 blink::WebView* web_view_; | 92 blink::WebView* web_view_; |
93 float device_pixel_ratio_; | 93 float device_pixel_ratio_; |
94 gfx::Size physical_size_; | 94 gfx::Size physical_size_; |
95 mojo::Binding<ViewportObserver> viewport_observer_binding_; | 95 mojo::Binding<ViewportObserver> viewport_observer_binding_; |
96 | 96 |
97 base::WeakPtrFactory<Engine> weak_factory_; | 97 base::WeakPtrFactory<Engine> weak_factory_; |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(Engine); | 99 DISALLOW_COPY_AND_ASSIGN(Engine); |
100 }; | 100 }; |
101 | 101 |
102 } // namespace shell | 102 } // namespace shell |
103 } // namespace sky | 103 } // namespace sky |
104 | 104 |
105 #endif // SKY_SHELL_UI_ENGINE_H_ | 105 #endif // SKY_SHELL_UI_ENGINE_H_ |
OLD | NEW |