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/first_run/first_run_internal.h" | 5 #include "chrome/browser/first_run/first_run_internal.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { | 138 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
| 139 NOTREACHED(); | 139 NOTREACHED(); |
| 140 } else if (!InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) { | 140 } else if (!InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) { |
| 141 content::BrowserThread::GetBlockingPool()->PostDelayedTask( | 141 content::BrowserThread::GetBlockingPool()->PostDelayedTask( |
| 142 FROM_HERE, | 142 FROM_HERE, |
| 143 base::Bind(&InstallUtil::TriggerActiveSetupCommand), | 143 base::Bind(&InstallUtil::TriggerActiveSetupCommand), |
| 144 base::TimeDelta::FromSeconds(kTiggerActiveSetupDelaySeconds)); | 144 base::TimeDelta::FromSeconds(kTiggerActiveSetupDelaySeconds)); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 bool GetFirstRunSentinelFilePath(base::FilePath* path) { | 148 bool IsFirstRunSentinelPresent() { |
| 149 return InstallUtil::GetSentinelFilePath( | 149 base::FilePath sentinel; |
| 150 chrome::kFirstRunSentinel, BrowserDistribution::GetDistribution(), path); | 150 if (!GetFirstRunSentinelFilePath(&sentinel) || base::PathExists(sentinel)) |
| 151 } | 151 return true; |
| 152 | 152 |
| 153 bool GetLegacyFirstRunSentinelFilePath(base::FilePath* path) { | 153 // Copy any legacy first run sentinel file for Windows user-level installs |
| 154 // The first run sentinel for user-level installs on Windows used to | 154 // from the application directory to the user data directory. |
| 155 // be in the application directory. | |
| 156 base::FilePath exe_path; | 155 base::FilePath exe_path; |
| 157 if (!PathService::Get(base::DIR_EXE, &exe_path) || | 156 if (PathService::Get(base::DIR_EXE, &exe_path) && |
| 158 !InstallUtil::IsPerUserInstall(exe_path.value().c_str())) { | 157 InstallUtil::IsPerUserInstall(exe_path.value().c_str())) { |
| 159 return false; | 158 base::FilePath legacy_sentinel = exe_path.Append(chrome::kFirstRunSentinel); |
| 159 if (base::PathExists(legacy_sentinel)) { | |
| 160 // Copy the file instead of moving it to avoid breaking developer builds | |
| 161 // where the sentinel is dropped beside chrome.exe by a build action. | |
| 162 bool migrated = base::CopyFile(legacy_sentinel, sentinel); | |
| 163 DPCHECK(migrated); | |
| 164 return true; | |
|
grt (UTC plus 2)
2014/03/27 15:35:20
please preserve this comment from first_run.cc:
//
msw
2014/03/28 00:04:11
Done.
| |
| 165 } | |
| 160 } | 166 } |
| 161 *path = exe_path.Append(chrome::kFirstRunSentinel); | 167 |
| 162 return true; | 168 return false; |
| 163 } | 169 } |
| 164 | 170 |
| 165 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) { | 171 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) { |
| 166 if (IsEULANotAccepted(install_prefs)) { | 172 if (IsEULANotAccepted(install_prefs)) { |
| 167 // Show the post-installation EULA. This is done by setup.exe and the | 173 // Show the post-installation EULA. This is done by setup.exe and the |
| 168 // result determines if we continue or not. We wait here until the user | 174 // result determines if we continue or not. We wait here until the user |
| 169 // dismisses the dialog. | 175 // dismisses the dialog. |
| 170 | 176 |
| 171 // The actual eula text is in a resource in chrome. We extract it to | 177 // The actual eula text is in a resource in chrome. We extract it to |
| 172 // a text file so setup.exe can use it as an inner frame. | 178 // a text file so setup.exe can use it as an inner frame. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 196 base::FilePath MasterPrefsPath() { | 202 base::FilePath MasterPrefsPath() { |
| 197 // The standard location of the master prefs is next to the chrome binary. | 203 // The standard location of the master prefs is next to the chrome binary. |
| 198 base::FilePath master_prefs; | 204 base::FilePath master_prefs; |
| 199 if (!PathService::Get(base::DIR_EXE, &master_prefs)) | 205 if (!PathService::Get(base::DIR_EXE, &master_prefs)) |
| 200 return base::FilePath(); | 206 return base::FilePath(); |
| 201 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); | 207 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); |
| 202 } | 208 } |
| 203 | 209 |
| 204 } // namespace internal | 210 } // namespace internal |
| 205 } // namespace first_run | 211 } // namespace first_run |
| OLD | NEW |