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

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

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/installer/util/eula_util.h" 5 #include "chrome/installer/util/eula_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/common/chrome_constants.h" 9 #include "chrome/common/chrome_constants.h"
10 #include "chrome/installer/util/browser_distribution.h" 10 #include "chrome/installer/util/browser_distribution.h"
11 #include "chrome/installer/util/install_util.h" 11 #include "chrome/installer/util/install_util.h"
12 #include "chrome/installer/util/installation_state.h" 12 #include "chrome/installer/util/installation_state.h"
13 #include "chrome/installer/util/master_preferences.h" 13 #include "chrome/installer/util/master_preferences.h"
14 #include "chrome/installer/util/master_preferences_constants.h" 14 #include "chrome/installer/util/master_preferences_constants.h"
15 #include "chrome/installer/util/util_constants.h" 15 #include "chrome/installer/util/util_constants.h"
16 16
17 namespace installer { 17 namespace installer {
18 18
19 namespace { 19 namespace {
20 20
21 bool IsChromeFirstRunPending(BrowserDistribution* dist) { 21 bool IsChromeFirstRunPending(BrowserDistribution* dist) {
22 // Chrome creates the first run sentinel after the user has gone through the 22 // Chrome creates the first run sentinel after the user has gone through the
23 // first-run flow. Assume Chrome has been run if the path to the sentinel 23 // first-run flow. Assume Chrome has been run if the path to the sentinel
24 // cannot be determined. 24 // cannot be determined.
25 base::FilePath first_run_sentinel; 25 base::FilePath first_run_sentinel;
26 return InstallUtil::GetSentinelFilePath(chrome::kFirstRunSentinel, 26 return InstallUtil::GetSentinelFilePath(chrome::kFirstRunSentinel,
27 dist, 27 dist,
28 &first_run_sentinel) 28 &first_run_sentinel)
29 && !file_util::PathExists(first_run_sentinel); 29 && !base::PathExists(first_run_sentinel);
30 } 30 }
31 31
32 bool IsEULAAcceptanceFlagged(BrowserDistribution* dist) { 32 bool IsEULAAcceptanceFlagged(BrowserDistribution* dist) {
33 // Chrome creates the EULA sentinel after the EULA has been accepted when 33 // Chrome creates the EULA sentinel after the EULA has been accepted when
34 // doing so is required by master_preferences. Assume the EULA has not been 34 // doing so is required by master_preferences. Assume the EULA has not been
35 // accepted if the path to the sentinel cannot be determined. 35 // accepted if the path to the sentinel cannot be determined.
36 base::FilePath eula_sentinel; 36 base::FilePath eula_sentinel;
37 return InstallUtil::GetSentinelFilePath(kEULASentinelFile, 37 return InstallUtil::GetSentinelFilePath(kEULASentinelFile,
38 dist, 38 dist,
39 &eula_sentinel) 39 &eula_sentinel)
40 && file_util::PathExists(eula_sentinel); 40 && base::PathExists(eula_sentinel);
41 } 41 }
42 42
43 scoped_ptr<MasterPreferences> GetMasterPrefs(const ProductState& prod_state) { 43 scoped_ptr<MasterPreferences> GetMasterPrefs(const ProductState& prod_state) {
44 // The standard location of the master prefs is next to the chrome binary. 44 // The standard location of the master prefs is next to the chrome binary.
45 base::FilePath master_prefs_path( 45 base::FilePath master_prefs_path(
46 prod_state.GetSetupPath().DirName().DirName().DirName()); 46 prod_state.GetSetupPath().DirName().DirName().DirName());
47 scoped_ptr<MasterPreferences> install_prefs(new MasterPreferences( 47 scoped_ptr<MasterPreferences> install_prefs(new MasterPreferences(
48 master_prefs_path.AppendASCII(kDefaultMasterPrefs))); 48 master_prefs_path.AppendASCII(kDefaultMasterPrefs)));
49 if (install_prefs && install_prefs->read_from_file()) 49 if (install_prefs && install_prefs->read_from_file())
50 return install_prefs.Pass(); 50 return install_prefs.Pass();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 bool eula_required = false; 102 bool eula_required = false;
103 // If kRequireEula value is absent, assume EULA is not required. 103 // If kRequireEula value is absent, assume EULA is not required.
104 if (!install_prefs->GetBool(master_preferences::kRequireEula, &eula_required)) 104 if (!install_prefs->GetBool(master_preferences::kRequireEula, &eula_required))
105 return QUERY_EULA_ACCEPTED; 105 return QUERY_EULA_ACCEPTED;
106 106
107 return eula_required ? QUERY_EULA_NOT_ACCEPTED : QUERY_EULA_ACCEPTED; 107 return eula_required ? QUERY_EULA_NOT_ACCEPTED : QUERY_EULA_ACCEPTED;
108 } 108 }
109 109
110 } // namespace installer 110 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/duplicate_tree_detector_unittest.cc ('k') | chrome/installer/util/install_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698