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

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

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