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

Unified Diff: chrome/browser/ui/startup/startup_browser_creator_impl.cc

Issue 11137031: If chrome in desktop mode on Windows 8 defers to Windows 8 metro chrome, then we only want to creat… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/startup/startup_browser_creator_impl.cc
===================================================================
--- chrome/browser/ui/startup/startup_browser_creator_impl.cc (revision 161954)
+++ chrome/browser/ui/startup/startup_browser_creator_impl.cc (working copy)
@@ -111,6 +111,7 @@
#endif
#if defined(OS_WIN)
+#include "base/win/metro.h"
#include "base/win/windows_version.h"
#endif
@@ -298,6 +299,39 @@
DISALLOW_COPY_AND_ASSIGN(WebContentsCloseObserver);
};
+// Platform specific helper to activate an existing Browser instance for the
+// profile passed in. Defaults to returning false. For Windows 8 in metro mode
+// we activate an existing browser if the startup urls contains only the new
+// tab page.
+#if defined(OS_WIN) && !defined(USE_AURA)
+bool PlatformActivateBrowserForProfile(
+ Profile* profile, const std::vector<GURL>& startup_urls) {
+ if (!base::win::IsMetroProcess())
+ return false;
+
+ // We activate an existing browser window if we are opening just the new tab
+ // page in metro mode.
+ if (startup_urls.size() > 1)
+ return false;
+
+ if (startup_urls[0] != GURL(chrome::kChromeUINewTabURL))
+ return false;
+
+ Browser* browser = browser::FindBrowserWithProfile(
+ profile, chrome::HOST_DESKTOP_TYPE_NATIVE);
+
+ if (!browser)
+ return false;
+
+ browser->window()->Show();
+}
+#else
+bool PlatformActivateBrowserForProfile(
+ Profile* profile, const std::vector<GURL>& startup_urls) {
+ return false;
+}
+#endif
+
} // namespace
StartupBrowserCreatorImpl::StartupBrowserCreatorImpl(
@@ -617,12 +651,13 @@
std::vector<GURL> adjust_urls = urls_to_open;
if (adjust_urls.empty()) {
AddStartupURLs(&adjust_urls);
+ if (PlatformActivateBrowserForProfile(profile_, adjust_urls))
sky 2012/10/16 15:46:30 Name this OpenStartupURLsInExistingBrowser and mov
ananta 2012/10/16 18:44:49 The function does not open the startup urls. It ac
sky 2012/10/16 21:11:08 Logically this method is called during startup to
ananta 2012/10/16 21:17:44 Fair enough. Done.
+ return;
} else if (!command_line_.HasSwitch(switches::kOpenInNewWindow)) {
// Always open a list of urls in a window on the native desktop.
browser = browser::FindBrowserWithProfile(profile_,
chrome::HOST_DESKTOP_TYPE_NATIVE);
}
-
// This will launch a browser; prevent session restore.
in_synchronous_profile_launch = true;
browser = OpenURLsInBrowser(browser, process_startup, adjust_urls);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698