Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1211)

Side by Side Diff: mojo/services/html_viewer/html_document.h

Issue 776553003: Fix html viewer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Follow review Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_H_
6 #define MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_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"
Aaron Boodman 2014/12/10 08:54:28 unused
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 HTMLDocument : 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 HTMLDocument(ServiceProviderPtr provider,
55 ShellPtr shell, 55 URLResponsePtr response,
56 scoped_refptr<base::MessageLoopProxy> compositor_thread, 56 Shell* shell,
57 WebMediaPlayerFactory* web_media_player_factory); 57 scoped_refptr<base::MessageLoopProxy> compositor_thread,
58 virtual ~HTMLDocumentView(); 58 WebMediaPlayerFactory* web_media_player_factory);
59 virtual ~HTMLDocument();
59 60
60 private: 61 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: 62 // WebViewClient methods:
67 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); 63 virtual blink::WebStorageNamespace* createSessionStorageNamespace();
68 64
69 // WebWidgetClient methods: 65 // WebWidgetClient methods:
70 virtual void initializeLayerTreeView(); 66 virtual void initializeLayerTreeView();
71 virtual blink::WebLayerTreeView* layerTreeView(); 67 virtual blink::WebLayerTreeView* layerTreeView();
72 68
73 // WebFrameClient methods: 69 // WebFrameClient methods:
74 virtual blink::WebMediaPlayer* createMediaPlayer( 70 virtual blink::WebMediaPlayer* createMediaPlayer(
75 blink::WebLocalFrame* frame, 71 blink::WebLocalFrame* frame,
76 const blink::WebURL& url, 72 const blink::WebURL& url,
77 blink::WebMediaPlayerClient* client); 73 blink::WebMediaPlayerClient* client);
78 virtual blink::WebMediaPlayer* createMediaPlayer( 74 virtual blink::WebMediaPlayer* createMediaPlayer(
79 blink::WebLocalFrame* frame, 75 blink::WebLocalFrame* frame,
80 const blink::WebURL& url, 76 const blink::WebURL& url,
81 blink::WebMediaPlayerClient* client, 77 blink::WebMediaPlayerClient* client,
82 blink::WebContentDecryptionModule* initial_cdm); 78 blink::WebContentDecryptionModule* initial_cdm);
83 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent, 79 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent,
84 const blink::WebString& frameName); 80 const blink::WebString& frameName);
85 virtual void frameDetached(blink::WebFrame*); 81 virtual void frameDetached(blink::WebFrame*);
86 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame); 82 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame);
87 virtual blink::WebNavigationPolicy decidePolicyForNavigation( 83 virtual blink::WebNavigationPolicy decidePolicyForNavigation(
88 blink::WebLocalFrame* frame, blink::WebDataSource::ExtraData* data,
89 const blink::WebURLRequest& request, blink::WebNavigationType nav_type,
90 blink::WebNavigationPolicy default_policy, bool isRedirect);
91 virtual void didAddMessageToConsole(
92 const blink::WebConsoleMessage& message,
93 const blink::WebString& source_name,
94 unsigned source_line,
95 const blink::WebString& stack_trace);
96 virtual void didNavigateWithinPage(
97 blink::WebLocalFrame* frame, 84 blink::WebLocalFrame* frame,
98 const blink::WebHistoryItem& history_item, 85 blink::WebDataSource::ExtraData* data,
99 blink::WebHistoryCommitType commit_type); 86 const blink::WebURLRequest& request,
87 blink::WebNavigationType nav_type,
88 blink::WebNavigationPolicy default_policy,
89 bool isRedirect);
90 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message,
91 const blink::WebString& source_name,
92 unsigned source_line,
93 const blink::WebString& stack_trace);
94 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame,
95 const blink::WebHistoryItem& history_item,
96 blink::WebHistoryCommitType commit_type);
100 97
101 // ViewManagerDelegate methods: 98 // ViewManagerDelegate methods:
102 void OnEmbed(ViewManager* view_manager, 99 void OnEmbed(ViewManager* view_manager,
103 View* root, 100 View* root,
104 ServiceProviderImpl* embedee_service_provider_impl, 101 ServiceProviderImpl* embedee_service_provider_impl,
105 scoped_ptr<ServiceProvider> embedder_service_provider) override; 102 scoped_ptr<ServiceProvider> embedder_service_provider) override;
106 void OnViewManagerDisconnected(ViewManager* view_manager) override; 103 void OnViewManagerDisconnected(ViewManager* view_manager) override;
107 104
108 // ViewObserver methods: 105 // ViewObserver methods:
109 void OnViewBoundsChanged(View* view, 106 void OnViewBoundsChanged(View* view,
110 const Rect& old_bounds, 107 const Rect& old_bounds,
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
121 URLResponsePtr response_; 118 URLResponsePtr response_;
122 ServiceProviderImpl exported_services_; 119 ServiceProviderImpl exported_services_;
123 scoped_ptr<ServiceProvider> embedder_service_provider_; 120 scoped_ptr<ServiceProvider> embedder_service_provider_;
124 ShellPtr shell_; 121 Shell* shell_;
125 LazyInterfacePtr<NavigatorHost> navigator_host_; 122 LazyInterfacePtr<NavigatorHost> navigator_host_;
126 blink::WebView* web_view_; 123 blink::WebView* web_view_;
127 View* root_; 124 View* root_;
128 ViewManagerClientFactory view_manager_client_factory_; 125 ViewManagerClientFactory view_manager_client_factory_;
129 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; 126 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_;
130 scoped_refptr<base::MessageLoopProxy> compositor_thread_; 127 scoped_refptr<base::MessageLoopProxy> compositor_thread_;
131 WebMediaPlayerFactory* web_media_player_factory_; 128 WebMediaPlayerFactory* web_media_player_factory_;
132 129
133 // HTMLDocumentView owns these pointers. 130 // HTMLDocument owns these pointers.
134 std::set<AxProviderImpl*> ax_provider_impls_; 131 std::set<AxProviderImpl*> ax_provider_impls_;
135 132
136 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); 133 DISALLOW_COPY_AND_ASSIGN(HTMLDocument);
137 }; 134 };
138 135
139 } // namespace mojo 136 } // namespace mojo
140 137
141 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ 138 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698