| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 #include "content/public/browser/navigation_entry.h" | 63 #include "content/public/browser/navigation_entry.h" |
| 64 #include "content/public/browser/notification_observer.h" | 64 #include "content/public/browser/notification_observer.h" |
| 65 #include "content/public/browser/notification_registrar.h" | 65 #include "content/public/browser/notification_registrar.h" |
| 66 #include "content/public/browser/notification_service.h" | 66 #include "content/public/browser/notification_service.h" |
| 67 #include "content/public/browser/notification_types.h" | 67 #include "content/public/browser/notification_types.h" |
| 68 #include "content/public/browser/user_metrics.h" | 68 #include "content/public/browser/user_metrics.h" |
| 69 #include "content/public/browser/web_contents.h" | 69 #include "content/public/browser/web_contents.h" |
| 70 #include "extensions/browser/extension_system.h" | 70 #include "extensions/browser/extension_system.h" |
| 71 #include "google_apis/gaia/gaia_auth_util.h" | 71 #include "google_apis/gaia/gaia_auth_util.h" |
| 72 #include "ui/base/l10n/l10n_util.h" | 72 #include "ui/base/l10n/l10n_util.h" |
| 73 #include "ui/base/resource/resource_bundle.h" |
| 73 #include "url/gurl.h" | 74 #include "url/gurl.h" |
| 74 | 75 |
| 75 using base::UserMetricsAction; | 76 using base::UserMetricsAction; |
| 76 | 77 |
| 77 namespace { | 78 namespace { |
| 78 | 79 |
| 79 // A bitfield formed from values in AutoImportState to record the state of | 80 // A bitfield formed from values in AutoImportState to record the state of |
| 80 // AutoImport. This is used in testing to verify import startup actions that | 81 // AutoImport. This is used in testing to verify import startup actions that |
| 81 // occur before an observer can be registered in the test. | 82 // occur before an observer can be registered in the test. |
| 82 uint16_t g_auto_import_state = first_run::AUTO_IMPORT_NONE; | 83 uint16_t g_auto_import_state = first_run::AUTO_IMPORT_NONE; |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 MasterPrefs* out_prefs) { | 719 MasterPrefs* out_prefs) { |
| 719 DCHECK(!user_data_dir.empty()); | 720 DCHECK(!user_data_dir.empty()); |
| 720 | 721 |
| 721 std::unique_ptr<installer::MasterPreferences> install_prefs( | 722 std::unique_ptr<installer::MasterPreferences> install_prefs( |
| 722 LoadMasterPrefs()); | 723 LoadMasterPrefs()); |
| 723 | 724 |
| 724 // Default value in case master preferences is missing or corrupt, or | 725 // Default value in case master preferences is missing or corrupt, or |
| 725 // ping_delay is missing. | 726 // ping_delay is missing. |
| 726 out_prefs->ping_delay = 90; | 727 out_prefs->ping_delay = 90; |
| 727 if (install_prefs.get()) { | 728 if (install_prefs.get()) { |
| 729 // The ResourceBundle hasn't been loaded yet, but we need strings from it. |
| 730 ResourceBundle::TemporaryLoader loader; |
| 731 |
| 728 if (!internal::ShowPostInstallEULAIfNeeded(install_prefs.get())) | 732 if (!internal::ShowPostInstallEULAIfNeeded(install_prefs.get())) |
| 729 return EULA_EXIT_NOW; | 733 return EULA_EXIT_NOW; |
| 730 | 734 |
| 731 if (!chrome_prefs::InitializePrefsFromMasterPrefs( | 735 if (!chrome_prefs::InitializePrefsFromMasterPrefs( |
| 732 profiles::GetDefaultProfileDir(user_data_dir), | 736 profiles::GetDefaultProfileDir(user_data_dir), |
| 733 install_prefs->master_dictionary())) { | 737 install_prefs->master_dictionary())) { |
| 734 DLOG(ERROR) << "Failed to initialize from master_preferences."; | 738 DLOG(ERROR) << "Failed to initialize from master_preferences."; |
| 735 } | 739 } |
| 736 | 740 |
| 737 DoDelayedInstallExtensionsIfNeeded(install_prefs.get()); | 741 DoDelayedInstallExtensionsIfNeeded(install_prefs.get()); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 SetShouldDoPersonalDataManagerFirstRun(); | 842 SetShouldDoPersonalDataManagerFirstRun(); |
| 839 | 843 |
| 840 internal::DoPostImportPlatformSpecificTasks(profile); | 844 internal::DoPostImportPlatformSpecificTasks(profile); |
| 841 } | 845 } |
| 842 | 846 |
| 843 uint16_t auto_import_state() { | 847 uint16_t auto_import_state() { |
| 844 return g_auto_import_state; | 848 return g_auto_import_state; |
| 845 } | 849 } |
| 846 | 850 |
| 847 } // namespace first_run | 851 } // namespace first_run |
| OLD | NEW |