| Index: chrome/browser/ui/browser_navigator.cc
|
| diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
|
| index 02a5e8fbd261039c46b400d647a841450a9f2fe3..4699ef54c1b80f00b5f7e5f1a61760e8a246b58e 100644
|
| --- a/chrome/browser/ui/browser_navigator.cc
|
| +++ b/chrome/browser/ui/browser_navigator.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include <algorithm>
|
|
|
| +#include "apps/url_redirector.h"
|
| #include "base/command_line.h"
|
| #include "base/prefs/pref_service.h"
|
| #include "base/strings/stringprintf.h"
|
| @@ -13,6 +14,7 @@
|
| #include "chrome/browser/browser_about_handler.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| +#include "chrome/browser/extensions/extension_system.h"
|
| #include "chrome/browser/extensions/tab_helper.h"
|
| #include "chrome/browser/google/google_url_tracker.h"
|
| #include "chrome/browser/prefs/incognito_mode_prefs.h"
|
| @@ -39,6 +41,7 @@
|
| #include "content/public/browser/render_view_host.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/browser/web_contents_view.h"
|
| +#include "extensions/common/switches.h"
|
|
|
| #if defined(USE_AURA)
|
| #include "ui/aura/window.h"
|
| @@ -475,9 +478,30 @@ 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 the error page: we still
|
| + // have to display it.
|
| + } else {
|
| + // TODO(sergeygs): Remove this and update includes once url_handlers are
|
| + // moved out of experimental.
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| + extensions::switches::kEnableExperimentalExtensionApis)) {
|
| + if (apps::UrlRedirector::MaybeLaunchAppWithUrl(
|
| + params->initiating_profile,
|
| + 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 &&
|
|
|