Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3050)

Unified Diff: chrome/browser/ui/browser_navigator.cc

Issue 22944002: Implementation of the "Redirect URLs to Packaged Apps" feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review comments + lint errors Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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(&params->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(&params->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 &&

Powered by Google App Engine
This is Rietveld 408576698