This source file includes following definitions.
- NewWindowMaybeMetro
- NewWindow
- NewIncognitoWindow
- SetMetroSnapMode
#include "chrome/browser/ui/browser.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/metro.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
#include "win8/util/win8_util.h"
namespace {
void NewWindowMaybeMetro(Browser* source_browser, Profile* profile) {
chrome::HostDesktopType host_desktop_type =
source_browser->host_desktop_type();
if (win8::IsSingleWindowMetroMode()) {
typedef void (*FlipFrameWindows)();
static FlipFrameWindows flip_window_fn = reinterpret_cast<FlipFrameWindows>(
::GetProcAddress(base::win::GetMetroModule(), "FlipFrameWindows"));
DCHECK(flip_window_fn);
Browser* browser = chrome::FindTabbedBrowser(profile, false,
host_desktop_type);
if (!browser) {
chrome::OpenEmptyWindow(profile, host_desktop_type);
return;
}
chrome::NewTab(browser);
if (browser != source_browser) {
flip_window_fn();
}
} else {
NewEmptyWindow(profile, host_desktop_type);
}
}
}
namespace chrome {
void NewWindow(Browser* browser) {
NewWindowMaybeMetro(browser, browser->profile()->GetOriginalProfile());
}
void NewIncognitoWindow(Browser* browser) {
NewWindowMaybeMetro(browser, browser->profile()->GetOffTheRecordProfile());
}
}
void Browser::SetMetroSnapMode(bool enable) {
fullscreen_controller_->SetMetroSnapMode(enable);
}