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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
9 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
10 #include "mojo/public/cpp/application/lazy_interface_ptr.h" | 11 #include "mojo/public/cpp/application/lazy_interface_ptr.h" |
11 #include "mojo/public/cpp/application/service_provider_impl.h" | 12 #include "mojo/public/cpp/application/service_provider_impl.h" |
12 #include "mojo/public/cpp/bindings/interface_impl.h" | 13 #include "mojo/public/cpp/bindings/interface_impl.h" |
13 #include "mojo/public/interfaces/application/application.mojom.h" | 14 #include "mojo/public/interfaces/application/application.mojom.h" |
14 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" | 15 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" |
15 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 16 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
16 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 17 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
17 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom.
h" | 18 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom.
h" |
(...skipping 10 matching lines...) Expand all Loading... |
28 | 29 |
29 namespace mojo { | 30 namespace mojo { |
30 class ViewManager; | 31 class ViewManager; |
31 class View; | 32 class View; |
32 } | 33 } |
33 | 34 |
34 namespace sky { | 35 namespace sky { |
35 class ScriptRunner; | 36 class ScriptRunner; |
36 class WebLayerTreeViewImpl; | 37 class WebLayerTreeViewImpl; |
37 | 38 |
38 class DocumentView : public mojo::InterfaceImpl<mojo::Application>, | 39 class DocumentView : public blink::ServiceProvider, |
39 public blink::ServiceProvider, | |
40 public blink::WebViewClient, | 40 public blink::WebViewClient, |
41 public blink::WebFrameClient, | 41 public blink::WebFrameClient, |
42 public mojo::ViewManagerDelegate, | 42 public mojo::ViewManagerDelegate, |
43 public mojo::ViewObserver { | 43 public mojo::ViewObserver { |
44 public: | 44 public: |
45 // Load a new HTMLDocument with |response|. | 45 // Load a new HTMLDocument with |response|. |
46 // | 46 // |
47 // |shell| is the Shell connection for this mojo::Application. | 47 // |shell| is the Shell connection for this mojo::Application. |
48 DocumentView(mojo::URLResponsePtr response, | 48 DocumentView(const base::Closure& destruction_callback, |
49 mojo::ShellPtr shell, | 49 mojo::ServiceProviderPtr provider, |
| 50 mojo::URLResponsePtr response, |
| 51 mojo::Shell* shell, |
50 scoped_refptr<base::MessageLoopProxy> compositor_thread); | 52 scoped_refptr<base::MessageLoopProxy> compositor_thread); |
51 virtual ~DocumentView(); | 53 virtual ~DocumentView(); |
52 | 54 |
53 base::WeakPtr<DocumentView> GetWeakPtr(); | 55 base::WeakPtr<DocumentView> GetWeakPtr(); |
54 | 56 |
55 blink::WebView* web_view() const { return web_view_; } | 57 blink::WebView* web_view() const { return web_view_; } |
56 mojo::ServiceProvider* imported_services() const { | 58 mojo::ServiceProvider* imported_services() const { |
57 return imported_services_.get(); | 59 return imported_services_.get(); |
58 } | 60 } |
59 | 61 |
60 mojo::Shell* shell() const { return shell_.get(); } | 62 mojo::Shell* shell() const { return shell_; } |
61 | 63 |
62 private: | 64 private: |
63 // Application methods: | |
64 void AcceptConnection(const mojo::String& requestor_url, | |
65 mojo::ServiceProviderPtr provider) override; | |
66 void Initialize(mojo::Array<mojo::String> args) override; | |
67 | |
68 // WebWidgetClient methods: | 65 // WebWidgetClient methods: |
69 blink::WebLayerTreeView* initializeLayerTreeView() override; | 66 blink::WebLayerTreeView* initializeLayerTreeView() override; |
70 void scheduleAnimation() override; | 67 void scheduleAnimation() override; |
71 | 68 |
72 // WebFrameClient methods: | 69 // WebFrameClient methods: |
73 mojo::View* createChildFrame(const blink::WebURL& url) override; | 70 mojo::View* createChildFrame(const blink::WebURL& url) override; |
74 void frameDetached(blink::WebFrame*) override; | 71 void frameDetached(blink::WebFrame*) override; |
75 blink::WebNavigationPolicy decidePolicyForNavigation( | 72 blink::WebNavigationPolicy decidePolicyForNavigation( |
76 const blink::WebFrameClient::NavigationPolicyInfo& info) override; | 73 const blink::WebFrameClient::NavigationPolicyInfo& info) override; |
77 void didAddMessageToConsole( | 74 void didAddMessageToConsole( |
(...skipping 26 matching lines...) Expand all Loading... |
104 void OnViewBoundsChanged(mojo::View* view, | 101 void OnViewBoundsChanged(mojo::View* view, |
105 const mojo::Rect& old_bounds, | 102 const mojo::Rect& old_bounds, |
106 const mojo::Rect& new_bounds) override; | 103 const mojo::Rect& new_bounds) override; |
107 void OnViewFocusChanged(mojo::View* gained_focus, | 104 void OnViewFocusChanged(mojo::View* gained_focus, |
108 mojo::View* lost_focus) override; | 105 mojo::View* lost_focus) override; |
109 void OnViewDestroyed(mojo::View* view) override; | 106 void OnViewDestroyed(mojo::View* view) override; |
110 void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; | 107 void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; |
111 | 108 |
112 void Load(mojo::URLResponsePtr response); | 109 void Load(mojo::URLResponsePtr response); |
113 | 110 |
| 111 base::Closure destruction_callback_; |
114 mojo::URLResponsePtr response_; | 112 mojo::URLResponsePtr response_; |
115 mojo::ServiceProviderImpl exported_services_; | 113 mojo::ServiceProviderImpl exported_services_; |
116 scoped_ptr<mojo::ServiceProvider> imported_services_; | 114 scoped_ptr<mojo::ServiceProvider> imported_services_; |
117 mojo::ShellPtr shell_; | 115 mojo::Shell* shell_; |
118 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; | 116 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; |
119 blink::WebView* web_view_; | 117 blink::WebView* web_view_; |
120 mojo::View* root_; | 118 mojo::View* root_; |
121 mojo::ViewManagerClientFactory view_manager_client_factory_; | 119 mojo::ViewManagerClientFactory view_manager_client_factory_; |
122 InspectorServiceFactory inspector_service_factory_; | 120 InspectorServiceFactory inspector_service_factory_; |
123 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; | 121 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; |
124 scoped_refptr<base::MessageLoopProxy> compositor_thread_; | 122 scoped_refptr<base::MessageLoopProxy> compositor_thread_; |
125 scoped_ptr<ScriptRunner> script_runner_; | 123 scoped_ptr<ScriptRunner> script_runner_; |
126 int debugger_id_; | 124 int debugger_id_; |
127 | 125 |
128 base::WeakPtrFactory<DocumentView> weak_factory_; | 126 base::WeakPtrFactory<DocumentView> weak_factory_; |
129 DISALLOW_COPY_AND_ASSIGN(DocumentView); | 127 DISALLOW_COPY_AND_ASSIGN(DocumentView); |
130 }; | 128 }; |
131 | 129 |
132 } // namespace sky | 130 } // namespace sky |
133 | 131 |
134 #endif // SKY_VIEWER_DOCUMENT_VIEW_H_ | 132 #endif // SKY_VIEWER_DOCUMENT_VIEW_H_ |
OLD | NEW |