summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util
diff options
context:
space:
mode:
authorthakis <thakis@chromium.org>2015-07-13 22:00:11 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-14 05:02:18 +0000
commit24c33b3780f6180432ba64a03ed4760da5ed6d87 (patch)
tree807ff2077f0a3e2dd3167a63f2f03f8f0841ac98 /chrome/installer/util
parente8743ffbb59f4a53cd2e373a74dd872cfab7981e (diff)
downloadchromium_src-24c33b3780f6180432ba64a03ed4760da5ed6d87.zip
chromium_src-24c33b3780f6180432ba64a03ed4760da5ed6d87.tar.gz
chromium_src-24c33b3780f6180432ba64a03ed4760da5ed6d87.tar.bz2
win: Do not explicitly call MasterPreferences() constructor from member function.
Fixes ..\..\chrome\installer\util\master_preferences.cc(122,30) : warning(clang): explicit constructor calls are a Microsoft extension [-Wmicrosoft] this->MasterPreferences::MasterPreferences(prefs_path); ^ No intended behavior change. BUG=505296 Review URL: https://codereview.chromium.org/1235033004 Cr-Commit-Position: refs/heads/master@{#338638}
Diffstat (limited to 'chrome/installer/util')
-rw-r--r--chrome/installer/util/master_preferences.cc27
-rw-r--r--chrome/installer/util/master_preferences.h3
2 files changed, 18 insertions, 12 deletions
diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc
index ec71d23..08d1de3 100644
--- a/chrome/installer/util/master_preferences.cc
+++ b/chrome/installer/util/master_preferences.cc
@@ -90,16 +90,7 @@ MasterPreferences::MasterPreferences(const base::FilePath& prefs_path)
preferences_read_from_file_(false),
chrome_(true),
multi_install_(false) {
- std::string json_data;
- // Failure to read the file is ignored as |json_data| will be the empty string
- // and the remainder of this MasterPreferences object should still be
- // initialized as best as possible.
- if (base::PathExists(prefs_path) &&
- !base::ReadFileToString(prefs_path, &json_data)) {
- LOG(ERROR) << "Failed to read preferences from " << prefs_path.value();
- }
- if (InitializeFromString(json_data))
- preferences_read_from_file_ = true;
+ InitializeFromFilePath(prefs_path);
}
MasterPreferences::MasterPreferences(const std::string& prefs)
@@ -119,7 +110,7 @@ void MasterPreferences::InitializeFromCommandLine(
if (cmd_line.HasSwitch(installer::switches::kInstallerData)) {
base::FilePath prefs_path(cmd_line.GetSwitchValuePath(
installer::switches::kInstallerData));
- this->MasterPreferences::MasterPreferences(prefs_path);
+ InitializeFromFilePath(prefs_path);
} else {
master_dictionary_.reset(new base::DictionaryValue());
}
@@ -195,6 +186,20 @@ void MasterPreferences::InitializeFromCommandLine(
#endif
}
+void MasterPreferences::InitializeFromFilePath(
+ const base::FilePath& prefs_path) {
+ std::string json_data;
+ // Failure to read the file is ignored as |json_data| will be the empty string
+ // and the remainder of this MasterPreferences object should still be
+ // initialized as best as possible.
+ if (base::PathExists(prefs_path) &&
+ !base::ReadFileToString(prefs_path, &json_data)) {
+ LOG(ERROR) << "Failed to read preferences from " << prefs_path.value();
+ }
+ if (InitializeFromString(json_data))
+ preferences_read_from_file_ = true;
+}
+
bool MasterPreferences::InitializeFromString(const std::string& json_data) {
if (!json_data.empty())
master_dictionary_.reset(ParseDistributionPreferences(json_data));
diff --git a/chrome/installer/util/master_preferences.h b/chrome/installer/util/master_preferences.h
index 2b8c914..868e124 100644
--- a/chrome/installer/util/master_preferences.h
+++ b/chrome/installer/util/master_preferences.h
@@ -189,8 +189,9 @@ class MasterPreferences {
// OTHER NOTE: Not thread safe.
static const MasterPreferences& ForCurrentProcess();
- protected:
+ private:
void InitializeFromCommandLine(const base::CommandLine& cmd_line);
+ void InitializeFromFilePath(const base::FilePath& prefs_path);
// Initializes the instance from a given JSON string, returning true if the
// string was successfully parsed.