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 "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 #if defined(USE_AURA) | 64 #if defined(USE_AURA) |
65 void ActivateDesktopHelperReply() { | 65 void ActivateDesktopHelperReply() { |
66 AttemptRestart(); | 66 AttemptRestart(); |
67 } | 67 } |
68 | 68 |
69 void ActivateDesktopHelper() { | 69 void ActivateDesktopHelper() { |
70 scoped_ptr<base::Environment> env(base::Environment::Create()); | 70 scoped_ptr<base::Environment> env(base::Environment::Create()); |
71 std::string version_str; | 71 std::string version_str; |
72 | 72 |
73 // Get the version variable and remove it from the environment. | 73 // Get the version variable and remove it from the environment. |
74 if (env->GetVar(chrome::kChromeVersionEnvVar, &version_str)) | 74 if (!env->GetVar(chrome::kChromeVersionEnvVar, &version_str)) |
75 env->UnSetVar(chrome::kChromeVersionEnvVar); | |
76 else | |
77 version_str.clear(); | 75 version_str.clear(); |
78 | 76 |
79 base::FilePath exe_path; | 77 base::FilePath exe_path; |
80 if (!PathService::Get(base::FILE_EXE, &exe_path)) | 78 if (!PathService::Get(base::FILE_EXE, &exe_path)) |
81 return; | 79 return; |
82 | 80 |
83 base::FilePath path(exe_path.DirName()); | 81 base::FilePath path(exe_path.DirName()); |
84 | 82 |
85 // The relauncher is ordinarily in the version directory. When running in a | 83 // The relauncher is ordinarily in the version directory. When running in a |
86 // build tree however (where CHROME_VERSION is not set in the environment) | 84 // build tree however (where CHROME_VERSION is not set in the environment) |
(...skipping 29 matching lines...) Expand all Loading... |
116 } | 114 } |
117 | 115 |
118 void AttemptRestartToMetroMode() { | 116 void AttemptRestartToMetroMode() { |
119 PrefService* prefs = g_browser_process->local_state(); | 117 PrefService* prefs = g_browser_process->local_state(); |
120 prefs->SetString(prefs::kRelaunchMode, | 118 prefs->SetString(prefs::kRelaunchMode, |
121 upgrade_util::kRelaunchModeMetro); | 119 upgrade_util::kRelaunchModeMetro); |
122 AttemptRestart(); | 120 AttemptRestart(); |
123 } | 121 } |
124 | 122 |
125 } // namespace chrome | 123 } // namespace chrome |
OLD | NEW |