Chromium Code Reviews| 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 "base/macros.h" | 8 #include "base/macros.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" | |
| 12 #include "mojo/public/cpp/bindings/interface_impl.h" | |
| 13 #include "mojo/public/interfaces/application/application.mojom.h" | |
| 11 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" | 14 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" |
| 12 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 15 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
| 13 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 16 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
| 14 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h" | 17 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h" |
| 15 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" | 18 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" |
| 16 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" | 19 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" |
| 17 #include "third_party/WebKit/public/web/WebFrameClient.h" | 20 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 18 #include "third_party/WebKit/public/web/WebViewClient.h" | 21 #include "third_party/WebKit/public/web/WebViewClient.h" |
| 19 | 22 |
| 20 namespace base { | 23 namespace base { |
| 21 class MessageLoopProxy; | 24 class MessageLoopProxy; |
| 22 } | 25 } |
| 23 | 26 |
| 24 namespace mojo { | 27 namespace mojo { |
| 25 | 28 |
| 26 class WebMediaPlayerFactory; | 29 class WebMediaPlayerFactory; |
| 27 class ViewManager; | 30 class ViewManager; |
| 28 class View; | 31 class View; |
| 29 class WebLayerTreeViewImpl; | 32 class WebLayerTreeViewImpl; |
| 30 | 33 |
| 31 // A view for a single HTML document. | 34 // A view for a single HTML document. |
| 32 class HTMLDocumentView : public blink::WebViewClient, | 35 class HTMLDocumentView : public mojo::InterfaceImpl<mojo::Application>, |
| 36 public blink::WebViewClient, | |
| 33 public blink::WebFrameClient, | 37 public blink::WebFrameClient, |
| 34 public ViewManagerDelegate, | 38 public ViewManagerDelegate, |
| 35 public ViewObserver { | 39 public ViewObserver { |
| 36 public: | 40 public: |
| 37 // Load a new HTMLDocument with |response|. | 41 // Load a new HTMLDocument with |response|. |
| 38 // | 42 // |
| 39 // |service_provider_request| should be used to implement a | 43 // |service_provider_request| should be used to implement a |
| 40 // ServiceProvider which exposes services to the connecting application. | 44 // ServiceProvider which exposes services to the connecting application. |
| 41 // Commonly, the connecting application is the ViewManager and it will | 45 // Commonly, the connecting application is the ViewManager and it will |
| 42 // request ViewManagerClient. | 46 // request ViewManagerClient. |
| 43 // | 47 // |
| 44 // |shell| is the Shell connection for this mojo::Application. | 48 // |shell| is the Shell connection for this mojo::Application. |
| 45 HTMLDocumentView(URLResponsePtr response, | 49 HTMLDocumentView(URLResponsePtr response, |
| 46 InterfaceRequest<ServiceProvider> service_provider_request, | 50 ShellPtr shell, |
| 47 Shell* shell, | |
| 48 scoped_refptr<base::MessageLoopProxy> compositor_thread, | 51 scoped_refptr<base::MessageLoopProxy> compositor_thread, |
| 49 WebMediaPlayerFactory* web_media_player_factory); | 52 WebMediaPlayerFactory* web_media_player_factory); |
| 50 virtual ~HTMLDocumentView(); | 53 virtual ~HTMLDocumentView(); |
| 51 | 54 |
| 52 private: | 55 private: |
| 56 // Application methods: | |
| 57 void AcceptConnection(const String& requestor_url, | |
| 58 ServiceProviderPtr provider) override; | |
|
Aaron Boodman
2014/10/31 18:38:49
Wrong wrapping?
jamesr
2014/10/31 19:05:10
Whoops, my bad
| |
| 59 void Initialize(Array<String> args) override; | |
| 60 | |
| 53 // WebViewClient methods: | 61 // WebViewClient methods: |
| 54 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); | 62 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); |
| 55 | 63 |
| 56 // WebWidgetClient methods: | 64 // WebWidgetClient methods: |
| 57 virtual void initializeLayerTreeView(); | 65 virtual void initializeLayerTreeView(); |
| 58 virtual blink::WebLayerTreeView* layerTreeView(); | 66 virtual blink::WebLayerTreeView* layerTreeView(); |
| 59 | 67 |
| 60 // WebFrameClient methods: | 68 // WebFrameClient methods: |
| 61 virtual blink::WebMediaPlayer* createMediaPlayer( | 69 virtual blink::WebMediaPlayer* createMediaPlayer( |
| 62 blink::WebLocalFrame* frame, | 70 blink::WebLocalFrame* frame, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 // ViewObserver methods: | 103 // ViewObserver methods: |
| 96 void OnViewBoundsChanged(View* view, | 104 void OnViewBoundsChanged(View* view, |
| 97 const Rect& old_bounds, | 105 const Rect& old_bounds, |
| 98 const Rect& new_bounds) override; | 106 const Rect& new_bounds) override; |
| 99 void OnViewDestroyed(View* view) override; | 107 void OnViewDestroyed(View* view) override; |
| 100 void OnViewInputEvent(View* view, const EventPtr& event) override; | 108 void OnViewInputEvent(View* view, const EventPtr& event) override; |
| 101 | 109 |
| 102 void Load(URLResponsePtr response); | 110 void Load(URLResponsePtr response); |
| 103 | 111 |
| 104 URLResponsePtr response_; | 112 URLResponsePtr response_; |
| 113 ServiceProviderImpl exported_services_; | |
| 105 scoped_ptr<ServiceProvider> embedder_service_provider_; | 114 scoped_ptr<ServiceProvider> embedder_service_provider_; |
| 106 Shell* shell_; | 115 ShellPtr shell_; |
| 107 LazyInterfacePtr<NavigatorHost> navigator_host_; | 116 LazyInterfacePtr<NavigatorHost> navigator_host_; |
| 108 blink::WebView* web_view_; | 117 blink::WebView* web_view_; |
| 109 View* root_; | 118 View* root_; |
| 110 ViewManagerClientFactory view_manager_client_factory_; | 119 ViewManagerClientFactory view_manager_client_factory_; |
| 111 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; | 120 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; |
| 112 scoped_refptr<base::MessageLoopProxy> compositor_thread_; | 121 scoped_refptr<base::MessageLoopProxy> compositor_thread_; |
| 113 WebMediaPlayerFactory* web_media_player_factory_; | 122 WebMediaPlayerFactory* web_media_player_factory_; |
| 114 | 123 |
| 115 base::WeakPtrFactory<HTMLDocumentView> weak_factory_; | 124 base::WeakPtrFactory<HTMLDocumentView> weak_factory_; |
| 116 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); | 125 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); |
| 117 }; | 126 }; |
| 118 | 127 |
| 119 } // namespace mojo | 128 } // namespace mojo |
| 120 | 129 |
| 121 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ | 130 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ |
| OLD | NEW |