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

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

Issue 11267023: Implementing --app-launcher install/uninstall flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits; added localized string for App Launcher uninstall shortcut. Created 8 years, 1 month 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) 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/installer/util/master_preferences.h" 5 #include "chrome/installer/util/master_preferences.h"
6 6
7 #include "base/environment.h" 7 #include "base/environment.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 : distribution_(NULL), 86 : distribution_(NULL),
87 preferences_read_from_file_(false), 87 preferences_read_from_file_(false),
88 chrome_(true), 88 chrome_(true),
89 chrome_app_host_(false), 89 chrome_app_host_(false),
90 chrome_frame_(false), 90 chrome_frame_(false),
91 multi_install_(false) { 91 multi_install_(false) {
92 InitializeFromCommandLine(cmd_line); 92 InitializeFromCommandLine(cmd_line);
93 } 93 }
94 94
95 MasterPreferences::MasterPreferences(const FilePath& prefs_path) 95 MasterPreferences::MasterPreferences(const FilePath& prefs_path)
96 : distribution_(NULL), preferences_read_from_file_(false), 96 : distribution_(NULL),
97 chrome_(true), chrome_app_host_(false), chrome_frame_(false), 97 preferences_read_from_file_(false),
98 chrome_(true),
99 chrome_app_host_(false),
100 chrome_frame_(false),
98 multi_install_(false) { 101 multi_install_(false) {
99 std::string json_data; 102 std::string json_data;
100 // Failure to read the file is ignored as |json_data| will be the empty string 103 // Failure to read the file is ignored as |json_data| will be the empty string
101 // and the remainder of this MasterPreferences objet should still be 104 // and the remainder of this MasterPreferences objet should still be
102 // initialized as best as possible. 105 // initialized as best as possible.
103 if (!file_util::ReadFileToString(prefs_path, &json_data)) { 106 if (!file_util::ReadFileToString(prefs_path, &json_data)) {
104 LOG(ERROR) << "Failed to read master_preferences file at " 107 LOG(ERROR) << "Failed to read master_preferences file at "
105 << prefs_path.value() 108 << prefs_path.value()
106 << ". Falling back to default preferences."; 109 << ". Falling back to default preferences.";
107 } 110 }
(...skipping 26 matching lines...) Expand all
134 // distribution dictionary. Currently all switches added will be set to 137 // distribution dictionary. Currently all switches added will be set to
135 // 'true'. 138 // 'true'.
136 static const struct CmdLineSwitchToDistributionSwitch { 139 static const struct CmdLineSwitchToDistributionSwitch {
137 const char* cmd_line_switch; 140 const char* cmd_line_switch;
138 const char* distribution_switch; 141 const char* distribution_switch;
139 } translate_switches[] = { 142 } translate_switches[] = {
140 { installer::switches::kAutoLaunchChrome, 143 { installer::switches::kAutoLaunchChrome,
141 installer::master_preferences::kAutoLaunchChrome }, 144 installer::master_preferences::kAutoLaunchChrome },
142 { installer::switches::kChromeAppHost, 145 { installer::switches::kChromeAppHost,
143 installer::master_preferences::kChromeAppHost }, 146 installer::master_preferences::kChromeAppHost },
147 { installer::switches::kChromeAppLauncher,
148 installer::master_preferences::kChromeAppLauncher },
144 { installer::switches::kChrome, 149 { installer::switches::kChrome,
145 installer::master_preferences::kChrome }, 150 installer::master_preferences::kChrome },
146 { installer::switches::kChromeFrame, 151 { installer::switches::kChromeFrame,
147 installer::master_preferences::kChromeFrame }, 152 installer::master_preferences::kChromeFrame },
148 { installer::switches::kChromeFrameReadyMode, 153 { installer::switches::kChromeFrameReadyMode,
149 installer::master_preferences::kChromeFrameReadyMode }, 154 installer::master_preferences::kChromeFrameReadyMode },
150 { installer::switches::kDisableLogging, 155 { installer::switches::kDisableLogging,
151 installer::master_preferences::kDisableLogging }, 156 installer::master_preferences::kDisableLogging },
152 { installer::switches::kMsi, 157 { installer::switches::kMsi,
153 installer::master_preferences::kMsi }, 158 installer::master_preferences::kMsi },
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Cache a pointer to the distribution dictionary. 219 // Cache a pointer to the distribution dictionary.
215 master_dictionary_->GetDictionary( 220 master_dictionary_->GetDictionary(
216 installer::master_preferences::kDistroDict, &distribution_); 221 installer::master_preferences::kDistroDict, &distribution_);
217 } 222 }
218 223
219 InitializeProductFlags(); 224 InitializeProductFlags();
220 EnforceLegacyPreferences(); 225 EnforceLegacyPreferences();
221 } 226 }
222 227
223 void MasterPreferences::InitializeProductFlags() { 228 void MasterPreferences::InitializeProductFlags() {
229 bool pref_chrome_app_host = false;
230 bool pref_chrome_app_launcher = false;
224 // Make sure we start out with the correct defaults. 231 // Make sure we start out with the correct defaults.
225 multi_install_ = false; 232 multi_install_ = false;
226 chrome_frame_ = false; 233 chrome_frame_ = false;
227 chrome_app_host_ = false; 234 chrome_app_host_ = false;
228 chrome_ = true; 235 chrome_ = true;
229 236
230 GetBool(installer::master_preferences::kMultiInstall, &multi_install_); 237 GetBool(installer::master_preferences::kMultiInstall, &multi_install_);
231 GetBool(installer::master_preferences::kChromeFrame, &chrome_frame_); 238 GetBool(installer::master_preferences::kChromeFrame, &chrome_frame_);
232 GetBool(installer::master_preferences::kChromeAppHost, &chrome_app_host_); 239
240 GetBool(installer::master_preferences::kChromeAppHost, &pref_chrome_app_host);
241 GetBool(installer::master_preferences::kChromeAppLauncher,
242 &pref_chrome_app_launcher);
243 chrome_app_host_ = pref_chrome_app_host || pref_chrome_app_launcher;
233 244
234 // When multi-install is specified, the checks are pretty simple (in theory): 245 // When multi-install is specified, the checks are pretty simple (in theory):
235 // In order to be installed/uninstalled, each product must have its switch 246 // In order to be installed/uninstalled, each product must have its switch
236 // present on the command line. 247 // present on the command line.
237 // Before multi-install was introduced however, we only supported installing 248 // Before multi-install was introduced however, we only supported installing
238 // two products, Chrome and Chrome Frame. For the time being we need to 249 // two products, Chrome and Chrome Frame. For the time being we need to
239 // continue to support this mode where multi-install is not set. 250 // continue to support this mode where multi-install is not set.
240 // So, when multi-install is not set, we continue to support mutually 251 // So, when multi-install is not set, we continue to support mutually
241 // exclusive installation of Chrome and Chrome Frame. 252 // exclusive installation of Chrome and Chrome Frame.
242 if (multi_install_) { 253 if (multi_install_) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const { 302 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const {
292 return master_dictionary_->GetDictionary( 303 return master_dictionary_->GetDictionary(
293 master_preferences::kExtensionsBlock, extensions); 304 master_preferences::kExtensionsBlock, extensions);
294 } 305 }
295 306
296 // static 307 // static
297 const MasterPreferences& MasterPreferences::ForCurrentProcess() { 308 const MasterPreferences& MasterPreferences::ForCurrentProcess() {
298 return g_master_preferences.Get(); 309 return g_master_preferences.Get();
299 } 310 }
300 } // installer_util 311 } // installer_util
OLDNEW
« no previous file with comments | « chrome/installer/util/installation_validator.cc ('k') | chrome/installer/util/master_preferences_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698