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) |