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

Side by Side Diff: mojo/services/html_viewer/html_document_view.cc

Issue 694923002: Update mojo sdk to rev 91d94d6993c9b0c4135a95687a7d541ce90629b (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 #include "mojo/services/html_viewer/html_document_view.h" 5 #include "mojo/services/html_viewer/html_document_view.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
13 #include "mojo/public/cpp/application/connect.h" 13 #include "mojo/public/cpp/application/connect.h"
14 #include "mojo/public/cpp/application/service_provider_impl.h"
15 #include "mojo/public/cpp/system/data_pipe.h" 14 #include "mojo/public/cpp/system/data_pipe.h"
16 #include "mojo/public/interfaces/application/shell.mojom.h" 15 #include "mojo/public/interfaces/application/shell.mojom.h"
17 #include "mojo/services/html_viewer/blink_input_events_type_converters.h" 16 #include "mojo/services/html_viewer/blink_input_events_type_converters.h"
18 #include "mojo/services/html_viewer/blink_url_request_type_converters.h" 17 #include "mojo/services/html_viewer/blink_url_request_type_converters.h"
19 #include "mojo/services/html_viewer/weblayertreeview_impl.h" 18 #include "mojo/services/html_viewer/weblayertreeview_impl.h"
20 #include "mojo/services/html_viewer/webmediaplayer_factory.h" 19 #include "mojo/services/html_viewer/webmediaplayer_factory.h"
21 #include "mojo/services/html_viewer/webstoragenamespace_impl.h" 20 #include "mojo/services/html_viewer/webstoragenamespace_impl.h"
22 #include "mojo/services/html_viewer/weburlloader_impl.h" 21 #include "mojo/services/html_viewer/weburlloader_impl.h"
23 #include "mojo/services/public/cpp/view_manager/view.h" 22 #include "mojo/services/public/cpp/view_manager/view.h"
24 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h" 23 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 79
81 // Otherwise we don't know if we're the right app to handle this request. Ask 80 // Otherwise we don't know if we're the right app to handle this request. Ask
82 // host to do the navigation for us. 81 // host to do the navigation for us.
83 return false; 82 return false;
84 } 83 }
85 84
86 } // namespace 85 } // namespace
87 86
88 HTMLDocumentView::HTMLDocumentView( 87 HTMLDocumentView::HTMLDocumentView(
89 URLResponsePtr response, 88 URLResponsePtr response,
90 InterfaceRequest<ServiceProvider> service_provider_request, 89 ShellPtr shell,
91 Shell* shell,
92 scoped_refptr<base::MessageLoopProxy> compositor_thread, 90 scoped_refptr<base::MessageLoopProxy> compositor_thread,
93 WebMediaPlayerFactory* web_media_player_factory) 91 WebMediaPlayerFactory* web_media_player_factory)
94 : shell_(shell), 92 : shell_(shell.Pass()),
95 web_view_(NULL), 93 web_view_(NULL),
96 root_(NULL), 94 root_(NULL),
97 view_manager_client_factory_(shell, this), 95 view_manager_client_factory_(shell_.get(), this),
98 compositor_thread_(compositor_thread), 96 compositor_thread_(compositor_thread),
99 web_media_player_factory_(web_media_player_factory), 97 web_media_player_factory_(web_media_player_factory),
100 weak_factory_(this) { 98 weak_factory_(this) {
101 ServiceProviderImpl* exported_services = new ServiceProviderImpl();
102 exported_services->AddService(&view_manager_client_factory_);
103 BindToRequest(exported_services, &service_provider_request);
104 Load(response.Pass()); 99 Load(response.Pass());
105 } 100 }
106 101
107 HTMLDocumentView::~HTMLDocumentView() { 102 HTMLDocumentView::~HTMLDocumentView() {
108 if (web_view_) 103 if (web_view_)
109 web_view_->close(); 104 web_view_->close();
110 if (root_) 105 if (root_)
111 root_->RemoveObserver(this); 106 root_->RemoveObserver(this);
112 } 107 }
113 108
109 void HTMLDocumentView::AcceptConnection(const String& requestor_url,
110 ServiceProviderPtr provider) {
111 exported_services_.AddService(&view_manager_client_factory_);
112 WeakBindToPipe(&exported_services_, provider.PassMessagePipe());
113 }
114
115 void HTMLDocumentView::Initialize(Array<String> args) {
116 }
117
114 void HTMLDocumentView::OnEmbed( 118 void HTMLDocumentView::OnEmbed(
115 ViewManager* view_manager, 119 ViewManager* view_manager,
116 View* root, 120 View* root,
117 ServiceProviderImpl* embedee_service_provider_impl, 121 ServiceProviderImpl* embedee_service_provider_impl,
118 scoped_ptr<ServiceProvider> embedder_service_provider) { 122 scoped_ptr<ServiceProvider> embedder_service_provider) {
119 root_ = root; 123 root_ = root;
120 embedder_service_provider_ = embedder_service_provider.Pass(); 124 embedder_service_provider_ = embedder_service_provider.Pass();
121 navigator_host_.set_service_provider(embedder_service_provider_.get()); 125 navigator_host_.set_service_provider(embedder_service_provider_.get());
122 126
123 blink::WebSize root_size(root_->bounds().width, root_->bounds().height); 127 blink::WebSize root_size(root_->bounds().width, root_->bounds().height);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 177
174 blink::WebLayerTreeView* HTMLDocumentView::layerTreeView() { 178 blink::WebLayerTreeView* HTMLDocumentView::layerTreeView() {
175 return web_layer_tree_view_impl_.get(); 179 return web_layer_tree_view_impl_.get();
176 } 180 }
177 181
178 blink::WebMediaPlayer* HTMLDocumentView::createMediaPlayer( 182 blink::WebMediaPlayer* HTMLDocumentView::createMediaPlayer(
179 blink::WebLocalFrame* frame, 183 blink::WebLocalFrame* frame,
180 const blink::WebURL& url, 184 const blink::WebURL& url,
181 blink::WebMediaPlayerClient* client) { 185 blink::WebMediaPlayerClient* client) {
182 return web_media_player_factory_->CreateMediaPlayer( 186 return web_media_player_factory_->CreateMediaPlayer(
183 frame, url, client, shell_); 187 frame, url, client, shell_.get());
184 } 188 }
185 189
186 blink::WebMediaPlayer* HTMLDocumentView::createMediaPlayer( 190 blink::WebMediaPlayer* HTMLDocumentView::createMediaPlayer(
187 blink::WebLocalFrame* frame, 191 blink::WebLocalFrame* frame,
188 const blink::WebURL& url, 192 const blink::WebURL& url,
189 blink::WebMediaPlayerClient* client, 193 blink::WebMediaPlayerClient* client,
190 blink::WebContentDecryptionModule* initial_cdm) { 194 blink::WebContentDecryptionModule* initial_cdm) {
191 return createMediaPlayer(frame, url, client); 195 return createMediaPlayer(frame, url, client);
192 } 196 }
193 197
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 259 }
256 260
257 void HTMLDocumentView::OnViewInputEvent(View* view, const EventPtr& event) { 261 void HTMLDocumentView::OnViewInputEvent(View* view, const EventPtr& event) {
258 scoped_ptr<blink::WebInputEvent> web_event = 262 scoped_ptr<blink::WebInputEvent> web_event =
259 event.To<scoped_ptr<blink::WebInputEvent> >(); 263 event.To<scoped_ptr<blink::WebInputEvent> >();
260 if (web_event) 264 if (web_event)
261 web_view_->handleInputEvent(*web_event); 265 web_view_->handleInputEvent(*web_event);
262 } 266 }
263 267
264 } // namespace mojo 268 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/html_viewer/html_document_view.h ('k') | mojo/services/html_viewer/html_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698