This source file includes following definitions.
- HandleAppExitingForPlatform
- AttemptRestartWithModeSwitch
- ActivateDesktopHelper
- AttemptRestartToDesktopMode
- AttemptRestartToMetroMode
#include "chrome/browser/lifetime/application_lifetime.h"
#include "base/bind.h"
#include "base/prefs/pref_service.h"
#include "base/win/metro.h"
#include "base/win/windows_version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/first_run/upgrade_util.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/pref_names.h"
#include "ui/views/widget/widget.h"
#if defined(USE_AURA)
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "chrome/browser/metro_utils/metro_chrome_win.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/installer/util/util_constants.h"
#include "content/public/browser/web_contents.h"
#include "ui/aura/remote_window_tree_host_win.h"
#endif
namespace chrome {
#if !defined(USE_AURA)
void HandleAppExitingForPlatform() {
views::Widget::CloseAllSecondaryWidgets();
}
#endif
void AttemptRestartWithModeSwitch() {
#if defined(USE_AURA)
NOTREACHED();
#else
PrefService* prefs = g_browser_process->local_state();
if (base::win::IsMetroProcess()) {
prefs->SetString(prefs::kRelaunchMode,
upgrade_util::kRelaunchModeDesktop);
} else {
prefs->SetString(prefs::kRelaunchMode,
upgrade_util::kRelaunchModeMetro);
}
AttemptRestart();
#endif
}
#if defined(USE_AURA)
void ActivateDesktopHelper(AshExecutionStatus ash_execution_status) {
scoped_ptr<base::Environment> env(base::Environment::Create());
std::string version_str;
if (!env->GetVar(chrome::kChromeVersionEnvVar, &version_str))
version_str.clear();
base::FilePath exe_path;
if (!PathService::Get(base::FILE_EXE, &exe_path))
return;
base::FilePath path(exe_path.DirName());
if (!version_str.empty())
path = path.AppendASCII(version_str);
path = path.Append(installer::kDelegateExecuteExe);
aura::HandleActivateDesktop(path, ash_execution_status == ASH_TERMINATE);
}
#endif
void AttemptRestartToDesktopMode() {
PrefService* prefs = g_browser_process->local_state();
prefs->SetString(prefs::kRelaunchMode,
upgrade_util::kRelaunchModeDesktop);
AttemptRestart();
}
void AttemptRestartToMetroMode() {
PrefService* prefs = g_browser_process->local_state();
prefs->SetString(prefs::kRelaunchMode,
upgrade_util::kRelaunchModeMetro);
AttemptRestart();
}
}