| 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/file_util.h" |
| 8 #include "base/files/file_path.h" |
| 7 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 8 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 9 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 10 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/first_run/first_run_dialog.h" |
| 12 #include "chrome/browser/first_run/first_run_internal.h" | 15 #include "chrome/browser/first_run/first_run_internal.h" |
| 13 #include "chrome/browser/importer/importer_host.h" | 16 #include "chrome/browser/importer/importer_host.h" |
| 14 #include "chrome/browser/importer/importer_list.h" | 17 #include "chrome/browser/importer/importer_list.h" |
| 15 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 16 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
| 17 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/common/startup_metric_utils.h" |
| 19 #include "chrome/installer/util/google_update_settings.h" | 23 #include "chrome/installer/util/google_update_settings.h" |
| 20 #include "chrome/installer/util/master_preferences.h" | 24 #include "chrome/installer/util/master_preferences.h" |
| 21 #include "chrome/installer/util/master_preferences_constants.h" | 25 #include "chrome/installer/util/master_preferences_constants.h" |
| 22 | 26 |
| 23 namespace first_run { | 27 namespace first_run { |
| 24 namespace internal { | 28 namespace internal { |
| 25 | 29 |
| 26 void DoPostImportPlatformSpecificTasks() { | 30 void DoPostImportPlatformSpecificTasks(Profile* profile) { |
| 27 #if !defined(OS_CHROMEOS) | 31 #if !defined(OS_CHROMEOS) |
| 32 // Aura needs a views implementation of the first run dialog for Linux. |
| 33 // http://crbug.com/234637 |
| 34 #if !defined(USE_AURA) |
| 35 base::FilePath local_state_path; |
| 36 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
| 37 bool local_state_file_exists = file_util::PathExists(local_state_path); |
| 38 // Launch the first run dialog only for certain builds, and only if the user |
| 39 // has not already set preferences. |
| 40 if (internal::IsOrganicFirstRun() && !local_state_file_exists) { |
| 41 if (ShowFirstRunDialog(profile)) |
| 42 startup_metric_utils::SetNonBrowserUIDisplayed(); |
| 43 } |
| 44 #endif |
| 45 |
| 28 // If stats reporting was turned on by the first run dialog then toggle | 46 // If stats reporting was turned on by the first run dialog then toggle |
| 29 // the pref (on Windows, the download is tagged with enable/disable stats so | 47 // the pref (on Windows, the download is tagged with enable/disable stats so |
| 30 // this is POSIX-specific). | 48 // this is POSIX-specific). |
| 31 if (GoogleUpdateSettings::GetCollectStatsConsent()) { | 49 if (GoogleUpdateSettings::GetCollectStatsConsent()) { |
| 32 g_browser_process->local_state()->SetBoolean( | 50 g_browser_process->local_state()->SetBoolean( |
| 33 prefs::kMetricsReportingEnabled, true); | 51 prefs::kMetricsReportingEnabled, true); |
| 34 } | 52 } |
| 35 #endif | 53 #endif |
| 36 } | 54 } |
| 37 | 55 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 namespace first_run { | 120 namespace first_run { |
| 103 | 121 |
| 104 // TODO(port): Import switches need to be ported to both Mac and Linux. Not all | 122 // TODO(port): Import switches need to be ported to both Mac and Linux. Not all |
| 105 // import switches here are implemented for Linux. None are implemented for Mac | 123 // import switches here are implemented for Linux. None are implemented for Mac |
| 106 // (as this function will not be called on Mac). | 124 // (as this function will not be called on Mac). |
| 107 int ImportNow(Profile* profile, const CommandLine& cmdline) { | 125 int ImportNow(Profile* profile, const CommandLine& cmdline) { |
| 108 return internal::ImportBookmarkFromFileIfNeeded(profile, cmdline); | 126 return internal::ImportBookmarkFromFileIfNeeded(profile, cmdline); |
| 109 } | 127 } |
| 110 | 128 |
| 111 } // namespace first_run | 129 } // namespace first_run |
| OLD | NEW |