| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/message_loop.h" |
| 14 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 16 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 17 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
| 22 #include "chrome/browser/extensions/extension_service.h" | 23 #include "chrome/browser/extensions/extension_service.h" |
| 23 #include "chrome/browser/extensions/updater/extension_updater.h" | 24 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 24 #include "chrome/browser/first_run/first_run_internal.h" | 25 #include "chrome/browser/first_run/first_run_internal.h" |
| 25 #include "chrome/browser/google/google_util.h" | 26 #include "chrome/browser/google/google_util.h" |
| 26 #include "chrome/browser/importer/external_process_importer_host.h" | 27 #include "chrome/browser/importer/external_process_importer_host.h" |
| 27 #include "chrome/browser/importer/importer_list.h" | 28 #include "chrome/browser/importer/importer_list.h" |
| 28 #include "chrome/browser/importer/importer_progress_observer.h" | 29 #include "chrome/browser/importer/importer_progress_observer.h" |
| 29 #include "chrome/browser/importer/importer_uma.h" | 30 #include "chrome/browser/importer/importer_uma.h" |
| 30 #include "chrome/browser/importer/profile_writer.h" | 31 #include "chrome/browser/importer/profile_writer.h" |
| 31 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profiles_state.h" |
| 32 #include "chrome/browser/search_engines/template_url_service.h" | 33 #include "chrome/browser/search_engines/template_url_service.h" |
| 33 #include "chrome/browser/search_engines/template_url_service_factory.h" | 34 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 34 #include "chrome/browser/shell_integration.h" | 35 #include "chrome/browser/shell_integration.h" |
| 35 #include "chrome/browser/signin/signin_manager.h" | 36 #include "chrome/browser/signin/signin_manager.h" |
| 36 #include "chrome/browser/signin/signin_manager_factory.h" | 37 #include "chrome/browser/signin/signin_manager_factory.h" |
| 37 #include "chrome/browser/signin/signin_tracker.h" | 38 #include "chrome/browser/signin/signin_tracker.h" |
| 38 #include "chrome/browser/ui/browser.h" | 39 #include "chrome/browser/ui/browser.h" |
| 39 #include "chrome/browser/ui/browser_finder.h" | 40 #include "chrome/browser/ui/browser_finder.h" |
| 40 #include "chrome/browser/ui/global_error/global_error_service.h" | 41 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 41 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 42 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 DictionaryValue* extensions = 0; | 161 DictionaryValue* extensions = 0; |
| 161 if (install_prefs->GetExtensionsBlock(&extensions)) { | 162 if (install_prefs->GetExtensionsBlock(&extensions)) { |
| 162 VLOG(1) << "Extensions block found in master preferences"; | 163 VLOG(1) << "Extensions block found in master preferences"; |
| 163 DoDelayedInstallExtensions(); | 164 DoDelayedInstallExtensions(); |
| 164 } | 165 } |
| 165 } | 166 } |
| 166 | 167 |
| 167 base::FilePath GetDefaultPrefFilePath(bool create_profile_dir, | 168 base::FilePath GetDefaultPrefFilePath(bool create_profile_dir, |
| 168 const base::FilePath& user_data_dir) { | 169 const base::FilePath& user_data_dir) { |
| 169 base::FilePath default_pref_dir = | 170 base::FilePath default_pref_dir = |
| 170 ProfileManager::GetDefaultProfileDir(user_data_dir); | 171 profiles::GetDefaultProfileDir(user_data_dir); |
| 171 if (create_profile_dir) { | 172 if (create_profile_dir) { |
| 172 if (!base::PathExists(default_pref_dir)) { | 173 if (!base::PathExists(default_pref_dir)) { |
| 173 if (!file_util::CreateDirectory(default_pref_dir)) | 174 if (!file_util::CreateDirectory(default_pref_dir)) |
| 174 return base::FilePath(); | 175 return base::FilePath(); |
| 175 } | 176 } |
| 176 } | 177 } |
| 177 return ProfileManager::GetProfilePrefsPath(default_pref_dir); | 178 return profiles::GetProfilePrefsPath(default_pref_dir); |
| 178 } | 179 } |
| 179 | 180 |
| 180 // Sets the |items| bitfield according to whether the import data specified by | 181 // Sets the |items| bitfield according to whether the import data specified by |
| 181 // |import_type| should be be auto imported or not. | 182 // |import_type| should be be auto imported or not. |
| 182 void SetImportItem(PrefService* user_prefs, | 183 void SetImportItem(PrefService* user_prefs, |
| 183 const char* pref_path, | 184 const char* pref_path, |
| 184 int import_items, | 185 int import_items, |
| 185 int dont_import_items, | 186 int dont_import_items, |
| 186 importer::ImportItem import_type, | 187 importer::ImportItem import_type, |
| 187 int* items) { | 188 int* items) { |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 SetShouldDoPersonalDataManagerFirstRun(); | 770 SetShouldDoPersonalDataManagerFirstRun(); |
| 770 | 771 |
| 771 internal::DoPostImportPlatformSpecificTasks(profile); | 772 internal::DoPostImportPlatformSpecificTasks(profile); |
| 772 } | 773 } |
| 773 | 774 |
| 774 uint16 auto_import_state() { | 775 uint16 auto_import_state() { |
| 775 return g_auto_import_state; | 776 return g_auto_import_state; |
| 776 } | 777 } |
| 777 | 778 |
| 778 } // namespace first_run | 779 } // namespace first_run |
| OLD | NEW |