| 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/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
| 17 #include "chrome/browser/sync/profile_sync_service.h" | |
| 18 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 19 #include "components/signin/core/common/profile_management_switches.h" | 18 #include "components/signin/core/common/profile_management_switches.h" |
| 20 #include "content/public/browser/notification_details.h" | 19 #include "content/public/browser/notification_details.h" |
| 21 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
| 22 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
| 23 | 22 |
| 24 namespace { | 23 namespace { |
| 25 | 24 |
| 26 // Update the user's GAIA info every 24 hours. | 25 // Update the user's GAIA info every 24 hours. |
| 27 const int kUpdateIntervalHours = 24; | 26 const int kUpdateIntervalHours = 24; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 profile_image_downloader_.reset(new ProfileDownloader(this)); | 62 profile_image_downloader_.reset(new ProfileDownloader(this)); |
| 64 profile_image_downloader_->Start(); | 63 profile_image_downloader_->Start(); |
| 65 } | 64 } |
| 66 | 65 |
| 67 // static | 66 // static |
| 68 bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) { | 67 bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) { |
| 69 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
| 70 return false; | 69 return false; |
| 71 #endif | 70 #endif |
| 72 | 71 |
| 73 // Sync must be allowed. | |
| 74 if (!profile->GetOriginalProfile()->IsSyncAccessible()) | |
| 75 return false; | |
| 76 | |
| 77 // To enable this feature for testing pass "--google-profile-info". | 72 // To enable this feature for testing pass "--google-profile-info". |
| 78 if (switches::IsGoogleProfileInfo()) | 73 if (switches::IsGoogleProfileInfo()) |
| 79 return true; | 74 return true; |
| 80 | 75 |
| 81 // This feature is disable by default. | 76 // This feature is disable by default. |
| 82 return false; | 77 return false; |
| 83 } | 78 } |
| 84 | 79 |
| 85 bool GAIAInfoUpdateService::NeedsProfilePicture() const { | 80 bool GAIAInfoUpdateService::NeedsProfilePicture() const { |
| 86 return true; | 81 return true; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 const std::string& account_id, | 213 const std::string& account_id, |
| 219 const std::string& username, | 214 const std::string& username, |
| 220 const std::string& password) { | 215 const std::string& password) { |
| 221 OnUsernameChanged(username); | 216 OnUsernameChanged(username); |
| 222 } | 217 } |
| 223 | 218 |
| 224 void GAIAInfoUpdateService::GoogleSignedOut(const std::string& account_id, | 219 void GAIAInfoUpdateService::GoogleSignedOut(const std::string& account_id, |
| 225 const std::string& username) { | 220 const std::string& username) { |
| 226 OnUsernameChanged(std::string()); | 221 OnUsernameChanged(std::string()); |
| 227 } | 222 } |
| OLD | NEW |