Index: chrome/browser/ui/browser_navigator.cc |
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc |
index fb73fe7d6191e54d1d4abd8e98c1bbc8ab3a86c7..c32b26cafe0c242bf63990db4dc380ed055e6aa4 100644 |
--- a/chrome/browser/ui/browser_navigator.cc |
+++ b/chrome/browser/ui/browser_navigator.cc |
@@ -12,6 +12,8 @@ |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/browser_about_handler.h" |
#include "chrome/browser/extensions/extension_service.h" |
+#include "chrome/browser/extensions/extension_system.h" |
+#include "chrome/browser/extensions/platform_app_redirector.h" |
#include "chrome/browser/extensions/tab_helper.h" |
#include "chrome/browser/google/google_url_tracker.h" |
#include "chrome/browser/prefs/incognito_mode_prefs.h" |
@@ -457,9 +459,25 @@ void Navigate(NavigateParams* params) { |
if (!AdjustNavigateParamsForURL(params)) |
return; |
- ExtensionService* service = params->initiating_profile->GetExtensionService(); |
- if (service) |
- service->ShouldBlockUrlInBrowserTab(¶ms->url); |
+ // See if the extension service wants to block this navigation or some |
+ // platform app wants to intercept it. |
+ extensions::ExtensionSystem* system = |
+ extensions::ExtensionSystem::Get(params->initiating_profile); |
+ if (system) { |
+ ExtensionService* service = system->extension_service(); |
+ if (service && service->ShouldBlockUrlInBrowserTab(¶ms->url)) { |
+ // Proceed. The call just rewrites the URL to an error page: we still |
+ // have to display it. |
+ } else { |
+ extensions::PlatformAppRedirector* redirector = |
+ system->platform_app_redirector(); |
+ if (redirector && redirector->MaybeLaunchPlatformAppWithUrl( |
+ params->url, params->referrer.url)) { |
+ // An app has intercepted the navigation: cancel it here. |
+ return; |
+ } |
+ } |
+ } |
// The browser window may want to adjust the disposition. |
if (params->disposition == NEW_POPUP && |