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

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WIP, latest changes from kaiwang@ Created 8 years 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/browser/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 PrefService* InitializeLocalState( 224 PrefService* InitializeLocalState(
225 base::SequencedTaskRunner* local_state_task_runner, 225 base::SequencedTaskRunner* local_state_task_runner,
226 const CommandLine& parsed_command_line, 226 const CommandLine& parsed_command_line,
227 bool is_first_run) { 227 bool is_first_run) {
228 FilePath local_state_path; 228 FilePath local_state_path;
229 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); 229 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
230 bool local_state_file_exists = file_util::PathExists(local_state_path); 230 bool local_state_file_exists = file_util::PathExists(local_state_path);
231 231
232 // Load local state. This includes the application locale so we know which 232 // Load local state. This includes the application locale so we know which
233 // locale dll to load. 233 // locale dll to load.
234 PrefService* local_state = g_browser_process->local_state(); 234 PrefServiceSimple* local_state = g_browser_process->local_state();
235 DCHECK(local_state); 235 DCHECK(local_state);
236 236
237 // TODO(brettw,*): this comment about ResourceBundle was here since 237 // TODO(brettw,*): this comment about ResourceBundle was here since
238 // initial commit. This comment seems unrelated, bit-rotten and 238 // initial commit. This comment seems unrelated, bit-rotten and
239 // a candidate for removal. 239 // a candidate for removal.
240 // Initialize ResourceBundle which handles files loaded from external 240 // Initialize ResourceBundle which handles files loaded from external
241 // sources. This has to be done before uninstall code path and before prefs 241 // sources. This has to be done before uninstall code path and before prefs
242 // are registered. 242 // are registered.
243 local_state->RegisterStringPref(prefs::kApplicationLocale, std::string()); 243 local_state->RegisterStringPref(prefs::kApplicationLocale, std::string());
244 #if defined(OS_CHROMEOS) 244 #if defined(OS_CHROMEOS)
(...skipping 25 matching lines...) Expand all
270 // local state from the parent profile. 270 // local state from the parent profile.
271 // Checking that the local state file for the current profile doesn't exist 271 // Checking that the local state file for the current profile doesn't exist
272 // is the most robust way to determine whether we need to inherit or not 272 // is the most robust way to determine whether we need to inherit or not
273 // since the parent profile command line flag can be present even when the 273 // since the parent profile command line flag can be present even when the
274 // current profile is not a new one, and in that case we do not want to 274 // current profile is not a new one, and in that case we do not want to
275 // inherit and reset the user's setting. 275 // inherit and reset the user's setting.
276 if (!local_state_file_exists && 276 if (!local_state_file_exists &&
277 parsed_command_line.HasSwitch(switches::kParentProfile)) { 277 parsed_command_line.HasSwitch(switches::kParentProfile)) {
278 FilePath parent_profile = 278 FilePath parent_profile =
279 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); 279 parsed_command_line.GetSwitchValuePath(switches::kParentProfile);
280 scoped_ptr<PrefService> parent_local_state( 280 scoped_ptr<PrefServiceSimple> parent_local_state(
281 ChromePrefServiceBuilder().CreateChromePrefs( 281 ChromePrefServiceBuilder().CreateLocalState(
282 parent_profile, 282 parent_profile,
283 local_state_task_runner, 283 local_state_task_runner,
284 g_browser_process->policy_service(), 284 g_browser_process->policy_service(),
285 NULL, false)); 285 NULL, false));
286 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, 286 parent_local_state->RegisterStringPref(prefs::kApplicationLocale,
287 std::string()); 287 std::string());
288 // Right now, we only inherit the locale setting from the parent profile. 288 // Right now, we only inherit the locale setting from the parent profile.
289 local_state->SetString( 289 local_state->SetString(
290 prefs::kApplicationLocale, 290 prefs::kApplicationLocale,
291 parent_local_state->GetString(prefs::kApplicationLocale)); 291 parent_local_state->GetString(prefs::kApplicationLocale));
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 if (base::win::GetVersion() <= base::win::VERSION_XP) 1666 if (base::win::GetVersion() <= base::win::VERSION_XP)
1667 uma_name += "_XP"; 1667 uma_name += "_XP";
1668 1668
1669 uma_name += "_PreRead_"; 1669 uma_name += "_PreRead_";
1670 uma_name += pre_read_percentage; 1670 uma_name += pre_read_percentage;
1671 AddPreReadHistogramTime(uma_name.c_str(), time); 1671 AddPreReadHistogramTime(uma_name.c_str(), time);
1672 } 1672 }
1673 #endif 1673 #endif
1674 #endif 1674 #endif
1675 } 1675 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698