| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIEWER_DOCUMENT_VIEW_H_ | 5 #ifndef SKY_VIEWER_DOCUMENT_VIEW_H_ |
| 6 #define SKY_VIEWER_DOCUMENT_VIEW_H_ | 6 #define SKY_VIEWER_DOCUMENT_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "mojo/public/cpp/application/lazy_interface_ptr.h" | 10 #include "mojo/public/cpp/application/lazy_interface_ptr.h" |
| 11 #include "mojo/public/cpp/application/service_provider_impl.h" | 11 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 12 #include "mojo/public/cpp/bindings/interface_impl.h" | 12 #include "mojo/public/cpp/bindings/interface_impl.h" |
| 13 #include "mojo/public/interfaces/application/application.mojom.h" | 13 #include "mojo/public/interfaces/application/application.mojom.h" |
| 14 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom.
h" | 14 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom.
h" |
| 15 #include "mojo/services/navigation/public/interfaces/navigation.mojom.h" | 15 #include "mojo/services/navigation/public/interfaces/navigation.mojom.h" |
| 16 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 16 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| 17 #include "mojo/services/view_manager/public/cpp/view_manager_client_factory.h" | 17 #include "mojo/services/view_manager/public/cpp/view_manager_client_factory.h" |
| 18 #include "mojo/services/view_manager/public/cpp/view_manager_delegate.h" | 18 #include "mojo/services/view_manager/public/cpp/view_manager_delegate.h" |
| 19 #include "mojo/services/view_manager/public/cpp/view_observer.h" | 19 #include "mojo/services/view_manager/public/cpp/view_observer.h" |
| 20 #include "sky/compositor/layer_client.h" | 20 #include "sky/compositor/layer_client.h" |
| 21 #include "sky/compositor/layer_host_client.h" | 21 #include "sky/compositor/layer_host_client.h" |
| 22 #include "sky/engine/public/platform/ServiceProvider.h" | 22 #include "sky/engine/public/platform/ServiceProvider.h" |
| 23 #include "sky/engine/public/web/WebFrameClient.h" | 23 #include "sky/engine/public/web/WebFrameClient.h" |
| 24 #include "sky/engine/public/web/WebViewClient.h" | 24 #include "sky/engine/public/web/WebViewClient.h" |
| 25 #include "sky/viewer/services/inspector_impl.h" | 25 #include "sky/viewer/services/inspector_impl.h" |
| 26 #include "ui/events/gestures/gesture_types.h" |
| 26 | 27 |
| 27 namespace mojo { | 28 namespace mojo { |
| 28 class ViewManager; | 29 class ViewManager; |
| 29 class View; | 30 class View; |
| 30 } | 31 } |
| 31 | 32 |
| 32 namespace inspector { | 33 namespace inspector { |
| 33 class InspectorBackendMojo; | 34 class InspectorBackendMojo; |
| 34 } | 35 } |
| 35 | 36 |
| 36 namespace sky { | 37 namespace sky { |
| 37 class InspectorHostImpl; | 38 class InspectorHostImpl; |
| 38 class Rasterizer; | 39 class Rasterizer; |
| 39 class RasterizerBitmap; | 40 class RasterizerBitmap; |
| 40 class ScriptRunner; | 41 class ScriptRunner; |
| 41 class Layer; | 42 class Layer; |
| 42 class LayerHost; | 43 class LayerHost; |
| 43 | 44 |
| 44 class DocumentView : public blink::ServiceProvider, | 45 class DocumentView : public blink::ServiceProvider, |
| 46 public blink::WebFrameClient, |
| 45 public blink::WebViewClient, | 47 public blink::WebViewClient, |
| 46 public blink::WebFrameClient, | 48 public mojo::ViewManagerDelegate, |
| 49 public mojo::ViewObserver, |
| 47 public sky::LayerClient, | 50 public sky::LayerClient, |
| 48 public sky::LayerHostClient, | 51 public sky::LayerHostClient, |
| 49 public mojo::ViewManagerDelegate, | 52 public ui::GestureConsumer { |
| 50 public mojo::ViewObserver { | |
| 51 public: | 53 public: |
| 52 DocumentView(mojo::InterfaceRequest<mojo::ServiceProvider> services, | 54 DocumentView(mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 53 mojo::ServiceProviderPtr exported_services, | 55 mojo::ServiceProviderPtr exported_services, |
| 54 mojo::URLResponsePtr response, | 56 mojo::URLResponsePtr response, |
| 55 mojo::Shell* shell); | 57 mojo::Shell* shell); |
| 56 virtual ~DocumentView(); | 58 ~DocumentView() override; |
| 57 | 59 |
| 58 base::WeakPtr<DocumentView> GetWeakPtr(); | 60 base::WeakPtr<DocumentView> GetWeakPtr(); |
| 59 | 61 |
| 60 blink::WebView* web_view() const { return web_view_; } | 62 blink::WebView* web_view() const { return web_view_; } |
| 61 mojo::ServiceProvider* imported_services() const { | 63 mojo::ServiceProvider* imported_services() const { |
| 62 return imported_services_.get(); | 64 return imported_services_.get(); |
| 63 } | 65 } |
| 64 | 66 |
| 65 mojo::Shell* shell() const { return shell_; } | 67 mojo::Shell* shell() const { return shell_; } |
| 66 | 68 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 const mojo::Rect& new_bounds) override; | 116 const mojo::Rect& new_bounds) override; |
| 115 void OnViewViewportMetricsChanged( | 117 void OnViewViewportMetricsChanged( |
| 116 mojo::View* view, | 118 mojo::View* view, |
| 117 const mojo::ViewportMetrics& old_metrics, | 119 const mojo::ViewportMetrics& old_metrics, |
| 118 const mojo::ViewportMetrics& new_metrics) override; | 120 const mojo::ViewportMetrics& new_metrics) override; |
| 119 void OnViewFocusChanged(mojo::View* gained_focus, | 121 void OnViewFocusChanged(mojo::View* gained_focus, |
| 120 mojo::View* lost_focus) override; | 122 mojo::View* lost_focus) override; |
| 121 void OnViewDestroyed(mojo::View* view) override; | 123 void OnViewDestroyed(mojo::View* view) override; |
| 122 void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; | 124 void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; |
| 123 | 125 |
| 126 bool DispatchInputEvent(const mojo::EventPtr& event); |
| 127 |
| 124 void Load(mojo::URLResponsePtr response); | 128 void Load(mojo::URLResponsePtr response); |
| 125 float GetDevicePixelRatio() const; | 129 float GetDevicePixelRatio() const; |
| 126 scoped_ptr<Rasterizer> CreateRasterizer(); | 130 scoped_ptr<Rasterizer> CreateRasterizer(); |
| 127 | 131 |
| 128 void UpdateRootSizeAndViewportMetrics(const mojo::Rect& new_bounds); | 132 void UpdateRootSizeAndViewportMetrics(const mojo::Rect& new_bounds); |
| 129 | 133 |
| 130 mojo::URLResponsePtr response_; | 134 mojo::URLResponsePtr response_; |
| 131 mojo::ServiceProviderImpl exported_services_; | 135 mojo::ServiceProviderImpl exported_services_; |
| 132 mojo::ServiceProviderPtr imported_services_; | 136 mojo::ServiceProviderPtr imported_services_; |
| 133 mojo::Shell* shell_; | 137 mojo::Shell* shell_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 146 int debugger_id_; | 150 int debugger_id_; |
| 147 | 151 |
| 148 base::WeakPtrFactory<DocumentView> weak_factory_; | 152 base::WeakPtrFactory<DocumentView> weak_factory_; |
| 149 | 153 |
| 150 DISALLOW_COPY_AND_ASSIGN(DocumentView); | 154 DISALLOW_COPY_AND_ASSIGN(DocumentView); |
| 151 }; | 155 }; |
| 152 | 156 |
| 153 } // namespace sky | 157 } // namespace sky |
| 154 | 158 |
| 155 #endif // SKY_VIEWER_DOCUMENT_VIEW_H_ | 159 #endif // SKY_VIEWER_DOCUMENT_VIEW_H_ |
| OLD | NEW |