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 #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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 blink::WebNavigationPolicy HTMLDocument::decidePolicyForNavigation( | 233 blink::WebNavigationPolicy HTMLDocument::decidePolicyForNavigation( |
234 blink::WebLocalFrame* frame, | 234 blink::WebLocalFrame* frame, |
235 blink::WebDataSource::ExtraData* data, | 235 blink::WebDataSource::ExtraData* data, |
236 const blink::WebURLRequest& request, | 236 const blink::WebURLRequest& request, |
237 blink::WebNavigationType nav_type, | 237 blink::WebNavigationType nav_type, |
238 blink::WebNavigationPolicy default_policy, | 238 blink::WebNavigationPolicy default_policy, |
239 bool is_redirect) { | 239 bool is_redirect) { |
240 if (CanNavigateLocally(frame, request)) | 240 if (CanNavigateLocally(frame, request)) |
241 return default_policy; | 241 return default_policy; |
242 | 242 |
243 navigator_host_->RequestNavigate( | 243 if (embedder_service_provider_.get()) |
DaveMoore
2014/12/19 23:56:13
nit: There should be braces around this.
Aaron Boodman
2014/12/20 17:46:07
Modify LazyInterfacePtr so that you can do navigat
dtapuska
2015/01/05 18:41:24
Done.
| |
244 WebNavigationPolicyToNavigationTarget(default_policy), | 244 navigator_host_->RequestNavigate( |
245 mojo::URLRequest::From(request).Pass()); | 245 WebNavigationPolicyToNavigationTarget(default_policy), |
246 mojo::URLRequest::From(request).Pass()); | |
246 | 247 |
247 return blink::WebNavigationPolicyIgnore; | 248 return blink::WebNavigationPolicyIgnore; |
248 } | 249 } |
249 | 250 |
250 void HTMLDocument::didAddMessageToConsole( | 251 void HTMLDocument::didAddMessageToConsole( |
251 const blink::WebConsoleMessage& message, | 252 const blink::WebConsoleMessage& message, |
252 const blink::WebString& source_name, | 253 const blink::WebString& source_name, |
253 unsigned source_line, | 254 unsigned source_line, |
254 const blink::WebString& stack_trace) { | 255 const blink::WebString& stack_trace) { |
255 } | 256 } |
256 | 257 |
257 void HTMLDocument::didNavigateWithinPage( | 258 void HTMLDocument::didNavigateWithinPage( |
258 blink::WebLocalFrame* frame, | 259 blink::WebLocalFrame* frame, |
259 const blink::WebHistoryItem& history_item, | 260 const blink::WebHistoryItem& history_item, |
260 blink::WebHistoryCommitType commit_type) { | 261 blink::WebHistoryCommitType commit_type) { |
261 navigator_host_->DidNavigateLocally(history_item.urlString().utf8()); | 262 if (embedder_service_provider_.get()) |
263 navigator_host_->DidNavigateLocally(history_item.urlString().utf8()); | |
262 } | 264 } |
263 | 265 |
264 void HTMLDocument::OnViewBoundsChanged(View* view, | 266 void HTMLDocument::OnViewBoundsChanged(View* view, |
265 const Rect& old_bounds, | 267 const Rect& old_bounds, |
266 const Rect& new_bounds) { | 268 const Rect& new_bounds) { |
267 DCHECK_EQ(view, root_); | 269 DCHECK_EQ(view, root_); |
268 web_view_->resize( | 270 web_view_->resize( |
269 blink::WebSize(view->bounds().width, view->bounds().height)); | 271 blink::WebSize(view->bounds().width, view->bounds().height)); |
270 } | 272 } |
271 | 273 |
272 void HTMLDocument::OnViewDestroyed(View* view) { | 274 void HTMLDocument::OnViewDestroyed(View* view) { |
273 DCHECK_EQ(view, root_); | 275 DCHECK_EQ(view, root_); |
274 root_ = nullptr; | 276 root_ = nullptr; |
275 } | 277 } |
276 | 278 |
277 void HTMLDocument::OnViewInputEvent(View* view, const mojo::EventPtr& event) { | 279 void HTMLDocument::OnViewInputEvent(View* view, const mojo::EventPtr& event) { |
278 scoped_ptr<blink::WebInputEvent> web_event = | 280 scoped_ptr<blink::WebInputEvent> web_event = |
279 event.To<scoped_ptr<blink::WebInputEvent>>(); | 281 event.To<scoped_ptr<blink::WebInputEvent>>(); |
280 if (web_event) | 282 if (web_event) |
281 web_view_->handleInputEvent(*web_event); | 283 web_view_->handleInputEvent(*web_event); |
282 } | 284 } |
283 | 285 |
284 } // namespace html_viewer | 286 } // namespace html_viewer |
OLD | NEW |