| OLD | NEW |
| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
| 17 #include "chrome/browser/extensions/updater/extension_updater.h" | 17 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 18 #include "chrome/browser/first_run/first_run_dialog.h" | 18 #include "chrome/browser/first_run/first_run_dialog.h" |
| 19 #include "chrome/browser/first_run/first_run_import_observer.h" | 19 #include "chrome/browser/first_run/first_run_import_observer.h" |
| 20 #include "chrome/browser/first_run/first_run_internal.h" | 20 #include "chrome/browser/first_run/first_run_internal.h" |
| 21 #include "chrome/browser/google/google_util.h" | 21 #include "chrome/browser/google/google_util.h" |
| 22 #include "chrome/browser/importer/external_process_importer_host.h" | 22 #include "chrome/browser/importer/external_process_importer_host.h" |
| 23 #include "chrome/browser/importer/importer_host.h" | 23 #include "chrome/browser/importer/importer_host.h" |
| 24 #include "chrome/browser/importer/importer_list.h" | 24 #include "chrome/browser/importer/importer_list.h" |
| 25 #include "chrome/browser/importer/importer_progress_dialog.h" | 25 #include "chrome/browser/importer/importer_progress_dialog.h" |
| 26 #include "chrome/browser/importer/importer_progress_observer.h" | 26 #include "chrome/browser/importer/importer_progress_observer.h" |
| 27 #include "chrome/browser/prefs/pref_registry_simple.h" |
| 27 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
| 28 #include "chrome/browser/process_singleton.h" | 29 #include "chrome/browser/process_singleton.h" |
| 29 #include "chrome/browser/profiles/profile_manager.h" | 30 #include "chrome/browser/profiles/profile_manager.h" |
| 30 #include "chrome/browser/search_engines/template_url_service.h" | 31 #include "chrome/browser/search_engines/template_url_service.h" |
| 31 #include "chrome/browser/search_engines/template_url_service_factory.h" | 32 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 32 #include "chrome/browser/shell_integration.h" | 33 #include "chrome/browser/shell_integration.h" |
| 33 #include "chrome/browser/ui/browser.h" | 34 #include "chrome/browser/ui/browser.h" |
| 34 #include "chrome/browser/ui/browser_finder.h" | 35 #include "chrome/browser/ui/browser_finder.h" |
| 35 #include "chrome/browser/ui/global_error/global_error_service.h" | 36 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 36 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 37 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 prefs::kShowFirstRunBubbleOption) != FIRST_RUN_BUBBLE_SUPPRESS) { | 423 prefs::kShowFirstRunBubbleOption) != FIRST_RUN_BUBBLE_SUPPRESS) { |
| 423 // Set the new state as long as the bubble wasn't explicitly suppressed | 424 // Set the new state as long as the bubble wasn't explicitly suppressed |
| 424 // already. | 425 // already. |
| 425 local_state->SetInteger(prefs::kShowFirstRunBubbleOption, | 426 local_state->SetInteger(prefs::kShowFirstRunBubbleOption, |
| 426 show_bubble_option); | 427 show_bubble_option); |
| 427 } | 428 } |
| 428 return true; | 429 return true; |
| 429 } | 430 } |
| 430 | 431 |
| 431 bool SetShowWelcomePagePref() { | 432 bool SetShowWelcomePagePref() { |
| 432 PrefServiceSimple* local_state = g_browser_process->local_state(); | 433 PrefService* local_state = g_browser_process->local_state(); |
| 433 if (!local_state) | 434 if (!local_state) |
| 434 return false; | 435 return false; |
| 435 // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). | 436 // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). |
| 436 if (!local_state->FindPreference(prefs::kShouldShowWelcomePage)) { | 437 if (!local_state->FindPreference(prefs::kShouldShowWelcomePage)) { |
| 437 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false); | 438 static_cast<PrefRegistrySimple*>( |
| 439 local_state->DeprecatedGetPrefRegistry())->RegisterBooleanPref( |
| 440 prefs::kShouldShowWelcomePage, false); |
| 438 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); | 441 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); |
| 439 } | 442 } |
| 440 return true; | 443 return true; |
| 441 } | 444 } |
| 442 | 445 |
| 443 bool SetPersonalDataManagerFirstRunPref() { | 446 bool SetPersonalDataManagerFirstRunPref() { |
| 444 PrefServiceSimple* local_state = g_browser_process->local_state(); | 447 PrefService* local_state = g_browser_process->local_state(); |
| 445 if (!local_state) | 448 if (!local_state) |
| 446 return false; | 449 return false; |
| 447 if (!local_state->FindPreference( | 450 if (!local_state->FindPreference( |
| 448 prefs::kAutofillPersonalDataManagerFirstRun)) { | 451 prefs::kAutofillPersonalDataManagerFirstRun)) { |
| 449 // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). | 452 // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). |
| 450 local_state->RegisterBooleanPref( | 453 static_cast<PrefRegistrySimple*>( |
| 451 prefs::kAutofillPersonalDataManagerFirstRun, false); | 454 local_state->DeprecatedGetPrefRegistry())->RegisterBooleanPref( |
| 455 prefs::kAutofillPersonalDataManagerFirstRun, false); |
| 452 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true); | 456 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true); |
| 453 } | 457 } |
| 454 return true; | 458 return true; |
| 455 } | 459 } |
| 456 | 460 |
| 457 void LogFirstRunMetric(FirstRunBubbleMetric metric) { | 461 void LogFirstRunMetric(FirstRunBubbleMetric metric) { |
| 458 UMA_HISTOGRAM_ENUMERATION("FirstRun.SearchEngineBubble", metric, | 462 UMA_HISTOGRAM_ENUMERATION("FirstRun.SearchEngineBubble", metric, |
| 459 NUM_FIRST_RUN_BUBBLE_METRICS); | 463 NUM_FIRST_RUN_BUBBLE_METRICS); |
| 460 } | 464 } |
| 461 | 465 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 if (template_url && template_url->GetDefaultSearchProvider()) | 707 if (template_url && template_url->GetDefaultSearchProvider()) |
| 704 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); | 708 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); |
| 705 SetShowWelcomePagePref(); | 709 SetShowWelcomePagePref(); |
| 706 SetPersonalDataManagerFirstRunPref(); | 710 SetPersonalDataManagerFirstRunPref(); |
| 707 #endif // !defined(USE_AURA) | 711 #endif // !defined(USE_AURA) |
| 708 | 712 |
| 709 internal::DoPostImportPlatformSpecificTasks(); | 713 internal::DoPostImportPlatformSpecificTasks(); |
| 710 } | 714 } |
| 711 | 715 |
| 712 } // namespace first_run | 716 } // namespace first_run |
| OLD | NEW |