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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h" 5 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h"
6 6
7 #include "apps/url_redirector.h"
8 #include "base/command_line.h"
7 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/favicon/favicon_tab_helper.h" 10 #include "chrome/browser/favicon/favicon_tab_helper.h"
9 #include "chrome/browser/file_select_helper.h" 11 #include "chrome/browser/file_select_helper.h"
10 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 12 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
11 #include "chrome/browser/platform_util.h" 13 #include "chrome/browser/platform_util.h"
14 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_dialogs.h" 16 #include "chrome/browser/ui/browser_dialogs.h"
14 #include "chrome/browser/ui/browser_finder.h" 17 #include "chrome/browser/ui/browser_finder.h"
15 #include "chrome/browser/ui/browser_tabstrip.h" 18 #include "chrome/browser/ui/browser_tabstrip.h"
16 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
17 #include "chrome/common/render_messages.h" 20 #include "chrome/common/render_messages.h"
18 #include "content/public/browser/render_view_host.h" 21 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
20 #include "content/public/browser/web_contents_view.h" 23 #include "content/public/browser/web_contents_view.h"
24 #include "extensions/common/switches.h"
21 25
22 #if defined(USE_ASH) 26 #if defined(USE_ASH)
23 #include "ash/launcher/launcher_types.h" 27 #include "ash/launcher/launcher_types.h"
24 #endif 28 #endif
25 29
26 #if defined(ENABLE_PRINTING) 30 #if defined(ENABLE_PRINTING)
27 #if defined(ENABLE_FULL_PRINTING) 31 #if defined(ENABLE_FULL_PRINTING)
28 #include "chrome/browser/printing/print_preview_message_handler.h" 32 #include "chrome/browser/printing/print_preview_message_handler.h"
29 #include "chrome/browser/printing/print_view_manager.h" 33 #include "chrome/browser/printing/print_view_manager.h"
30 #else 34 #else
(...skipping 24 matching lines...) Expand all
55 ChromeShellWindowDelegate::ChromeShellWindowDelegate() {} 59 ChromeShellWindowDelegate::ChromeShellWindowDelegate() {}
56 60
57 ChromeShellWindowDelegate::~ChromeShellWindowDelegate() {} 61 ChromeShellWindowDelegate::~ChromeShellWindowDelegate() {}
58 62
59 void ChromeShellWindowDelegate::DisableExternalOpenForTesting() { 63 void ChromeShellWindowDelegate::DisableExternalOpenForTesting() {
60 disable_external_open_for_testing_ = true; 64 disable_external_open_for_testing_ = true;
61 } 65 }
62 66
63 void ChromeShellWindowDelegate::InitWebContents( 67 void ChromeShellWindowDelegate::InitWebContents(
64 content::WebContents* web_contents) { 68 content::WebContents* web_contents) {
69 // TODO(sergeygs): Remove the 'if' and update includes once url_handlers are
70 // moved out of experimental.
71 if (CommandLine::ForCurrentProcess()->HasSwitch(
72 extensions::switches::kEnableExperimentalExtensionApis)) {
73 // We don't want to ever send visited URLs to apps in incognito.
74 // Technically, apps are not supported in incognito, but explicitly check
75 // for that. See b/240879, which tracks incognito support for v2 apps.
76 Profile* profile =
77 Profile::FromBrowserContext(web_contents->GetBrowserContext());
78 if (!profile->IsOffTheRecord())
79 apps::UrlRedirector::CreateForWebContents(web_contents);
80 }
81
65 FaviconTabHelper::CreateForWebContents(web_contents); 82 FaviconTabHelper::CreateForWebContents(web_contents);
66 83
67 #if defined(ENABLE_PRINTING) 84 #if defined(ENABLE_PRINTING)
68 #if defined(ENABLE_FULL_PRINTING) 85 #if defined(ENABLE_FULL_PRINTING)
69 printing::PrintViewManager::CreateForWebContents(web_contents); 86 printing::PrintViewManager::CreateForWebContents(web_contents);
70 printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents); 87 printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents);
71 #else 88 #else
72 printing::PrintViewManagerBasic::CreateForWebContents(web_contents); 89 printing::PrintViewManagerBasic::CreateForWebContents(web_contents);
73 #endif // defined(ENABLE_FULL_PRINTING) 90 #endif // defined(ENABLE_FULL_PRINTING)
74 #endif // defined(ENABLE_PRINTING) 91 #endif // defined(ENABLE_PRINTING)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (host) { 173 if (host) {
157 host->Send(new ChromeViewMsg_SetVisuallyDeemphasized( 174 host->Send(new ChromeViewMsg_SetVisuallyDeemphasized(
158 host->GetRoutingID(), blocked)); 175 host->GetRoutingID(), blocked));
159 } 176 }
160 } 177 }
161 178
162 bool ChromeShellWindowDelegate::IsWebContentsVisible( 179 bool ChromeShellWindowDelegate::IsWebContentsVisible(
163 content::WebContents* web_contents) { 180 content::WebContents* web_contents) {
164 return platform_util::IsVisible(web_contents->GetView()->GetNativeView()); 181 return platform_util::IsVisible(web_contents->GetView()->GetNativeView());
165 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698