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

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: Removing shortcut install (will do in different CL), but keeping some refactoring. 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 : distribution_(NULL), 91 : distribution_(NULL),
92 preferences_read_from_file_(false), 92 preferences_read_from_file_(false),
93 chrome_(true), 93 chrome_(true),
94 chrome_app_host_(false), 94 chrome_app_host_(false),
95 chrome_frame_(false), 95 chrome_frame_(false),
96 multi_install_(false) { 96 multi_install_(false) {
97 InitializeFromCommandLine(cmd_line); 97 InitializeFromCommandLine(cmd_line);
98 } 98 }
99 99
100 MasterPreferences::MasterPreferences(const FilePath& prefs_path) 100 MasterPreferences::MasterPreferences(const FilePath& prefs_path)
101 : distribution_(NULL), preferences_read_from_file_(false), 101 : distribution_(NULL),
102 chrome_(true), chrome_app_host_(false), chrome_frame_(false), 102 preferences_read_from_file_(false),
103 chrome_(true),
104 chrome_app_host_(false),
105 chrome_frame_(false),
103 multi_install_(false) { 106 multi_install_(false) {
104 master_dictionary_.reset(ParseDistributionPreferences(prefs_path)); 107 master_dictionary_.reset(ParseDistributionPreferences(prefs_path));
105 108
106 if (!master_dictionary_.get()) { 109 if (!master_dictionary_.get()) {
107 master_dictionary_.reset(new DictionaryValue()); 110 master_dictionary_.reset(new DictionaryValue());
108 } else { 111 } else {
109 preferences_read_from_file_ = true; 112 preferences_read_from_file_ = true;
110 // Cache a pointer to the distribution dictionary. 113 // Cache a pointer to the distribution dictionary.
111 master_dictionary_->GetDictionary( 114 master_dictionary_->GetDictionary(
112 installer::master_preferences::kDistroDict, &distribution_); 115 installer::master_preferences::kDistroDict, &distribution_);
(...skipping 21 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::kCreateAllShortcuts, 155 { installer::switches::kCreateAllShortcuts,
151 installer::master_preferences::kCreateAllShortcuts }, 156 installer::master_preferences::kCreateAllShortcuts },
152 { installer::switches::kDisableLogging, 157 { installer::switches::kDisableLogging,
153 installer::master_preferences::kDisableLogging }, 158 installer::master_preferences::kDisableLogging },
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 208
204 // Cache a pointer to the distribution dictionary. Ignore errors if any. 209 // Cache a pointer to the distribution dictionary. Ignore errors if any.
205 master_dictionary_->GetDictionary(installer::master_preferences::kDistroDict, 210 master_dictionary_->GetDictionary(installer::master_preferences::kDistroDict,
206 &distribution_); 211 &distribution_);
207 212
208 InitializeProductFlags(); 213 InitializeProductFlags();
209 #endif 214 #endif
210 } 215 }
211 216
212 void MasterPreferences::InitializeProductFlags() { 217 void MasterPreferences::InitializeProductFlags() {
218 bool pref_chrome_app_host = false;
219 bool pref_chrome_app_launcher = false;
213 // Make sure we start out with the correct defaults. 220 // Make sure we start out with the correct defaults.
214 multi_install_ = false; 221 multi_install_ = false;
215 chrome_frame_ = false; 222 chrome_frame_ = false;
216 chrome_app_host_ = false; 223 chrome_app_host_ = false;
217 chrome_ = true; 224 chrome_ = true;
218 225
219 GetBool(installer::master_preferences::kMultiInstall, &multi_install_); 226 GetBool(installer::master_preferences::kMultiInstall, &multi_install_);
220 GetBool(installer::master_preferences::kChromeFrame, &chrome_frame_); 227 GetBool(installer::master_preferences::kChromeFrame, &chrome_frame_);
221 GetBool(installer::master_preferences::kChromeAppHost, &chrome_app_host_); 228
229 GetBool(installer::master_preferences::kChromeAppHost, &pref_chrome_app_host);
230 GetBool(installer::master_preferences::kChromeAppLauncher,
231 &pref_chrome_app_launcher);
232 chrome_app_host_ = pref_chrome_app_host || pref_chrome_app_launcher;
222 233
223 // When multi-install is specified, the checks are pretty simple (in theory): 234 // When multi-install is specified, the checks are pretty simple (in theory):
224 // In order to be installed/uninstalled, each product must have its switch 235 // In order to be installed/uninstalled, each product must have its switch
225 // present on the command line. 236 // present on the command line.
226 // Before multi-install was introduced however, we only supported installing 237 // Before multi-install was introduced however, we only supported installing
227 // two products, Chrome and Chrome Frame. For the time being we need to 238 // two products, Chrome and Chrome Frame. For the time being we need to
228 // continue to support this mode where multi-install is not set. 239 // continue to support this mode where multi-install is not set.
229 // So, when multi-install is not set, we continue to support mutually 240 // So, when multi-install is not set, we continue to support mutually
230 // exclusive installation of Chrome and Chrome Frame. 241 // exclusive installation of Chrome and Chrome Frame.
231 if (multi_install_) { 242 if (multi_install_) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const { 277 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const {
267 return master_dictionary_->GetDictionary( 278 return master_dictionary_->GetDictionary(
268 master_preferences::kExtensionsBlock, extensions); 279 master_preferences::kExtensionsBlock, extensions);
269 } 280 }
270 281
271 // static 282 // static
272 const MasterPreferences& MasterPreferences::ForCurrentProcess() { 283 const MasterPreferences& MasterPreferences::ForCurrentProcess() {
273 return g_master_preferences.Get(); 284 return g_master_preferences.Get();
274 } 285 }
275 } // installer_util 286 } // installer_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698