Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/installer/util/install_util.cc

Issue 208393020: Fix the new First Run sentinel file path determination. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase; re-upload to kick CQ. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/installer/util/install_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // See the corresponding header file for description of the functions in this 5 // See the corresponding header file for description of the functions in this
6 // file. 6 // file.
7 7
8 #include "chrome/installer/util/install_util.h" 8 #include "chrome/installer/util/install_util.h"
9 9
10 #include <shellapi.h> 10 #include <shellapi.h>
(...skipping 10 matching lines...) Expand all
21 #include "base/platform_file.h" 21 #include "base/platform_file.h"
22 #include "base/process/launch.h" 22 #include "base/process/launch.h"
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "base/sys_info.h" 25 #include "base/sys_info.h"
26 #include "base/values.h" 26 #include "base/values.h"
27 #include "base/version.h" 27 #include "base/version.h"
28 #include "base/win/metro.h" 28 #include "base/win/metro.h"
29 #include "base/win/registry.h" 29 #include "base/win/registry.h"
30 #include "base/win/windows_version.h" 30 #include "base/win/windows_version.h"
31 #include "chrome/common/chrome_constants.h"
32 #include "chrome/common/chrome_paths.h"
31 #include "chrome/installer/util/browser_distribution.h" 33 #include "chrome/installer/util/browser_distribution.h"
32 #include "chrome/installer/util/google_update_constants.h" 34 #include "chrome/installer/util/google_update_constants.h"
33 #include "chrome/installer/util/helper.h" 35 #include "chrome/installer/util/helper.h"
34 #include "chrome/installer/util/installation_state.h" 36 #include "chrome/installer/util/installation_state.h"
35 #include "chrome/installer/util/l10n_string_util.h" 37 #include "chrome/installer/util/l10n_string_util.h"
36 #include "chrome/installer/util/util_constants.h" 38 #include "chrome/installer/util/util_constants.h"
37 #include "chrome/installer/util/work_item_list.h" 39 #include "chrome/installer/util/work_item_list.h"
38 40
39 using base::win::RegKey; 41 using base::win::RegKey;
40 using installer::ProductState; 42 using installer::ProductState;
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 394 }
393 395
394 return false; 396 return false;
395 } 397 }
396 398
397 bool InstallUtil::IsChromeSxSProcess() { 399 bool InstallUtil::IsChromeSxSProcess() {
398 static bool sxs = CheckIsChromeSxSProcess(); 400 static bool sxs = CheckIsChromeSxSProcess();
399 return sxs; 401 return sxs;
400 } 402 }
401 403
402 bool InstallUtil::GetSentinelFilePath( 404 // static
403 const base::FilePath::CharType* file, 405 bool InstallUtil::IsFirstRunSentinelPresent() {
404 BrowserDistribution* dist, 406 // TODO(msw): Consolidate with first_run::internal::IsFirstRunSentinelPresent.
405 base::FilePath* path) { 407 base::FilePath user_data_dir;
408 return !PathService::Get(chrome::DIR_USER_DATA, &user_data_dir) ||
gab 2014/04/02 15:06:51 This won't work inside setup.exe. Only chrome.exe
grt (UTC plus 2) 2014/04/02 16:42:12 Nice catch. setup depends on common_constants, so
409 base::PathExists(user_data_dir.Append(chrome::kFirstRunSentinel));
410 }
411
412 // static
413 bool InstallUtil::GetSentinelFilePath(const base::FilePath::CharType* file,
414 BrowserDistribution* dist,
415 base::FilePath* path) {
416 // TODO(msw): Use PathService to obtain the correct DIR_USER_DATA.
406 std::vector<base::FilePath> user_data_dir_paths; 417 std::vector<base::FilePath> user_data_dir_paths;
407 installer::GetChromeUserDataPaths(dist, &user_data_dir_paths); 418 installer::GetChromeUserDataPaths(dist, &user_data_dir_paths);
408 419
409 if (user_data_dir_paths.empty()) 420 if (user_data_dir_paths.empty())
410 return false; 421 return false;
411 *path = user_data_dir_paths[0].Append(file); 422 *path = user_data_dir_paths[0].Append(file);
412 return true; 423 return true;
413 } 424 }
414 425
415 // This method tries to delete a registry key and logs an error message 426 // This method tries to delete a registry key and logs an error message
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 // Open the program and see if it references the expected file. 610 // Open the program and see if it references the expected file.
600 base::File file; 611 base::File file;
601 BY_HANDLE_FILE_INFORMATION info = {}; 612 BY_HANDLE_FILE_INFORMATION info = {};
602 613
603 return (OpenForInfo(path, &file) && 614 return (OpenForInfo(path, &file) &&
604 GetInfo(file, &info) && 615 GetInfo(file, &info) &&
605 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && 616 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber &&
606 info.nFileIndexHigh == file_info_.nFileIndexHigh && 617 info.nFileIndexHigh == file_info_.nFileIndexHigh &&
607 info.nFileIndexLow == file_info_.nFileIndexLow); 618 info.nFileIndexLow == file_info_.nFileIndexLow);
608 } 619 }
OLDNEW
« no previous file with comments | « chrome/installer/util/install_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698