Chromium Code Reviews| Index: chrome/browser/ui/omnibox/omnibox_navigation_observer.cc |
| diff --git a/chrome/browser/ui/omnibox/omnibox_navigation_observer.cc b/chrome/browser/ui/omnibox/omnibox_navigation_observer.cc |
| index 040dbdefa2cfcd57bace95ae91c9f25a2bc92c59..b8afea78c4aa52205699a0c5acf358f6c5a4e990 100644 |
| --- a/chrome/browser/ui/omnibox/omnibox_navigation_observer.cc |
| +++ b/chrome/browser/ui/omnibox/omnibox_navigation_observer.cc |
| @@ -86,15 +86,27 @@ void OmniboxNavigationObserver::Observe( |
| const content::NotificationSource& source, |
| const content::NotificationDetails& details) { |
| DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_PENDING, type); |
| - registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| - content::NotificationService::AllSources()); |
| + |
| + // It's possible for an attempted omnibox navigation to cause the extensions |
| + // system to synchronously navigate an extension background page. Not only is |
| + // this navigation not the one we want to observe, the associated WebContents |
| + // is invisible and has no InfoBarService, so trying to show an infobar in it |
| + // later will crash. Just ignore this navigation and keep listening. |
| content::NavigationController* controller = |
| content::Source<content::NavigationController>(source).ptr(); |
| + content::WebContents* web_contents = controller->GetWebContents(); |
| + if (!InfoBarService::FromWebContents(web_contents)) |
|
Vitaly Buka (NO REVIEWS)
2015/01/22 21:59:09
Using InfoBarservice for unwanted web-contents loo
Peter Kasting
2015/01/22 22:02:26
There's no theoretical reason why an extension bac
|
| + return; |
| + |
| + CHECK_EQ(match_.destination_url, |
| + content::Details<content::NavigationEntry>(details)->GetURL()); |
| + registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| + content::NotificationService::AllSources()); |
| if (fetcher_) { |
| fetcher_->SetRequestContext( |
| controller->GetBrowserContext()->GetRequestContext()); |
| } |
| - WebContentsObserver::Observe(controller->GetWebContents()); |
| + WebContentsObserver::Observe(web_contents); |
| // DidStartNavigationToPendingEntry() will be called for this load as well. |
| } |