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

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

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix double registration in Chrome Frame test. 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
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/first_run/first_run.h" 5 #include "chrome/browser/first_run/first_run.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/extensions/updater/extension_updater.h" 18 #include "chrome/browser/extensions/updater/extension_updater.h"
19 #include "chrome/browser/first_run/first_run_dialog.h" 19 #include "chrome/browser/first_run/first_run_dialog.h"
20 #include "chrome/browser/first_run/first_run_import_observer.h" 20 #include "chrome/browser/first_run/first_run_import_observer.h"
21 #include "chrome/browser/first_run/first_run_internal.h" 21 #include "chrome/browser/first_run/first_run_internal.h"
22 #include "chrome/browser/google/google_util.h" 22 #include "chrome/browser/google/google_util.h"
23 #include "chrome/browser/importer/external_process_importer_host.h" 23 #include "chrome/browser/importer/external_process_importer_host.h"
24 #include "chrome/browser/importer/importer_host.h" 24 #include "chrome/browser/importer/importer_host.h"
25 #include "chrome/browser/importer/importer_list.h" 25 #include "chrome/browser/importer/importer_list.h"
26 #include "chrome/browser/importer/importer_progress_dialog.h" 26 #include "chrome/browser/importer/importer_progress_dialog.h"
27 #include "chrome/browser/importer/importer_progress_observer.h" 27 #include "chrome/browser/importer/importer_progress_observer.h"
28 #include "chrome/browser/prefs/pref_registry_simple.h"
28 #include "chrome/browser/prefs/pref_service.h" 29 #include "chrome/browser/prefs/pref_service.h"
29 #include "chrome/browser/process_singleton.h" 30 #include "chrome/browser/process_singleton.h"
30 #include "chrome/browser/profiles/profile_manager.h" 31 #include "chrome/browser/profiles/profile_manager.h"
31 #include "chrome/browser/search_engines/template_url_service.h" 32 #include "chrome/browser/search_engines/template_url_service.h"
32 #include "chrome/browser/search_engines/template_url_service_factory.h" 33 #include "chrome/browser/search_engines/template_url_service_factory.h"
33 #include "chrome/browser/shell_integration.h" 34 #include "chrome/browser/shell_integration.h"
34 #include "chrome/browser/ui/browser.h" 35 #include "chrome/browser/ui/browser.h"
35 #include "chrome/browser/ui/browser_finder.h" 36 #include "chrome/browser/ui/browser_finder.h"
36 #include "chrome/browser/ui/global_error/global_error_service.h" 37 #include "chrome/browser/ui/global_error/global_error_service.h"
37 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 38 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 prefs::kShowFirstRunBubbleOption) != FIRST_RUN_BUBBLE_SUPPRESS) { 429 prefs::kShowFirstRunBubbleOption) != FIRST_RUN_BUBBLE_SUPPRESS) {
429 // Set the new state as long as the bubble wasn't explicitly suppressed 430 // Set the new state as long as the bubble wasn't explicitly suppressed
430 // already. 431 // already.
431 local_state->SetInteger(prefs::kShowFirstRunBubbleOption, 432 local_state->SetInteger(prefs::kShowFirstRunBubbleOption,
432 show_bubble_option); 433 show_bubble_option);
433 } 434 }
434 return true; 435 return true;
435 } 436 }
436 437
437 bool SetShowWelcomePagePref() { 438 bool SetShowWelcomePagePref() {
438 PrefServiceSimple* local_state = g_browser_process->local_state(); 439 PrefService* local_state = g_browser_process->local_state();
439 if (!local_state) 440 if (!local_state)
440 return false; 441 return false;
441 // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). 442 // TODO(joi): This should happen via browser_prefs::RegisterLocalState().
442 if (!local_state->FindPreference(prefs::kShouldShowWelcomePage)) { 443 if (!local_state->FindPreference(prefs::kShouldShowWelcomePage)) {
443 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false); 444 static_cast<PrefRegistrySimple*>(
445 local_state->DeprecatedGetPrefRegistry())->RegisterBooleanPref(
446 prefs::kShouldShowWelcomePage, false);
444 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); 447 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true);
445 } 448 }
446 return true; 449 return true;
447 } 450 }
448 451
449 bool SetPersonalDataManagerFirstRunPref() { 452 bool SetPersonalDataManagerFirstRunPref() {
450 PrefServiceSimple* local_state = g_browser_process->local_state(); 453 PrefService* local_state = g_browser_process->local_state();
451 if (!local_state) 454 if (!local_state)
452 return false; 455 return false;
453 if (!local_state->FindPreference( 456 if (!local_state->FindPreference(
454 prefs::kAutofillPersonalDataManagerFirstRun)) { 457 prefs::kAutofillPersonalDataManagerFirstRun)) {
455 // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). 458 // TODO(joi): This should happen via browser_prefs::RegisterLocalState().
456 local_state->RegisterBooleanPref( 459 static_cast<PrefRegistrySimple*>(
457 prefs::kAutofillPersonalDataManagerFirstRun, false); 460 local_state->DeprecatedGetPrefRegistry())->RegisterBooleanPref(
461 prefs::kAutofillPersonalDataManagerFirstRun, false);
458 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true); 462 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true);
459 } 463 }
460 return true; 464 return true;
461 } 465 }
462 466
463 void LogFirstRunMetric(FirstRunBubbleMetric metric) { 467 void LogFirstRunMetric(FirstRunBubbleMetric metric) {
464 UMA_HISTOGRAM_ENUMERATION("FirstRun.SearchEngineBubble", metric, 468 UMA_HISTOGRAM_ENUMERATION("FirstRun.SearchEngineBubble", metric,
465 NUM_FIRST_RUN_BUBBLE_METRICS); 469 NUM_FIRST_RUN_BUBBLE_METRICS);
466 } 470 }
467 471
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 if (template_url && template_url->GetDefaultSearchProvider()) 717 if (template_url && template_url->GetDefaultSearchProvider())
714 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); 718 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon();
715 SetShowWelcomePagePref(); 719 SetShowWelcomePagePref();
716 SetPersonalDataManagerFirstRunPref(); 720 SetPersonalDataManagerFirstRunPref();
717 #endif // !defined(USE_AURA) 721 #endif // !defined(USE_AURA)
718 722
719 internal::DoPostImportPlatformSpecificTasks(); 723 internal::DoPostImportPlatformSpecificTasks();
720 } 724 }
721 725
722 } // namespace first_run 726 } // namespace first_run
OLDNEW
« no previous file with comments | « chrome/browser/external_protocol/external_protocol_handler.cc ('k') | chrome/browser/geolocation/chrome_access_token_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698