| 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_registrar_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/browser_tabstrip.h" | 36 #include "chrome/browser/ui/browser_tabstrip.h" |
| 36 #include "chrome/browser/ui/global_error/global_error_service.h" | 37 #include "chrome/browser/ui/global_error/global_error_service.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 PrefRegistrarSimple(local_state).RegisterBooleanPref( |
| 439 prefs::kShouldShowWelcomePage, false); |
| 438 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); | 440 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); |
| 439 } | 441 } |
| 440 return true; | 442 return true; |
| 441 } | 443 } |
| 442 | 444 |
| 443 bool SetPersonalDataManagerFirstRunPref() { | 445 bool SetPersonalDataManagerFirstRunPref() { |
| 444 PrefServiceSimple* local_state = g_browser_process->local_state(); | 446 PrefService* local_state = g_browser_process->local_state(); |
| 445 if (!local_state) | 447 if (!local_state) |
| 446 return false; | 448 return false; |
| 447 if (!local_state->FindPreference( | 449 if (!local_state->FindPreference( |
| 448 prefs::kAutofillPersonalDataManagerFirstRun)) { | 450 prefs::kAutofillPersonalDataManagerFirstRun)) { |
| 449 // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). | 451 // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). |
| 450 local_state->RegisterBooleanPref( | 452 PrefRegistrarSimple(local_state).RegisterBooleanPref( |
| 451 prefs::kAutofillPersonalDataManagerFirstRun, false); | 453 prefs::kAutofillPersonalDataManagerFirstRun, false); |
| 452 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true); | 454 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true); |
| 453 } | 455 } |
| 454 return true; | 456 return true; |
| 455 } | 457 } |
| 456 | 458 |
| 457 void LogFirstRunMetric(FirstRunBubbleMetric metric) { | 459 void LogFirstRunMetric(FirstRunBubbleMetric metric) { |
| 458 UMA_HISTOGRAM_ENUMERATION("FirstRun.SearchEngineBubble", metric, | 460 UMA_HISTOGRAM_ENUMERATION("FirstRun.SearchEngineBubble", metric, |
| 459 NUM_FIRST_RUN_BUBBLE_METRICS); | 461 NUM_FIRST_RUN_BUBBLE_METRICS); |
| 460 } | 462 } |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 TemplateURLService* template_url = | 702 TemplateURLService* template_url = |
| 701 TemplateURLServiceFactory::GetForProfile(profile); | 703 TemplateURLServiceFactory::GetForProfile(profile); |
| 702 if (template_url && template_url->GetDefaultSearchProvider()) | 704 if (template_url && template_url->GetDefaultSearchProvider()) |
| 703 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); | 705 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); |
| 704 SetShowWelcomePagePref(); | 706 SetShowWelcomePagePref(); |
| 705 SetPersonalDataManagerFirstRunPref(); | 707 SetPersonalDataManagerFirstRunPref(); |
| 706 #endif // !defined(USE_AURA) | 708 #endif // !defined(USE_AURA) |
| 707 } | 709 } |
| 708 | 710 |
| 709 } // namespace first_run | 711 } // namespace first_run |
| OLD | NEW |