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

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

Issue 11411286: Decouple IsMetroProcess() calls, introducing IsSingleWindowMetroMode(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: keep base/win/metro.h in omnibox_view_win.cc for IsTSFAwareRequired() Created 8 years 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 | « chrome/browser/ui/browser_commands.cc ('k') | chrome/browser/ui/extensions/application_launch.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_win.cc
diff --git a/chrome/browser/ui/browser_win.cc b/chrome/browser/ui/browser_win.cc
index f123e247adb0b34a3d8741abab11e4f5503c3fc2..d966bd272553149946042b55064d74387861a060 100644
--- a/chrome/browser/ui/browser_win.cc
+++ b/chrome/browser/ui/browser_win.cc
@@ -13,32 +13,37 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
+#include "win8/util/win8_util.h"
namespace {
-void NewMetroWindow(Browser* source_browser, Profile* profile) {
- typedef void (*FlipFrameWindows)();
-
- static FlipFrameWindows flip_window_fn = reinterpret_cast<FlipFrameWindows>(
- ::GetProcAddress(base::win::GetMetroModule(), "FlipFrameWindows"));
- DCHECK(flip_window_fn);
-
+void NewWindowMaybeMetro(Browser* source_browser, Profile* profile) {
chrome::HostDesktopType host_desktop_type =
source_browser->host_desktop_type();
- Browser* browser =
- browser::FindTabbedBrowser(profile, false, host_desktop_type);
+ if (win8::IsSingleWindowMetroMode()) {
+ typedef void (*FlipFrameWindows)();
- if (!browser) {
- chrome::OpenEmptyWindow(profile);
- return;
- }
+ static FlipFrameWindows flip_window_fn = reinterpret_cast<FlipFrameWindows>(
+ ::GetProcAddress(base::win::GetMetroModule(), "FlipFrameWindows"));
+ DCHECK(flip_window_fn);
+
+ Browser* browser =
+ browser::FindTabbedBrowser(profile, false, host_desktop_type);
- chrome::NewTab(browser);
+ if (!browser) {
+ chrome::OpenEmptyWindow(profile);
+ return;
+ }
- if (browser != source_browser) {
- // Tell the metro_driver to flip our window. This causes the current
- // browser window to be hidden and the next window to be shown.
- flip_window_fn();
+ chrome::NewTab(browser);
+
+ if (browser != source_browser) {
+ // Tell the metro_driver to flip our window. This causes the current
+ // browser window to be hidden and the next window to be shown.
+ flip_window_fn();
+ }
+ } else {
+ NewEmptyWindow(profile, host_desktop_type);
}
}
@@ -47,25 +52,11 @@ void NewMetroWindow(Browser* source_browser, Profile* profile) {
namespace chrome {
void NewWindow(Browser* browser) {
-#if !defined(USE_AURA)
- if (base::win::IsMetroProcess()) {
- NewMetroWindow(browser, browser->profile()->GetOriginalProfile());
- return;
- }
-#endif
- NewEmptyWindow(browser->profile()->GetOriginalProfile(),
- browser->host_desktop_type());
+ NewWindowMaybeMetro(browser, browser->profile()->GetOriginalProfile());
}
void NewIncognitoWindow(Browser* browser) {
-#if !defined(USE_AURA)
- if (base::win::IsMetroProcess()) {
- NewMetroWindow(browser, browser->profile()->GetOffTheRecordProfile());
- return;
- }
-#endif
- NewEmptyWindow(browser->profile()->GetOffTheRecordProfile(),
- browser->host_desktop_type());
+ NewWindowMaybeMetro(browser, browser->profile()->GetOffTheRecordProfile());
}
} // namespace chrome
« no previous file with comments | « chrome/browser/ui/browser_commands.cc ('k') | chrome/browser/ui/extensions/application_launch.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698