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

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

Issue 10818021: Revert 147650 - Implement installation of the Chrome App Host. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1215/src/
Patch Set: Created 8 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) 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return static_cast<DictionaryValue*>(root.release()); 75 return static_cast<DictionaryValue*>(root.release());
76 } 76 }
77 77
78 } // namespace 78 } // namespace
79 79
80 namespace installer { 80 namespace installer {
81 81
82 MasterPreferences::MasterPreferences() : distribution_(NULL), 82 MasterPreferences::MasterPreferences() : distribution_(NULL),
83 preferences_read_from_file_(false), 83 preferences_read_from_file_(false),
84 chrome_(true), 84 chrome_(true),
85 chrome_app_host_(false),
86 chrome_frame_(false), 85 chrome_frame_(false),
87 multi_install_(false) { 86 multi_install_(false) {
88 InitializeFromCommandLine(*CommandLine::ForCurrentProcess()); 87 InitializeFromCommandLine(*CommandLine::ForCurrentProcess());
89 } 88 }
90 89
91 MasterPreferences::MasterPreferences(const CommandLine& cmd_line) 90 MasterPreferences::MasterPreferences(const CommandLine& cmd_line)
92 : distribution_(NULL), 91 : distribution_(NULL),
93 preferences_read_from_file_(false), 92 preferences_read_from_file_(false),
94 chrome_(true), 93 chrome_(true),
95 chrome_app_host_(false),
96 chrome_frame_(false), 94 chrome_frame_(false),
97 multi_install_(false) { 95 multi_install_(false) {
98 InitializeFromCommandLine(cmd_line); 96 InitializeFromCommandLine(cmd_line);
99 } 97 }
100 98
101 MasterPreferences::MasterPreferences(const FilePath& prefs_path) 99 MasterPreferences::MasterPreferences(const FilePath& prefs_path)
102 : distribution_(NULL), preferences_read_from_file_(false), 100 : distribution_(NULL), preferences_read_from_file_(false),
103 chrome_(true), chrome_app_host_(false), chrome_frame_(false), 101 chrome_(true), chrome_frame_(false), multi_install_(false) {
104 multi_install_(false) {
105 master_dictionary_.reset(ParseDistributionPreferences(prefs_path)); 102 master_dictionary_.reset(ParseDistributionPreferences(prefs_path));
106 103
107 if (!master_dictionary_.get()) { 104 if (!master_dictionary_.get()) {
108 master_dictionary_.reset(new DictionaryValue()); 105 master_dictionary_.reset(new DictionaryValue());
109 } else { 106 } else {
110 preferences_read_from_file_ = true; 107 preferences_read_from_file_ = true;
111 // Cache a pointer to the distribution dictionary. 108 // Cache a pointer to the distribution dictionary.
112 master_dictionary_->GetDictionary(kDistroDict, &distribution_); 109 master_dictionary_->GetDictionary(kDistroDict, &distribution_);
113 } 110 }
114 111
(...skipping 17 matching lines...) Expand all
132 129
133 // A simple map from command line switches to equivalent switches in the 130 // A simple map from command line switches to equivalent switches in the
134 // distribution dictionary. Currently all switches added will be set to 131 // distribution dictionary. Currently all switches added will be set to
135 // 'true'. 132 // 'true'.
136 static const struct CmdLineSwitchToDistributionSwitch { 133 static const struct CmdLineSwitchToDistributionSwitch {
137 const char* cmd_line_switch; 134 const char* cmd_line_switch;
138 const char* distribution_switch; 135 const char* distribution_switch;
139 } translate_switches[] = { 136 } translate_switches[] = {
140 { installer::switches::kAutoLaunchChrome, 137 { installer::switches::kAutoLaunchChrome,
141 installer::master_preferences::kAutoLaunchChrome }, 138 installer::master_preferences::kAutoLaunchChrome },
142 { installer::switches::kChromeAppHost,
143 installer::master_preferences::kChromeAppHost },
144 { installer::switches::kChrome, 139 { installer::switches::kChrome,
145 installer::master_preferences::kChrome }, 140 installer::master_preferences::kChrome },
146 { installer::switches::kChromeFrame, 141 { installer::switches::kChromeFrame,
147 installer::master_preferences::kChromeFrame }, 142 installer::master_preferences::kChromeFrame },
148 { installer::switches::kChromeFrameReadyMode, 143 { installer::switches::kChromeFrameReadyMode,
149 installer::master_preferences::kChromeFrameReadyMode }, 144 installer::master_preferences::kChromeFrameReadyMode },
150 { installer::switches::kCreateAllShortcuts, 145 { installer::switches::kCreateAllShortcuts,
151 installer::master_preferences::kCreateAllShortcuts }, 146 installer::master_preferences::kCreateAllShortcuts },
152 { installer::switches::kDisableLogging, 147 { installer::switches::kDisableLogging,
153 installer::master_preferences::kDisableLogging }, 148 installer::master_preferences::kDisableLogging },
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 master_dictionary_->GetDictionary(kDistroDict, &distribution_); 200 master_dictionary_->GetDictionary(kDistroDict, &distribution_);
206 201
207 InitializeProductFlags(); 202 InitializeProductFlags();
208 #endif 203 #endif
209 } 204 }
210 205
211 void MasterPreferences::InitializeProductFlags() { 206 void MasterPreferences::InitializeProductFlags() {
212 // Make sure we start out with the correct defaults. 207 // Make sure we start out with the correct defaults.
213 multi_install_ = false; 208 multi_install_ = false;
214 chrome_frame_ = false; 209 chrome_frame_ = false;
215 chrome_app_host_ = false;
216 chrome_ = true; 210 chrome_ = true;
217 211
218 GetBool(installer::master_preferences::kMultiInstall, &multi_install_); 212 GetBool(installer::master_preferences::kMultiInstall, &multi_install_);
219 GetBool(installer::master_preferences::kChromeFrame, &chrome_frame_); 213 GetBool(installer::master_preferences::kChromeFrame, &chrome_frame_);
220 GetBool(installer::master_preferences::kChromeAppHost, &chrome_app_host_);
221 214
222 // When multi-install is specified, the checks are pretty simple (in theory): 215 // When multi-install is specified, the checks are pretty simple (in theory):
223 // In order to be installed/uninstalled, each product must have its switch 216 // In order to be installed/uninstalled, each product must have its switch
224 // present on the command line. 217 // present on the command line.
225 // Before multi-install was introduced however, we only supported installing 218 // Before multi-install was introduced however, we only supported installing
226 // two products, Chrome and Chrome Frame. For the time being we need to 219 // two products, Chrome and Chrome Frame. For the time being we need to
227 // continue to support this mode where multi-install is not set. 220 // continue to support this mode where multi-install is not set.
228 // So, when multi-install is not set, we continue to support mutually 221 // So, when multi-install is not set, we continue to support mutually
229 // exclusive installation of Chrome and Chrome Frame. 222 // exclusive installation of Chrome and Chrome Frame.
230 if (multi_install_) { 223 if (multi_install_) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const { 258 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const {
266 return master_dictionary_->GetDictionary( 259 return master_dictionary_->GetDictionary(
267 master_preferences::kExtensionsBlock, extensions); 260 master_preferences::kExtensionsBlock, extensions);
268 } 261 }
269 262
270 // static 263 // static
271 const MasterPreferences& MasterPreferences::ForCurrentProcess() { 264 const MasterPreferences& MasterPreferences::ForCurrentProcess() {
272 return g_master_preferences.Get(); 265 return g_master_preferences.Get();
273 } 266 }
274 } // installer_util 267 } // installer_util
OLDNEW
« no previous file with comments | « chrome/installer/util/master_preferences.h ('k') | chrome/installer/util/master_preferences_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698