| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
| 25 #include "chrome/browser/search_engines/template_url_service.h" | 25 #include "chrome/browser/search_engines/template_url_service.h" |
| 26 #include "chrome/browser/search_engines/template_url_service_factory.h" | 26 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 27 #include "chrome/browser/shell_integration.h" | 27 #include "chrome/browser/shell_integration.h" |
| 28 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
| 29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 31 #include "chrome/installer/util/master_preferences.h" | 31 #include "chrome/installer/util/master_preferences.h" |
| 32 #include "chrome/installer/util/master_preferences_constants.h" | 32 #include "chrome/installer/util/master_preferences_constants.h" |
| 33 #include "chrome/installer/util/util_constants.h" | 33 #include "chrome/installer/util/util_constants.h" |
| 34 #include "content/browser/user_metrics.h" | 34 #include "content/public/browser/user_metrics.h" |
| 35 #include "googleurl/src/gurl.h" | 35 #include "googleurl/src/gurl.h" |
| 36 | 36 |
| 37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 38 // TODO(port): move more code in back from the first_run_win.cc module. | 38 // TODO(port): move more code in back from the first_run_win.cc module. |
| 39 #include "chrome/installer/util/google_update_settings.h" | 39 #include "chrome/installer/util/google_update_settings.h" |
| 40 #include "chrome/installer/util/install_util.h" | 40 #include "chrome/installer/util/install_util.h" |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 using content::UserMetricsAction; |
| 44 |
| 43 namespace { | 45 namespace { |
| 44 | 46 |
| 45 // The kSentinelFile file absence will tell us it is a first run. | 47 // The kSentinelFile file absence will tell us it is a first run. |
| 46 const char kSentinelFile[] = "First Run"; | 48 const char kSentinelFile[] = "First Run"; |
| 47 | 49 |
| 48 FilePath GetDefaultPrefFilePath(bool create_profile_dir, | 50 FilePath GetDefaultPrefFilePath(bool create_profile_dir, |
| 49 const FilePath& user_data_dir) { | 51 const FilePath& user_data_dir) { |
| 50 FilePath default_pref_dir = | 52 FilePath default_pref_dir = |
| 51 ProfileManager::GetDefaultProfileDir(user_data_dir); | 53 ProfileManager::GetDefaultProfileDir(user_data_dir); |
| 52 if (create_profile_dir) { | 54 if (create_profile_dir) { |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 SetImportItem(user_prefs, | 613 SetImportItem(user_prefs, |
| 612 prefs::kImportBookmarks, | 614 prefs::kImportBookmarks, |
| 613 import_items, | 615 import_items, |
| 614 dont_import_items, | 616 dont_import_items, |
| 615 importer::FAVORITES, | 617 importer::FAVORITES, |
| 616 items); | 618 items); |
| 617 | 619 |
| 618 ImportSettings(profile, importer_host, importer_list, items); | 620 ImportSettings(profile, importer_host, importer_list, items); |
| 619 } | 621 } |
| 620 | 622 |
| 621 UserMetrics::RecordAction(UserMetricsAction("FirstRunDef_Accept")); | 623 content::RecordAction(UserMetricsAction("FirstRunDef_Accept")); |
| 622 | 624 |
| 623 // Launch the search engine dialog only for certain builds, and only if the | 625 // Launch the search engine dialog only for certain builds, and only if the |
| 624 // user has not already set preferences. | 626 // user has not already set preferences. |
| 625 if (IsOrganicFirstRun() && !local_state_file_exists) { | 627 if (IsOrganicFirstRun() && !local_state_file_exists) { |
| 626 // The home page string may be set in the preferences, but the user should | 628 // The home page string may be set in the preferences, but the user should |
| 627 // initially use Chrome with the NTP as home page in organic builds. | 629 // initially use Chrome with the NTP as home page in organic builds. |
| 628 profile->GetPrefs()->SetBoolean(prefs::kHomePageIsNewTabPage, true); | 630 profile->GetPrefs()->SetBoolean(prefs::kHomePageIsNewTabPage, true); |
| 629 first_run::ShowFirstRunDialog(profile, randomize_search_engine_experiment); | 631 first_run::ShowFirstRunDialog(profile, randomize_search_engine_experiment); |
| 630 } | 632 } |
| 631 | 633 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 if (!observer->ended()) { | 730 if (!observer->ended()) { |
| 729 observer->set_should_quit_message_loop(); | 731 observer->set_should_quit_message_loop(); |
| 730 MessageLoop::current()->Run(); | 732 MessageLoop::current()->Run(); |
| 731 } | 733 } |
| 732 | 734 |
| 733 // Unfortunately there's no success/fail signal in ImporterHost. | 735 // Unfortunately there's no success/fail signal in ImporterHost. |
| 734 return true; | 736 return true; |
| 735 } | 737 } |
| 736 | 738 |
| 737 #endif // OS_POSIX | 739 #endif // OS_POSIX |
| OLD | NEW |