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