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

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

Issue 790793007: Mojo HTML viewer crash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 months 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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 blink::WebNavigationPolicy HTMLDocument::decidePolicyForNavigation( 236 blink::WebNavigationPolicy HTMLDocument::decidePolicyForNavigation(
237 blink::WebLocalFrame* frame, 237 blink::WebLocalFrame* frame,
238 blink::WebDataSource::ExtraData* data, 238 blink::WebDataSource::ExtraData* data,
239 const blink::WebURLRequest& request, 239 const blink::WebURLRequest& request,
240 blink::WebNavigationType nav_type, 240 blink::WebNavigationType nav_type,
241 blink::WebNavigationPolicy default_policy, 241 blink::WebNavigationPolicy default_policy,
242 bool is_redirect) { 242 bool is_redirect) {
243 if (CanNavigateLocally(frame, request)) 243 if (CanNavigateLocally(frame, request))
244 return default_policy; 244 return default_policy;
245 245
246 navigator_host_->RequestNavigate( 246 if (navigator_host_.get()) {
247 WebNavigationPolicyToNavigationTarget(default_policy), 247 navigator_host_->RequestNavigate(
248 mojo::URLRequest::From(request).Pass()); 248 WebNavigationPolicyToNavigationTarget(default_policy),
249 mojo::URLRequest::From(request).Pass());
250 }
249 251
250 return blink::WebNavigationPolicyIgnore; 252 return blink::WebNavigationPolicyIgnore;
251 } 253 }
252 254
253 void HTMLDocument::didAddMessageToConsole( 255 void HTMLDocument::didAddMessageToConsole(
254 const blink::WebConsoleMessage& message, 256 const blink::WebConsoleMessage& message,
255 const blink::WebString& source_name, 257 const blink::WebString& source_name,
256 unsigned source_line, 258 unsigned source_line,
257 const blink::WebString& stack_trace) { 259 const blink::WebString& stack_trace) {
258 } 260 }
259 261
260 void HTMLDocument::didNavigateWithinPage( 262 void HTMLDocument::didNavigateWithinPage(
261 blink::WebLocalFrame* frame, 263 blink::WebLocalFrame* frame,
262 const blink::WebHistoryItem& history_item, 264 const blink::WebHistoryItem& history_item,
263 blink::WebHistoryCommitType commit_type) { 265 blink::WebHistoryCommitType commit_type) {
264 navigator_host_->DidNavigateLocally(history_item.urlString().utf8()); 266 if (navigator_host_.get())
267 navigator_host_->DidNavigateLocally(history_item.urlString().utf8());
265 } 268 }
266 269
267 blink::WebEncryptedMediaClient* HTMLDocument::encryptedMediaClient() { 270 blink::WebEncryptedMediaClient* HTMLDocument::encryptedMediaClient() {
268 if (!web_encrypted_media_client_) { 271 if (!web_encrypted_media_client_) {
269 web_encrypted_media_client_ = new media::WebEncryptedMediaClientImpl( 272 web_encrypted_media_client_ = new media::WebEncryptedMediaClientImpl(
270 make_scoped_ptr(new media::DefaultCdmFactory())); 273 make_scoped_ptr(new media::DefaultCdmFactory()));
271 } 274 }
272 return web_encrypted_media_client_; 275 return web_encrypted_media_client_;
273 } 276 }
274 277
(...skipping 11 matching lines...) Expand all
286 } 289 }
287 290
288 void HTMLDocument::OnViewInputEvent(View* view, const mojo::EventPtr& event) { 291 void HTMLDocument::OnViewInputEvent(View* view, const mojo::EventPtr& event) {
289 scoped_ptr<blink::WebInputEvent> web_event = 292 scoped_ptr<blink::WebInputEvent> web_event =
290 event.To<scoped_ptr<blink::WebInputEvent>>(); 293 event.To<scoped_ptr<blink::WebInputEvent>>();
291 if (web_event) 294 if (web_event)
292 web_view_->handleInputEvent(*web_event); 295 web_view_->handleInputEvent(*web_event);
293 } 296 }
294 297
295 } // namespace html_viewer 298 } // namespace html_viewer
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