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

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

Issue 796963003: Move Load() from HTMLDocument::OnEmbed() to the constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.h" 5 #include "mojo/services/html_viewer/html_document.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"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 : response_(response.Pass()), 94 : response_(response.Pass()),
95 shell_(shell), 95 shell_(shell),
96 web_view_(NULL), 96 web_view_(NULL),
97 root_(NULL), 97 root_(NULL),
98 view_manager_client_factory_(shell_, this), 98 view_manager_client_factory_(shell_, this),
99 compositor_thread_(compositor_thread), 99 compositor_thread_(compositor_thread),
100 web_media_player_factory_(web_media_player_factory) { 100 web_media_player_factory_(web_media_player_factory) {
101 exported_services_.AddService(this); 101 exported_services_.AddService(this);
102 exported_services_.AddService(&view_manager_client_factory_); 102 exported_services_.AddService(&view_manager_client_factory_);
103 WeakBindToPipe(&exported_services_, provider.PassMessagePipe()); 103 WeakBindToPipe(&exported_services_, provider.PassMessagePipe());
104 Load(response_.Pass());
104 } 105 }
105 106
106 HTMLDocument::~HTMLDocument() { 107 HTMLDocument::~HTMLDocument() {
107 STLDeleteElements(&ax_provider_impls_); 108 STLDeleteElements(&ax_provider_impls_);
108 109
109 if (web_view_) 110 if (web_view_)
110 web_view_->close(); 111 web_view_->close();
111 if (root_) 112 if (root_)
112 root_->RemoveObserver(this); 113 root_->RemoveObserver(this);
113 } 114 }
114 115
115 void HTMLDocument::OnEmbed( 116 void HTMLDocument::OnEmbed(
116 ViewManager* view_manager, 117 ViewManager* view_manager,
117 View* root, 118 View* root,
118 ServiceProviderImpl* embedee_service_provider_impl, 119 ServiceProviderImpl* embedee_service_provider_impl,
119 scoped_ptr<ServiceProvider> embedder_service_provider) { 120 scoped_ptr<ServiceProvider> embedder_service_provider) {
120 root_ = root; 121 root_ = root;
121 embedder_service_provider_ = embedder_service_provider.Pass(); 122 embedder_service_provider_ = embedder_service_provider.Pass();
122 navigator_host_.set_service_provider(embedder_service_provider_.get()); 123 navigator_host_.set_service_provider(embedder_service_provider_.get());
123 124
124 Load(response_.Pass());
125
126 blink::WebSize root_size(root_->bounds().width, root_->bounds().height); 125 blink::WebSize root_size(root_->bounds().width, root_->bounds().height);
127 web_view_->resize(root_size); 126 web_view_->resize(root_size);
128 web_layer_tree_view_impl_->setViewportSize(root_size); 127 web_layer_tree_view_impl_->setViewportSize(root_size);
129 web_layer_tree_view_impl_->set_view(root_); 128 web_layer_tree_view_impl_->set_view(root_);
130 root_->AddObserver(this); 129 root_->AddObserver(this);
131 } 130 }
132 131
133 void HTMLDocument::Create(ApplicationConnection* connection, 132 void HTMLDocument::Create(ApplicationConnection* connection,
134 InterfaceRequest<AxProvider> request) { 133 InterfaceRequest<AxProvider> request) {
135 if (!web_view_) 134 if (!web_view_)
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 268 }
270 269
271 void HTMLDocument::OnViewInputEvent(View* view, const EventPtr& event) { 270 void HTMLDocument::OnViewInputEvent(View* view, const EventPtr& event) {
272 scoped_ptr<blink::WebInputEvent> web_event = 271 scoped_ptr<blink::WebInputEvent> web_event =
273 event.To<scoped_ptr<blink::WebInputEvent>>(); 272 event.To<scoped_ptr<blink::WebInputEvent>>();
274 if (web_event) 273 if (web_event)
275 web_view_->handleInputEvent(*web_event); 274 web_view_->handleInputEvent(*web_event);
276 } 275 }
277 276
278 } // namespace mojo 277 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698