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/profiles/gaia_info_update_service.h" | 5 #include "chrome/browser/profiles/gaia_info_update_service.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/profiles/profile_info_cache.h" | 12 #include "chrome/browser/profiles/profile_info_cache.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/browser/profiles/profile_metrics.h" | 14 #include "chrome/browser/profiles/profile_metrics.h" |
15 #include "chrome/browser/profiles/profiles_state.h" | 15 #include "chrome/browser/profiles/profiles_state.h" |
| 16 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
16 #include "chrome/browser/signin/signin_manager_factory.h" | 17 #include "chrome/browser/signin/signin_manager_factory.h" |
17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
18 #include "components/signin/core/common/profile_management_switches.h" | 19 #include "components/signin/core/common/profile_management_switches.h" |
19 #include "content/public/browser/notification_details.h" | 20 #include "content/public/browser/notification_details.h" |
20 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
21 #include "ui/gfx/image/image.h" | 22 #include "ui/gfx/image/image.h" |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 // Update the user's GAIA info every 24 hours. | 26 // Update the user's GAIA info every 24 hours. |
(...skipping 26 matching lines...) Expand all Loading... |
52 ProfileMetrics::LogNumberOfProfiles(g_browser_process->profile_manager()); | 53 ProfileMetrics::LogNumberOfProfiles(g_browser_process->profile_manager()); |
53 | 54 |
54 // The user must be logged in. | 55 // The user must be logged in. |
55 SigninManagerBase* signin_manager = | 56 SigninManagerBase* signin_manager = |
56 SigninManagerFactory::GetForProfile(profile_); | 57 SigninManagerFactory::GetForProfile(profile_); |
57 if (!signin_manager->IsAuthenticated()) | 58 if (!signin_manager->IsAuthenticated()) |
58 return; | 59 return; |
59 | 60 |
60 if (profile_image_downloader_) | 61 if (profile_image_downloader_) |
61 return; | 62 return; |
62 profile_image_downloader_.reset(new ProfileDownloader(this)); | 63 profile_image_downloader_.reset( |
| 64 new ProfileDownloader(this, |
| 65 ChromeSigninClientFactory::GetForProfile(profile_))); |
63 profile_image_downloader_->Start(); | 66 profile_image_downloader_->Start(); |
64 } | 67 } |
65 | 68 |
66 // static | 69 // static |
67 bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) { | 70 bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) { |
68 #if defined(OS_CHROMEOS) | 71 #if defined(OS_CHROMEOS) |
69 return false; | 72 return false; |
70 #endif | 73 #endif |
71 | 74 |
72 // To enable this feature for testing pass "--google-profile-info". | 75 // To enable this feature for testing pass "--google-profile-info". |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 const std::string& account_id, | 216 const std::string& account_id, |
214 const std::string& username, | 217 const std::string& username, |
215 const std::string& password) { | 218 const std::string& password) { |
216 OnUsernameChanged(username); | 219 OnUsernameChanged(username); |
217 } | 220 } |
218 | 221 |
219 void GAIAInfoUpdateService::GoogleSignedOut(const std::string& account_id, | 222 void GAIAInfoUpdateService::GoogleSignedOut(const std::string& account_id, |
220 const std::string& username) { | 223 const std::string& username) { |
221 OnUsernameChanged(std::string()); | 224 OnUsernameChanged(std::string()); |
222 } | 225 } |
OLD | NEW |