Chromium Code Reviews| Index: chrome/browser/google/chrome_google_url_tracker_client.cc |
| diff --git a/chrome/browser/google/chrome_google_url_tracker_client.cc b/chrome/browser/google/chrome_google_url_tracker_client.cc |
| index 50d054bdd21eb22001fe66fc94f768e24cd5f4a6..cacbfe041ba93bdbbda6ffa6065cf11d8d74679d 100644 |
| --- a/chrome/browser/google/chrome_google_url_tracker_client.cc |
| +++ b/chrome/browser/google/chrome_google_url_tracker_client.cc |
| @@ -6,6 +6,7 @@ |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/google/google_url_tracker.h" |
| +#include "chrome/browser/google/google_url_tracker_navigation_helper_impl.h" |
| #include "chrome/browser/infobars/infobar_service.h" |
| #include "content/public/browser/navigation_controller.h" |
| #include "content/public/browser/navigation_entry.h" |
| @@ -18,19 +19,24 @@ ChromeGoogleURLTrackerClient::ChromeGoogleURLTrackerClient() { |
| ChromeGoogleURLTrackerClient::~ChromeGoogleURLTrackerClient() { |
| } |
| -void ChromeGoogleURLTrackerClient::SetListeningForNavigationStart( |
| - bool listen) { |
| +void ChromeGoogleURLTrackerClient::SetListeningForNavigationStart(bool listen) { |
| if (listen) { |
| - registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| + registrar_.Add( |
| + this, |
| + content::NOTIFICATION_NAV_ENTRY_PENDING, |
| content::NotificationService::AllBrowserContextsAndSources()); |
| } else { |
| - registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| + registrar_.Remove( |
| + this, |
| + content::NOTIFICATION_NAV_ENTRY_PENDING, |
| content::NotificationService::AllBrowserContextsAndSources()); |
| } |
| } |
| bool ChromeGoogleURLTrackerClient::IsListeningForNavigationStart() { |
| - return registrar_.IsRegistered(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| + return registrar_.IsRegistered( |
| + this, |
| + content::NOTIFICATION_NAV_ENTRY_PENDING, |
| content::NotificationService::AllBrowserContextsAndSources()); |
| } |
| @@ -41,14 +47,17 @@ void ChromeGoogleURLTrackerClient::Observe( |
| DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_PENDING, type); |
| content::NavigationController* controller = |
| content::Source<content::NavigationController>(source).ptr(); |
| + GoogleURLTrackerNavigationHelperImpl* nav_helper = |
| + GoogleURLTrackerNavigationHelperImpl::FromWebContents( |
| + controller->GetWebContents()); |
| InfoBarService* infobar_service = |
| InfoBarService::FromWebContents(controller->GetWebContents()); |
| // Because we're listening to all sources, there may be no |
| - // InfoBarService for some notifications, e.g. navigations in |
| + // InfoBarService/NavigationHelper for some notifications, e.g. navigations in |
|
Peter Kasting
2014/05/15 21:29:52
Super-tiny nit: Reverse order of infobar service/n
blundell
2014/05/16 11:54:18
Irrelevant now.
On 2014/05/15 21:29:52, Peter Kas
|
| // bubbles/balloons etc. |
| - if (infobar_service) { |
| + if (infobar_service && nav_helper) { |
| google_url_tracker()->OnNavigationPending( |
| - controller, |
| + nav_helper, |
| infobar_service, |
| controller->GetPendingEntry()->GetUniqueID()); |
| } |