| 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 MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ | 5 #ifndef MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ |
| 6 #define MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ | 6 #define MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "mojo/public/cpp/application/interface_factory.h" | 12 #include "mojo/public/cpp/application/interface_factory.h" |
| 12 #include "mojo/public/cpp/application/lazy_interface_ptr.h" | 13 #include "mojo/public/cpp/application/lazy_interface_ptr.h" |
| 13 #include "mojo/public/cpp/application/service_provider_impl.h" | 14 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 14 #include "mojo/public/cpp/bindings/interface_impl.h" | 15 #include "mojo/public/cpp/bindings/interface_impl.h" |
| 15 #include "mojo/public/interfaces/application/application.mojom.h" | 16 #include "mojo/public/interfaces/application/application.mojom.h" |
| 16 #include "mojo/services/html_viewer/ax_provider_impl.h" | 17 #include "mojo/services/html_viewer/ax_provider_impl.h" |
| 17 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" | 18 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" |
| 18 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 19 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
| 19 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 20 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
| 20 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom.
h" | 21 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom.
h" |
| 21 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" | 22 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" |
| 22 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" | 23 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" |
| 23 #include "third_party/WebKit/public/web/WebFrameClient.h" | 24 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 24 #include "third_party/WebKit/public/web/WebViewClient.h" | 25 #include "third_party/WebKit/public/web/WebViewClient.h" |
| 25 | 26 |
| 26 namespace base { | 27 namespace base { |
| 27 class MessageLoopProxy; | 28 class MessageLoopProxy; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace mojo { | 31 namespace mojo { |
| 31 | 32 |
| 32 class AxProviderImpl; | 33 class AxProviderImpl; |
| 33 class WebMediaPlayerFactory; | 34 class WebMediaPlayerFactory; |
| 34 class ViewManager; | 35 class ViewManager; |
| 35 class View; | 36 class View; |
| 36 class WebLayerTreeViewImpl; | 37 class WebLayerTreeViewImpl; |
| 37 | 38 |
| 38 // A view for a single HTML document. | 39 // A view for a single HTML document. |
| 39 class HTMLDocumentView : public mojo::InterfaceImpl<mojo::Application>, | 40 class HTMLDocumentView : public blink::WebViewClient, |
| 40 public blink::WebViewClient, | |
| 41 public blink::WebFrameClient, | 41 public blink::WebFrameClient, |
| 42 public ViewManagerDelegate, | 42 public ViewManagerDelegate, |
| 43 public ViewObserver, | 43 public ViewObserver, |
| 44 public InterfaceFactory<AxProvider> { | 44 public InterfaceFactory<AxProvider> { |
| 45 public: | 45 public: |
| 46 // Load a new HTMLDocument with |response|. | 46 // Load a new HTMLDocument with |response|. |
| 47 // | 47 // |
| 48 // |service_provider_request| should be used to implement a | 48 // |service_provider_request| should be used to implement a |
| 49 // ServiceProvider which exposes services to the connecting application. | 49 // ServiceProvider which exposes services to the connecting application. |
| 50 // Commonly, the connecting application is the ViewManager and it will | 50 // Commonly, the connecting application is the ViewManager and it will |
| 51 // request ViewManagerClient. | 51 // request ViewManagerClient. |
| 52 // | 52 // |
| 53 // |shell| is the Shell connection for this mojo::Application. | 53 // |shell| is the Shell connection for this mojo::Application. |
| 54 HTMLDocumentView(URLResponsePtr response, | 54 HTMLDocumentView(const base::Closure& destruction_callback, |
| 55 ShellPtr shell, | 55 ServiceProviderPtr provider, |
| 56 URLResponsePtr response, |
| 57 Shell* shell, |
| 56 scoped_refptr<base::MessageLoopProxy> compositor_thread, | 58 scoped_refptr<base::MessageLoopProxy> compositor_thread, |
| 57 WebMediaPlayerFactory* web_media_player_factory); | 59 WebMediaPlayerFactory* web_media_player_factory); |
| 58 virtual ~HTMLDocumentView(); | 60 virtual ~HTMLDocumentView(); |
| 59 | 61 |
| 60 private: | 62 private: |
| 61 // Application methods: | |
| 62 void AcceptConnection(const String& requestor_url, | |
| 63 ServiceProviderPtr provider) override; | |
| 64 void Initialize(Array<String> args) override; | |
| 65 | |
| 66 // WebViewClient methods: | 63 // WebViewClient methods: |
| 67 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); | 64 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); |
| 68 | 65 |
| 69 // WebWidgetClient methods: | 66 // WebWidgetClient methods: |
| 70 virtual void initializeLayerTreeView(); | 67 virtual void initializeLayerTreeView(); |
| 71 virtual blink::WebLayerTreeView* layerTreeView(); | 68 virtual blink::WebLayerTreeView* layerTreeView(); |
| 72 | 69 |
| 73 // WebFrameClient methods: | 70 // WebFrameClient methods: |
| 74 virtual blink::WebMediaPlayer* createMediaPlayer( | 71 virtual blink::WebMediaPlayer* createMediaPlayer( |
| 75 blink::WebLocalFrame* frame, | 72 blink::WebLocalFrame* frame, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 const Rect& new_bounds) override; | 108 const Rect& new_bounds) override; |
| 112 void OnViewDestroyed(View* view) override; | 109 void OnViewDestroyed(View* view) override; |
| 113 void OnViewInputEvent(View* view, const EventPtr& event) override; | 110 void OnViewInputEvent(View* view, const EventPtr& event) override; |
| 114 | 111 |
| 115 // InterfaceFactory<AxProvider> | 112 // InterfaceFactory<AxProvider> |
| 116 void Create(ApplicationConnection* connection, | 113 void Create(ApplicationConnection* connection, |
| 117 InterfaceRequest<AxProvider> request) override; | 114 InterfaceRequest<AxProvider> request) override; |
| 118 | 115 |
| 119 void Load(URLResponsePtr response); | 116 void Load(URLResponsePtr response); |
| 120 | 117 |
| 118 base::Closure destruction_callback_; |
| 121 URLResponsePtr response_; | 119 URLResponsePtr response_; |
| 122 ServiceProviderImpl exported_services_; | 120 ServiceProviderImpl exported_services_; |
| 123 scoped_ptr<ServiceProvider> embedder_service_provider_; | 121 scoped_ptr<ServiceProvider> embedder_service_provider_; |
| 124 ShellPtr shell_; | 122 Shell* shell_; |
| 125 LazyInterfacePtr<NavigatorHost> navigator_host_; | 123 LazyInterfacePtr<NavigatorHost> navigator_host_; |
| 126 blink::WebView* web_view_; | 124 blink::WebView* web_view_; |
| 127 View* root_; | 125 View* root_; |
| 128 ViewManagerClientFactory view_manager_client_factory_; | 126 ViewManagerClientFactory view_manager_client_factory_; |
| 129 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; | 127 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; |
| 130 scoped_refptr<base::MessageLoopProxy> compositor_thread_; | 128 scoped_refptr<base::MessageLoopProxy> compositor_thread_; |
| 131 WebMediaPlayerFactory* web_media_player_factory_; | 129 WebMediaPlayerFactory* web_media_player_factory_; |
| 132 | 130 |
| 133 // HTMLDocumentView owns these pointers. | 131 // HTMLDocumentView owns these pointers. |
| 134 std::set<AxProviderImpl*> ax_provider_impls_; | 132 std::set<AxProviderImpl*> ax_provider_impls_; |
| 135 | 133 |
| 136 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); | 134 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); |
| 137 }; | 135 }; |
| 138 | 136 |
| 139 } // namespace mojo | 137 } // namespace mojo |
| 140 | 138 |
| 141 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ | 139 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ |
| OLD | NEW |