OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Implements the Chrome Extensions WebNavigation API. | 5 // Implements the Chrome Extensions WebNavigation API. |
6 | 6 |
7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 333 } |
334 helpers::DispatchOnCommitted(event_name, web_contents(), render_frame_host, | 334 helpers::DispatchOnCommitted(event_name, web_contents(), render_frame_host, |
335 navigation_state_.GetUrl(render_frame_host), | 335 navigation_state_.GetUrl(render_frame_host), |
336 transition_type); | 336 transition_type); |
337 } | 337 } |
338 | 338 |
339 void WebNavigationTabObserver::DidFailProvisionalLoad( | 339 void WebNavigationTabObserver::DidFailProvisionalLoad( |
340 content::RenderFrameHost* render_frame_host, | 340 content::RenderFrameHost* render_frame_host, |
341 const GURL& validated_url, | 341 const GURL& validated_url, |
342 int error_code, | 342 int error_code, |
343 const base::string16& error_description) { | 343 const base::string16& error_description, |
| 344 bool was_ignored_by_handler) { |
344 DVLOG(2) << "DidFailProvisionalLoad(" | 345 DVLOG(2) << "DidFailProvisionalLoad(" |
345 << "render_frame_host=" << render_frame_host | 346 << "render_frame_host=" << render_frame_host |
346 << ", frame_num=" << render_frame_host->GetRoutingID() | 347 << ", frame_num=" << render_frame_host->GetRoutingID() |
347 << ", url=" << validated_url << ")"; | 348 << ", url=" << validated_url << ")"; |
348 if (navigation_state_.CanSendEvents(render_frame_host)) { | 349 if (navigation_state_.CanSendEvents(render_frame_host)) { |
349 helpers::DispatchOnErrorOccurred( | 350 helpers::DispatchOnErrorOccurred( |
350 web_contents(), | 351 web_contents(), |
351 render_frame_host, | 352 render_frame_host, |
352 navigation_state_.GetUrl(render_frame_host), | 353 navigation_state_.GetUrl(render_frame_host), |
353 error_code); | 354 error_code); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 return; | 408 return; |
408 helpers::DispatchOnCompleted(web_contents(), | 409 helpers::DispatchOnCompleted(web_contents(), |
409 render_frame_host, | 410 render_frame_host, |
410 navigation_state_.GetUrl(render_frame_host)); | 411 navigation_state_.GetUrl(render_frame_host)); |
411 } | 412 } |
412 | 413 |
413 void WebNavigationTabObserver::DidFailLoad( | 414 void WebNavigationTabObserver::DidFailLoad( |
414 content::RenderFrameHost* render_frame_host, | 415 content::RenderFrameHost* render_frame_host, |
415 const GURL& validated_url, | 416 const GURL& validated_url, |
416 int error_code, | 417 int error_code, |
417 const base::string16& error_description) { | 418 const base::string16& error_description, |
| 419 bool was_ignored_by_handler) { |
418 DVLOG(2) << "DidFailLoad(" | 420 DVLOG(2) << "DidFailLoad(" |
419 << "render_frame_host=" << render_frame_host | 421 << "render_frame_host=" << render_frame_host |
420 << ", frame_num=" << render_frame_host->GetRoutingID() | 422 << ", frame_num=" << render_frame_host->GetRoutingID() |
421 << ", url=" << validated_url << ")"; | 423 << ", url=" << validated_url << ")"; |
422 // When showing replacement content, we might get load signals for frames | 424 // When showing replacement content, we might get load signals for frames |
423 // that weren't reguarly loaded. | 425 // that weren't reguarly loaded. |
424 if (!navigation_state_.IsValidFrame(render_frame_host)) | 426 if (!navigation_state_.IsValidFrame(render_frame_host)) |
425 return; | 427 return; |
426 if (navigation_state_.CanSendEvents(render_frame_host)) { | 428 if (navigation_state_.CanSendEvents(render_frame_host)) { |
427 helpers::DispatchOnErrorOccurred( | 429 helpers::DispatchOnErrorOccurred( |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 return g_factory.Pointer(); | 621 return g_factory.Pointer(); |
620 } | 622 } |
621 | 623 |
622 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 624 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { |
623 web_navigation_event_router_.reset(new WebNavigationEventRouter( | 625 web_navigation_event_router_.reset(new WebNavigationEventRouter( |
624 Profile::FromBrowserContext(browser_context_))); | 626 Profile::FromBrowserContext(browser_context_))); |
625 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 627 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
626 } | 628 } |
627 | 629 |
628 } // namespace extensions | 630 } // namespace extensions |
OLD | NEW |