| 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_H_ | 5 #ifndef MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_H_ |
| 6 #define MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_H_ | 6 #define MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "mojo/services/view_manager/public/cpp/view_manager_delegate.h" | 22 #include "mojo/services/view_manager/public/cpp/view_manager_delegate.h" |
| 23 #include "mojo/services/view_manager/public/cpp/view_observer.h" | 23 #include "mojo/services/view_manager/public/cpp/view_observer.h" |
| 24 #include "third_party/WebKit/public/web/WebFrameClient.h" | 24 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 25 #include "third_party/WebKit/public/web/WebViewClient.h" | 25 #include "third_party/WebKit/public/web/WebViewClient.h" |
| 26 | 26 |
| 27 namespace base { | 27 namespace base { |
| 28 class MessageLoopProxy; | 28 class MessageLoopProxy; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace mojo { | 31 namespace mojo { |
| 32 class ViewManager; |
| 33 class View; |
| 34 } |
| 35 |
| 36 namespace html_viewer { |
| 32 | 37 |
| 33 class AxProviderImpl; | 38 class AxProviderImpl; |
| 39 class WebLayerTreeViewImpl; |
| 34 class WebMediaPlayerFactory; | 40 class WebMediaPlayerFactory; |
| 35 class ViewManager; | |
| 36 class View; | |
| 37 class WebLayerTreeViewImpl; | |
| 38 | 41 |
| 39 // A view for a single HTML document. | 42 // A view for a single HTML document. |
| 40 class HTMLDocument : public blink::WebViewClient, | 43 class HTMLDocument : public blink::WebViewClient, |
| 41 public blink::WebFrameClient, | 44 public blink::WebFrameClient, |
| 42 public ViewManagerDelegate, | 45 public mojo::ViewManagerDelegate, |
| 43 public ViewObserver, | 46 public mojo::ViewObserver, |
| 44 public InterfaceFactory<AxProvider> { | 47 public mojo::InterfaceFactory<mojo::AxProvider> { |
| 45 public: | 48 public: |
| 46 // Load a new HTMLDocument with |response|. | 49 // Load a new HTMLDocument with |response|. |
| 47 // | 50 // |
| 48 // |service_provider_request| should be used to implement a | 51 // |service_provider_request| should be used to implement a |
| 49 // ServiceProvider which exposes services to the connecting application. | 52 // ServiceProvider which exposes services to the connecting application. |
| 50 // Commonly, the connecting application is the ViewManager and it will | 53 // Commonly, the connecting application is the ViewManager and it will |
| 51 // request ViewManagerClient. | 54 // request ViewManagerClient. |
| 52 // | 55 // |
| 53 // |shell| is the Shell connection for this mojo::Application. | 56 // |shell| is the Shell connection for this mojo::Application. |
| 54 HTMLDocument(ServiceProviderPtr provider, | 57 HTMLDocument(mojo::ServiceProviderPtr provider, |
| 55 URLResponsePtr response, | 58 mojo::URLResponsePtr response, |
| 56 Shell* shell, | 59 mojo::Shell* shell, |
| 57 scoped_refptr<base::MessageLoopProxy> compositor_thread, | 60 scoped_refptr<base::MessageLoopProxy> compositor_thread, |
| 58 WebMediaPlayerFactory* web_media_player_factory); | 61 WebMediaPlayerFactory* web_media_player_factory); |
| 59 virtual ~HTMLDocument(); | 62 virtual ~HTMLDocument(); |
| 60 | 63 |
| 61 private: | 64 private: |
| 62 // WebViewClient methods: | 65 // WebViewClient methods: |
| 63 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); | 66 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); |
| 64 | 67 |
| 65 // WebWidgetClient methods: | 68 // WebWidgetClient methods: |
| 66 virtual void initializeLayerTreeView(); | 69 virtual void initializeLayerTreeView(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 89 bool isRedirect); | 92 bool isRedirect); |
| 90 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message, | 93 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message, |
| 91 const blink::WebString& source_name, | 94 const blink::WebString& source_name, |
| 92 unsigned source_line, | 95 unsigned source_line, |
| 93 const blink::WebString& stack_trace); | 96 const blink::WebString& stack_trace); |
| 94 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame, | 97 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame, |
| 95 const blink::WebHistoryItem& history_item, | 98 const blink::WebHistoryItem& history_item, |
| 96 blink::WebHistoryCommitType commit_type); | 99 blink::WebHistoryCommitType commit_type); |
| 97 | 100 |
| 98 // ViewManagerDelegate methods: | 101 // ViewManagerDelegate methods: |
| 99 void OnEmbed(ViewManager* view_manager, | 102 void OnEmbed( |
| 100 View* root, | 103 mojo::ViewManager* view_manager, |
| 101 ServiceProviderImpl* embedee_service_provider_impl, | 104 mojo::View* root, |
| 102 scoped_ptr<ServiceProvider> embedder_service_provider) override; | 105 mojo::ServiceProviderImpl* embedee_service_provider_impl, |
| 103 void OnViewManagerDisconnected(ViewManager* view_manager) override; | 106 scoped_ptr<mojo::ServiceProvider> embedder_service_provider) override; |
| 107 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override; |
| 104 | 108 |
| 105 // ViewObserver methods: | 109 // ViewObserver methods: |
| 106 void OnViewBoundsChanged(View* view, | 110 void OnViewBoundsChanged(mojo::View* view, |
| 107 const Rect& old_bounds, | 111 const mojo::Rect& old_bounds, |
| 108 const Rect& new_bounds) override; | 112 const mojo::Rect& new_bounds) override; |
| 109 void OnViewDestroyed(View* view) override; | 113 void OnViewDestroyed(mojo::View* view) override; |
| 110 void OnViewInputEvent(View* view, const EventPtr& event) override; | 114 void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; |
| 111 | 115 |
| 112 // InterfaceFactory<AxProvider> | 116 // InterfaceFactory<AxProvider> |
| 113 void Create(ApplicationConnection* connection, | 117 void Create(mojo::ApplicationConnection* connection, |
| 114 InterfaceRequest<AxProvider> request) override; | 118 mojo::InterfaceRequest<mojo::AxProvider> request) override; |
| 115 | 119 |
| 116 void Load(URLResponsePtr response); | 120 void Load(mojo::URLResponsePtr response); |
| 117 | 121 |
| 118 URLResponsePtr response_; | 122 mojo::URLResponsePtr response_; |
| 119 ServiceProviderImpl exported_services_; | 123 mojo::ServiceProviderImpl exported_services_; |
| 120 scoped_ptr<ServiceProvider> embedder_service_provider_; | 124 scoped_ptr<mojo::ServiceProvider> embedder_service_provider_; |
| 121 Shell* shell_; | 125 mojo::Shell* shell_; |
| 122 LazyInterfacePtr<NavigatorHost> navigator_host_; | 126 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; |
| 123 blink::WebView* web_view_; | 127 blink::WebView* web_view_; |
| 124 View* root_; | 128 mojo::View* root_; |
| 125 ViewManagerClientFactory view_manager_client_factory_; | 129 mojo::ViewManagerClientFactory view_manager_client_factory_; |
| 126 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; | 130 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; |
| 127 scoped_refptr<base::MessageLoopProxy> compositor_thread_; | 131 scoped_refptr<base::MessageLoopProxy> compositor_thread_; |
| 128 WebMediaPlayerFactory* web_media_player_factory_; | 132 WebMediaPlayerFactory* web_media_player_factory_; |
| 129 | 133 |
| 130 // HTMLDocument owns these pointers. | 134 // HTMLDocument owns these pointers. |
| 131 std::set<AxProviderImpl*> ax_provider_impls_; | 135 std::set<AxProviderImpl*> ax_provider_impls_; |
| 132 | 136 |
| 133 DISALLOW_COPY_AND_ASSIGN(HTMLDocument); | 137 DISALLOW_COPY_AND_ASSIGN(HTMLDocument); |
| 134 }; | 138 }; |
| 135 | 139 |
| 136 } // namespace mojo | 140 } // namespace html_viewer |
| 137 | 141 |
| 138 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_H_ | 142 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_H_ |
| OLD | NEW |