Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(998)

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 1380103004: Delay fetching account info until OnRefreshTokensLoaded(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unregister Invalidation service correctly. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/profiles/profile_manager.h" 5 #include "chrome/browser/profiles/profile_manager.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/deferred_sequenced_task_runner.h" 11 #include "base/deferred_sequenced_task_runner.h"
12 #include "base/files/file_enumerator.h" 12 #include "base/files/file_enumerator.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
16 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
17 #include "base/prefs/scoped_user_pref_update.h" 17 #include "base/prefs/scoped_user_pref_update.h"
18 #include "base/profiler/scoped_profile.h" 18 #include "base/profiler/scoped_profile.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "base/trace_event/trace_event.h" 22 #include "base/trace_event/trace_event.h"
23 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 23 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
24 #include "chrome/browser/bookmarks/startup_task_runner_service_factory.h" 24 #include "chrome/browser/bookmarks/startup_task_runner_service_factory.h"
25 #include "chrome/browser/browser_process.h" 25 #include "chrome/browser/browser_process.h"
26 #include "chrome/browser/chrome_notification_types.h" 26 #include "chrome/browser/chrome_notification_types.h"
27 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 27 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
28 #include "chrome/browser/download/download_service.h" 28 #include "chrome/browser/download/download_service.h"
29 #include "chrome/browser/download/download_service_factory.h" 29 #include "chrome/browser/download/download_service_factory.h"
30 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
30 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 31 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
31 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 32 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
32 #include "chrome/browser/password_manager/password_store_factory.h" 33 #include "chrome/browser/password_manager/password_store_factory.h"
33 #include "chrome/browser/prefs/incognito_mode_prefs.h" 34 #include "chrome/browser/prefs/incognito_mode_prefs.h"
34 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" 35 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h"
35 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 36 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
36 #include "chrome/browser/profiles/profile_destroyer.h" 37 #include "chrome/browser/profiles/profile_destroyer.h"
37 #include "chrome/browser/profiles/profile_info_cache.h" 38 #include "chrome/browser/profiles/profile_info_cache.h"
38 #include "chrome/browser/profiles/profile_metrics.h" 39 #include "chrome/browser/profiles/profile_metrics.h"
39 #include "chrome/browser/profiles/profiles_state.h" 40 #include "chrome/browser/profiles/profiles_state.h"
(...skipping 13 matching lines...) Expand all
53 #include "chrome/common/chrome_paths_internal.h" 54 #include "chrome/common/chrome_paths_internal.h"
54 #include "chrome/common/chrome_switches.h" 55 #include "chrome/common/chrome_switches.h"
55 #include "chrome/common/logging_chrome.h" 56 #include "chrome/common/logging_chrome.h"
56 #include "chrome/common/pref_names.h" 57 #include "chrome/common/pref_names.h"
57 #include "chrome/common/url_constants.h" 58 #include "chrome/common/url_constants.h"
58 #include "chrome/grit/generated_resources.h" 59 #include "chrome/grit/generated_resources.h"
59 #include "components/bookmarks/browser/bookmark_model.h" 60 #include "components/bookmarks/browser/bookmark_model.h"
60 #include "components/bookmarks/browser/startup_task_runner_service.h" 61 #include "components/bookmarks/browser/startup_task_runner_service.h"
61 #include "components/bookmarks/common/bookmark_pref_names.h" 62 #include "components/bookmarks/common/bookmark_pref_names.h"
62 #include "components/content_settings/core/browser/host_content_settings_map.h" 63 #include "components/content_settings/core/browser/host_content_settings_map.h"
64 #include "components/invalidation/impl/profile_invalidation_provider.h"
65 #include "components/invalidation/public/invalidation_service.h"
63 #include "components/password_manager/core/browser/password_store.h" 66 #include "components/password_manager/core/browser/password_store.h"
64 #include "components/signin/core/browser/account_fetcher_service.h" 67 #include "components/signin/core/browser/account_fetcher_service.h"
65 #include "components/signin/core/browser/account_tracker_service.h" 68 #include "components/signin/core/browser/account_tracker_service.h"
66 #include "components/signin/core/browser/gaia_cookie_manager_service.h" 69 #include "components/signin/core/browser/gaia_cookie_manager_service.h"
67 #include "components/signin/core/browser/signin_manager.h" 70 #include "components/signin/core/browser/signin_manager.h"
68 #include "components/signin/core/common/profile_management_switches.h" 71 #include "components/signin/core/common/profile_management_switches.h"
69 #include "components/signin/core/common/signin_pref_names.h" 72 #include "components/signin/core/common/signin_pref_names.h"
70 #include "content/public/browser/browser_thread.h" 73 #include "content/public/browser/browser_thread.h"
71 #include "content/public/browser/notification_service.h" 74 #include "content/public/browser/notification_service.h"
72 #include "content/public/browser/user_metrics.h" 75 #include "content/public/browser/user_metrics.h"
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 // Start the deferred task runners once the profile is loaded. 1109 // Start the deferred task runners once the profile is loaded.
1107 StartupTaskRunnerServiceFactory::GetForProfile(profile)-> 1110 StartupTaskRunnerServiceFactory::GetForProfile(profile)->
1108 StartDeferredTaskRunners(); 1111 StartDeferredTaskRunners();
1109 1112
1110 // Activate data reduction proxy. This creates a request context and makes a 1113 // Activate data reduction proxy. This creates a request context and makes a
1111 // URL request to check if the data reduction proxy server is reachable. 1114 // URL request to check if the data reduction proxy server is reachable.
1112 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile)-> 1115 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile)->
1113 MaybeActivateDataReductionProxy(true); 1116 MaybeActivateDataReductionProxy(true);
1114 1117
1115 GaiaCookieManagerServiceFactory::GetForProfile(profile)->Init(); 1118 GaiaCookieManagerServiceFactory::GetForProfile(profile)->Init();
1116 AccountFetcherServiceFactory::GetForProfile(profile)->EnableNetworkFetches(); 1119 invalidation::ProfileInvalidationProvider* invalidation_provider =
1120 invalidation::ProfileInvalidationProviderFactory::GetForProfile(profile);
1121 // Chrome OS login and guest profiles do not support invalidation. This is
1122 // fine as they do not have GAIA credentials anyway. http://crbug.com/358169
1123 invalidation::InvalidationService* invalidation_service =
1124 invalidation_provider ? invalidation_provider->GetInvalidationService()
1125 : nullptr;
1126 AccountFetcherServiceFactory::GetForProfile(profile)
1127 ->SetupInvalidations(invalidation_service);
1117 AccountReconcilorFactory::GetForProfile(profile); 1128 AccountReconcilorFactory::GetForProfile(profile);
1118 } 1129 }
1119 1130
1120 void ProfileManager::DoFinalInitLogging(Profile* profile) { 1131 void ProfileManager::DoFinalInitLogging(Profile* profile) {
1121 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitLogging"); 1132 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitLogging");
1122 // Count number of extensions in this profile. 1133 // Count number of extensions in this profile.
1123 int enabled_app_count = -1; 1134 int enabled_app_count = -1;
1124 #if defined(ENABLE_EXTENSIONS) 1135 #if defined(ENABLE_EXTENSIONS)
1125 enabled_app_count = GetEnabledAppCount(profile); 1136 enabled_app_count = GetEnabledAppCount(profile);
1126 #endif 1137 #endif
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 1504
1494 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1505 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1495 if (!original_callback.is_null()) 1506 if (!original_callback.is_null())
1496 original_callback.Run(loaded_profile, status); 1507 original_callback.Run(loaded_profile, status);
1497 } 1508 }
1498 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 1509 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
1499 1510
1500 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1511 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1501 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1512 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1502 } 1513 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698