| 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/path_service.h" | 11 #include "base/path_service.h" |
| 11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/first_run/first_run_dialog.h" | 15 #include "chrome/browser/first_run/first_run_dialog.h" |
| 15 #include "chrome/browser/first_run/first_run_import_observer.h" | 16 #include "chrome/browser/first_run/first_run_import_observer.h" |
| 16 #include "chrome/browser/first_run/first_run_internal.h" | 17 #include "chrome/browser/first_run/first_run_internal.h" |
| 17 #include "chrome/browser/google/google_util.h" | 18 #include "chrome/browser/google/google_util.h" |
| 18 #include "chrome/browser/importer/external_process_importer_host.h" | 19 #include "chrome/browser/importer/external_process_importer_host.h" |
| 19 #include "chrome/browser/importer/importer_host.h" | 20 #include "chrome/browser/importer/importer_host.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 return false; | 456 return false; |
| 456 if (!local_state->FindPreference( | 457 if (!local_state->FindPreference( |
| 457 prefs::kAutofillPersonalDataManagerFirstRun)) { | 458 prefs::kAutofillPersonalDataManagerFirstRun)) { |
| 458 local_state->RegisterBooleanPref( | 459 local_state->RegisterBooleanPref( |
| 459 prefs::kAutofillPersonalDataManagerFirstRun, false); | 460 prefs::kAutofillPersonalDataManagerFirstRun, false); |
| 460 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true); | 461 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true); |
| 461 } | 462 } |
| 462 return true; | 463 return true; |
| 463 } | 464 } |
| 464 | 465 |
| 466 void LogFirstRunMetric(FirstRunBubbleMetric metric) { |
| 467 UMA_HISTOGRAM_ENUMERATION("FirstRun.SearchEngineBubble", metric, |
| 468 NUM_FIRST_RUN_BUBBLE_METRICS); |
| 469 } |
| 470 |
| 465 // static | 471 // static |
| 466 void FirstRunBubbleLauncher::ShowFirstRunBubbleSoon() { | 472 void FirstRunBubbleLauncher::ShowFirstRunBubbleSoon() { |
| 467 SetShowFirstRunBubblePref(true); | 473 SetShowFirstRunBubblePref(true); |
| 468 // This FirstRunBubbleLauncher instance will manage its own lifetime. | 474 // This FirstRunBubbleLauncher instance will manage its own lifetime. |
| 469 new FirstRunBubbleLauncher(); | 475 new FirstRunBubbleLauncher(); |
| 470 } | 476 } |
| 471 | 477 |
| 472 FirstRunBubbleLauncher::FirstRunBubbleLauncher() { | 478 FirstRunBubbleLauncher::FirstRunBubbleLauncher() { |
| 473 registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 479 registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 474 content::NotificationService::AllSources()); | 480 content::NotificationService::AllSources()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 | 522 |
| 517 // Reset the preference and notifications to avoid showing the bubble again. | 523 // Reset the preference and notifications to avoid showing the bubble again. |
| 518 prefs->SetBoolean(prefs::kShouldShowFirstRunBubble, false); | 524 prefs->SetBoolean(prefs::kShouldShowFirstRunBubble, false); |
| 519 | 525 |
| 520 // Show the bubble now and destroy this bubble launcher. | 526 // Show the bubble now and destroy this bubble launcher. |
| 521 browser->ShowFirstRunBubble(); | 527 browser->ShowFirstRunBubble(); |
| 522 delete this; | 528 delete this; |
| 523 } | 529 } |
| 524 | 530 |
| 525 } // namespace first_run | 531 } // namespace first_run |
| OLD | NEW |