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" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 VLOG(1) << "Extensions block found in master preferences"; | 162 VLOG(1) << "Extensions block found in master preferences"; |
163 DoDelayedInstallExtensions(); | 163 DoDelayedInstallExtensions(); |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 base::FilePath GetDefaultPrefFilePath(bool create_profile_dir, | 167 base::FilePath GetDefaultPrefFilePath(bool create_profile_dir, |
168 const base::FilePath& user_data_dir) { | 168 const base::FilePath& user_data_dir) { |
169 base::FilePath default_pref_dir = | 169 base::FilePath default_pref_dir = |
170 ProfileManager::GetDefaultProfileDir(user_data_dir); | 170 ProfileManager::GetDefaultProfileDir(user_data_dir); |
171 if (create_profile_dir) { | 171 if (create_profile_dir) { |
172 if (!file_util::PathExists(default_pref_dir)) { | 172 if (!base::PathExists(default_pref_dir)) { |
173 if (!file_util::CreateDirectory(default_pref_dir)) | 173 if (!file_util::CreateDirectory(default_pref_dir)) |
174 return base::FilePath(); | 174 return base::FilePath(); |
175 } | 175 } |
176 } | 176 } |
177 return ProfileManager::GetProfilePrefsPath(default_pref_dir); | 177 return ProfileManager::GetProfilePrefsPath(default_pref_dir); |
178 } | 178 } |
179 | 179 |
180 // Sets the |items| bitfield according to whether the import data specified by | 180 // Sets the |items| bitfield according to whether the import data specified by |
181 // |import_type| should be be auto imported or not. | 181 // |import_type| should be be auto imported or not. |
182 void SetImportItem(PrefService* user_prefs, | 182 void SetImportItem(PrefService* user_prefs, |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 } | 463 } |
464 | 464 |
465 MasterPrefs::~MasterPrefs() {} | 465 MasterPrefs::~MasterPrefs() {} |
466 | 466 |
467 bool IsChromeFirstRun() { | 467 bool IsChromeFirstRun() { |
468 if (internal::first_run_ != internal::FIRST_RUN_UNKNOWN) | 468 if (internal::first_run_ != internal::FIRST_RUN_UNKNOWN) |
469 return internal::first_run_ == internal::FIRST_RUN_TRUE; | 469 return internal::first_run_ == internal::FIRST_RUN_TRUE; |
470 | 470 |
471 base::FilePath first_run_sentinel; | 471 base::FilePath first_run_sentinel; |
472 if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel) || | 472 if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel) || |
473 file_util::PathExists(first_run_sentinel)) { | 473 base::PathExists(first_run_sentinel)) { |
474 internal::first_run_ = internal::FIRST_RUN_FALSE; | 474 internal::first_run_ = internal::FIRST_RUN_FALSE; |
475 return false; | 475 return false; |
476 } | 476 } |
477 internal::first_run_ = internal::FIRST_RUN_TRUE; | 477 internal::first_run_ = internal::FIRST_RUN_TRUE; |
478 return true; | 478 return true; |
479 } | 479 } |
480 | 480 |
481 bool CreateSentinel() { | 481 bool CreateSentinel() { |
482 base::FilePath first_run_sentinel; | 482 base::FilePath first_run_sentinel; |
483 if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel)) | 483 if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel)) |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 Profile* profile, | 670 Profile* profile, |
671 bool homepage_defined, | 671 bool homepage_defined, |
672 int import_items, | 672 int import_items, |
673 int dont_import_items, | 673 int dont_import_items, |
674 const std::string& import_bookmarks_path) { | 674 const std::string& import_bookmarks_path) { |
675 // Deletes itself. | 675 // Deletes itself. |
676 ExternalProcessImporterHost* importer_host = new ExternalProcessImporterHost; | 676 ExternalProcessImporterHost* importer_host = new ExternalProcessImporterHost; |
677 | 677 |
678 base::FilePath local_state_path; | 678 base::FilePath local_state_path; |
679 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 679 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
680 bool local_state_file_exists = file_util::PathExists(local_state_path); | 680 bool local_state_file_exists = base::PathExists(local_state_path); |
681 | 681 |
682 scoped_refptr<ImporterList> importer_list(new ImporterList()); | 682 scoped_refptr<ImporterList> importer_list(new ImporterList()); |
683 importer_list->DetectSourceProfilesHack( | 683 importer_list->DetectSourceProfilesHack( |
684 g_browser_process->GetApplicationLocale()); | 684 g_browser_process->GetApplicationLocale()); |
685 | 685 |
686 // Do import if there is an available profile for us to import. | 686 // Do import if there is an available profile for us to import. |
687 if (importer_list->count() > 0) { | 687 if (importer_list->count() > 0) { |
688 // Don't show the warning dialog if import fails. | 688 // Don't show the warning dialog if import fails. |
689 importer_host->set_headless(); | 689 importer_host->set_headless(); |
690 int items = 0; | 690 int items = 0; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 SetShouldDoPersonalDataManagerFirstRun(); | 769 SetShouldDoPersonalDataManagerFirstRun(); |
770 | 770 |
771 internal::DoPostImportPlatformSpecificTasks(profile); | 771 internal::DoPostImportPlatformSpecificTasks(profile); |
772 } | 772 } |
773 | 773 |
774 uint16 auto_import_state() { | 774 uint16 auto_import_state() { |
775 return g_auto_import_state; | 775 return g_auto_import_state; |
776 } | 776 } |
777 | 777 |
778 } // namespace first_run | 778 } // namespace first_run |
OLD | NEW |