Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/lifetime/application_lifetime.h" | 5 #include "chrome/browser/lifetime/application_lifetime.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/win/metro.h" | 9 #include "base/win/metro.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 // mode or some functionality is not available in either mode and we ask user | 39 // mode or some functionality is not available in either mode and we ask user |
| 40 // to switch mode. | 40 // to switch mode. |
| 41 // Here mode refers to Windows 8 modes such as Metro (also called immersive) | 41 // Here mode refers to Windows 8 modes such as Metro (also called immersive) |
| 42 // and desktop mode (Classic or traditional). | 42 // and desktop mode (Classic or traditional). |
| 43 | 43 |
| 44 // Mode switch based on current mode which is devised from current process. | 44 // Mode switch based on current mode which is devised from current process. |
| 45 void AttemptRestartWithModeSwitch() { | 45 void AttemptRestartWithModeSwitch() { |
| 46 #if defined(USE_AURA) | 46 #if defined(USE_AURA) |
| 47 // This function should be called only from non aura code path. | 47 // This function should be called only from non aura code path. |
| 48 // In aura/ash windows world browser process is always non metro. | 48 // In aura/ash windows world browser process is always non metro. |
| 49 CHECK(false); | 49 NOTREACHED(); |
|
Peter Kasting
2014/03/18 02:43:58
(I verified with shrikant that changing this CHECK
| |
| 50 return; | 50 #else |
| 51 #endif | |
| 52 // The kRestartSwitchMode preference does not exists for Windows 7 and older | 51 // The kRestartSwitchMode preference does not exists for Windows 7 and older |
| 53 // operating systems so there is no need for OS version check. | 52 // operating systems so there is no need for OS version check. |
| 54 PrefService* prefs = g_browser_process->local_state(); | 53 PrefService* prefs = g_browser_process->local_state(); |
| 55 if (base::win::IsMetroProcess()) { | 54 if (base::win::IsMetroProcess()) { |
| 56 prefs->SetString(prefs::kRelaunchMode, | 55 prefs->SetString(prefs::kRelaunchMode, |
| 57 upgrade_util::kRelaunchModeDesktop); | 56 upgrade_util::kRelaunchModeDesktop); |
| 58 } else { | 57 } else { |
| 59 prefs->SetString(prefs::kRelaunchMode, | 58 prefs->SetString(prefs::kRelaunchMode, |
| 60 upgrade_util::kRelaunchModeMetro); | 59 upgrade_util::kRelaunchModeMetro); |
| 61 } | 60 } |
| 62 AttemptRestart(); | 61 AttemptRestart(); |
| 62 #endif | |
| 63 } | 63 } |
| 64 | 64 |
| 65 #if defined(USE_AURA) | 65 #if defined(USE_AURA) |
| 66 void ActivateDesktopHelper(AshExecutionStatus ash_execution_status) { | 66 void ActivateDesktopHelper(AshExecutionStatus ash_execution_status) { |
| 67 scoped_ptr<base::Environment> env(base::Environment::Create()); | 67 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 68 std::string version_str; | 68 std::string version_str; |
| 69 | 69 |
| 70 // Get the version variable and remove it from the environment. | 70 // Get the version variable and remove it from the environment. |
| 71 if (!env->GetVar(chrome::kChromeVersionEnvVar, &version_str)) | 71 if (!env->GetVar(chrome::kChromeVersionEnvVar, &version_str)) |
| 72 version_str.clear(); | 72 version_str.clear(); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 101 } | 101 } |
| 102 | 102 |
| 103 void AttemptRestartToMetroMode() { | 103 void AttemptRestartToMetroMode() { |
| 104 PrefService* prefs = g_browser_process->local_state(); | 104 PrefService* prefs = g_browser_process->local_state(); |
| 105 prefs->SetString(prefs::kRelaunchMode, | 105 prefs->SetString(prefs::kRelaunchMode, |
| 106 upgrade_util::kRelaunchModeMetro); | 106 upgrade_util::kRelaunchModeMetro); |
| 107 AttemptRestart(); | 107 AttemptRestart(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace chrome | 110 } // namespace chrome |
| OLD | NEW |