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

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

Issue 12223044: Don't accidentally propagate Omaha variable to child processes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a silly mistake. Created 7 years, 10 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
« no previous file with comments | « chrome/common/env_vars.cc ('k') | chrome/installer/util/util_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "chrome/common/env_vars.h"
14 #include "chrome/installer/util/master_preferences_constants.h" 15 #include "chrome/installer/util/master_preferences_constants.h"
15 #include "chrome/installer/util/util_constants.h" 16 #include "chrome/installer/util/util_constants.h"
16 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
17 18
18 namespace { 19 namespace {
19 20
20 const char kFirstRunTabs[] = "first_run_tabs"; 21 const char kFirstRunTabs[] = "first_run_tabs";
21 22
22 base::LazyInstance<installer::MasterPreferences> g_master_preferences = 23 base::LazyInstance<installer::MasterPreferences> g_master_preferences =
23 LAZY_INSTANCE_INITIALIZER; 24 LAZY_INSTANCE_INITIALIZER;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 name.assign(installer::master_preferences::kDistroDict); 195 name.assign(installer::master_preferences::kDistroDict);
195 name.append(".").append(installer::master_preferences::kLogFile); 196 name.append(".").append(installer::master_preferences::kLogFile);
196 master_dictionary_->SetString(name, str_value); 197 master_dictionary_->SetString(name, str_value);
197 } 198 }
198 199
199 // Handle the special case of --system-level being implied by the presence of 200 // Handle the special case of --system-level being implied by the presence of
200 // the kGoogleUpdateIsMachineEnvVar environment variable. 201 // the kGoogleUpdateIsMachineEnvVar environment variable.
201 scoped_ptr<base::Environment> env(base::Environment::Create()); 202 scoped_ptr<base::Environment> env(base::Environment::Create());
202 if (env != NULL) { 203 if (env != NULL) {
203 std::string is_machine_var; 204 std::string is_machine_var;
204 env->GetVar(kGoogleUpdateIsMachineEnvVar, &is_machine_var); 205 env->GetVar(env_vars::kGoogleUpdateIsMachineEnvVar, &is_machine_var);
205 if (!is_machine_var.empty() && is_machine_var[0] == '1') { 206 if (!is_machine_var.empty() && is_machine_var[0] == '1') {
206 VLOG(1) << "Taking system-level from environment."; 207 VLOG(1) << "Taking system-level from environment.";
207 name.assign(installer::master_preferences::kDistroDict); 208 name.assign(installer::master_preferences::kDistroDict);
208 name.append(".").append(installer::master_preferences::kSystemLevel); 209 name.append(".").append(installer::master_preferences::kSystemLevel);
209 master_dictionary_->SetBoolean(name, true); 210 master_dictionary_->SetBoolean(name, true);
210 } 211 }
211 } 212 }
212 213
213 // Cache a pointer to the distribution dictionary. Ignore errors if any. 214 // Cache a pointer to the distribution dictionary. Ignore errors if any.
214 master_dictionary_->GetDictionary(installer::master_preferences::kDistroDict, 215 master_dictionary_->GetDictionary(installer::master_preferences::kDistroDict,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const { 312 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const {
312 return master_dictionary_->GetDictionary( 313 return master_dictionary_->GetDictionary(
313 master_preferences::kExtensionsBlock, extensions); 314 master_preferences::kExtensionsBlock, extensions);
314 } 315 }
315 316
316 // static 317 // static
317 const MasterPreferences& MasterPreferences::ForCurrentProcess() { 318 const MasterPreferences& MasterPreferences::ForCurrentProcess() {
318 return g_master_preferences.Get(); 319 return g_master_preferences.Get();
319 } 320 }
320 } // installer_util 321 } // installer_util
OLDNEW
« no previous file with comments | « chrome/common/env_vars.cc ('k') | chrome/installer/util/util_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698