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

Unified Diff: chrome/browser/ui/apps/chrome_shell_window_delegate.cc

Issue 23847004: "Redirecting URLs to Packaged Apps" implementation: revised (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the comment in app_window_contents.cc Created 7 years, 3 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/apps/chrome_shell_window_delegate.cc
diff --git a/chrome/browser/ui/apps/chrome_shell_window_delegate.cc b/chrome/browser/ui/apps/chrome_shell_window_delegate.cc
index fe1e234a5ecb4acabeee949146ead63c7728929c..c7b4fe6f047ad92b801fa26b7fda2a12029650b3 100644
--- a/chrome/browser/ui/apps/chrome_shell_window_delegate.cc
+++ b/chrome/browser/ui/apps/chrome_shell_window_delegate.cc
@@ -4,11 +4,14 @@
#include "chrome/browser/ui/apps/chrome_shell_window_delegate.h"
+#include "apps/url_redirector.h"
+#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/favicon/favicon_tab_helper.h"
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/platform_util.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -18,6 +21,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_ASH)
#include "ash/launcher/launcher_types.h"
@@ -62,6 +66,19 @@ void ChromeShellWindowDelegate::DisableExternalOpenForTesting() {
void ChromeShellWindowDelegate::InitWebContents(
content::WebContents* web_contents) {
+ // TODO(sergeygs): Remove the 'if' and update includes once url_handlers are
+ // moved out of experimental.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ extensions::switches::kEnableExperimentalExtensionApis)) {
+ // We don't want to ever send visited URLs to apps in incognito.
+ // Technically, apps are not supported in incognito, but explicitly check
+ // for that. See b/240879, which tracks incognito support for v2 apps.
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ if (!profile->IsOffTheRecord())
+ apps::UrlRedirector::CreateForWebContents(web_contents);
+ }
+
FaviconTabHelper::CreateForWebContents(web_contents);
#if defined(ENABLE_PRINTING)

Powered by Google App Engine
This is Rietveld 408576698