| 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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/shell_integration.h" | 29 #include "chrome/browser/shell_integration.h" |
| 30 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
| 31 #include "chrome/browser/ui/browser_finder.h" | 31 #include "chrome/browser/ui/browser_finder.h" |
| 32 #include "chrome/browser/ui/browser_tabstrip.h" | 32 #include "chrome/browser/ui/browser_tabstrip.h" |
| 33 #include "chrome/browser/ui/global_error/global_error_service.h" | 33 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 34 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 34 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 35 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 35 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 36 #include "chrome/common/chrome_paths.h" | 36 #include "chrome/common/chrome_paths.h" |
| 37 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
| 38 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
| 39 #include "chrome/common/startup_metric_utils.h" |
| 39 #include "chrome/common/url_constants.h" | 40 #include "chrome/common/url_constants.h" |
| 40 #include "chrome/installer/util/master_preferences.h" | 41 #include "chrome/installer/util/master_preferences.h" |
| 41 #include "chrome/installer/util/master_preferences_constants.h" | 42 #include "chrome/installer/util/master_preferences_constants.h" |
| 42 #include "chrome/installer/util/util_constants.h" | 43 #include "chrome/installer/util/util_constants.h" |
| 43 #include "content/public/browser/notification_service.h" | 44 #include "content/public/browser/notification_service.h" |
| 44 #include "content/public/browser/notification_types.h" | 45 #include "content/public/browser/notification_types.h" |
| 45 #include "content/public/browser/user_metrics.h" | 46 #include "content/public/browser/user_metrics.h" |
| 46 #include "content/public/browser/web_contents.h" | 47 #include "content/public/browser/web_contents.h" |
| 47 #include "googleurl/src/gurl.h" | 48 #include "googleurl/src/gurl.h" |
| 48 | 49 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 } | 369 } |
| 369 | 370 |
| 370 content::RecordAction(UserMetricsAction("FirstRunDef_Accept")); | 371 content::RecordAction(UserMetricsAction("FirstRunDef_Accept")); |
| 371 | 372 |
| 372 // Launch the first run dialog only for certain builds, and only if the user | 373 // Launch the first run dialog only for certain builds, and only if the user |
| 373 // has not already set preferences. | 374 // has not already set preferences. |
| 374 if (IsOrganicFirstRun() && !local_state_file_exists) { | 375 if (IsOrganicFirstRun() && !local_state_file_exists) { |
| 375 // The home page string may be set in the preferences, but the user should | 376 // The home page string may be set in the preferences, but the user should |
| 376 // initially use Chrome with the NTP as home page in organic builds. | 377 // initially use Chrome with the NTP as home page in organic builds. |
| 377 profile->GetPrefs()->SetBoolean(prefs::kHomePageIsNewTabPage, true); | 378 profile->GetPrefs()->SetBoolean(prefs::kHomePageIsNewTabPage, true); |
| 379 startup_metric_utils::SetNonBrowserUIDisplayed(); |
| 378 ShowFirstRunDialog(profile); | 380 ShowFirstRunDialog(profile); |
| 379 } | 381 } |
| 380 | 382 |
| 381 if (make_chrome_default && | 383 if (make_chrome_default && |
| 382 ShellIntegration::CanSetAsDefaultBrowser() == | 384 ShellIntegration::CanSetAsDefaultBrowser() == |
| 383 ShellIntegration::SET_DEFAULT_UNATTENDED) { | 385 ShellIntegration::SET_DEFAULT_UNATTENDED) { |
| 384 ShellIntegration::SetAsDefaultBrowser(); | 386 ShellIntegration::SetAsDefaultBrowser(); |
| 385 } | 387 } |
| 386 | 388 |
| 387 // Display the first run bubble if there is a default search provider. | 389 // Display the first run bubble if there is a default search provider. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 546 |
| 545 // Reset the preference and notifications to avoid showing the bubble again. | 547 // Reset the preference and notifications to avoid showing the bubble again. |
| 546 prefs->SetBoolean(prefs::kShouldShowFirstRunBubble, false); | 548 prefs->SetBoolean(prefs::kShouldShowFirstRunBubble, false); |
| 547 | 549 |
| 548 // Show the bubble now and destroy this bubble launcher. | 550 // Show the bubble now and destroy this bubble launcher. |
| 549 browser->ShowFirstRunBubble(); | 551 browser->ShowFirstRunBubble(); |
| 550 delete this; | 552 delete this; |
| 551 } | 553 } |
| 552 | 554 |
| 553 } // namespace first_run | 555 } // namespace first_run |
| OLD | NEW |