| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 if (CommandLine::ForCurrentProcess()->HasSwitch( | 71 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 72 switches::kGaiaProfileInfo)) { | 72 switches::kGaiaProfileInfo)) { |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 | 75 |
| 76 // This feature is disable by default. | 76 // This feature is disable by default. |
| 77 return false; | 77 return false; |
| 78 } | 78 } |
| 79 | 79 |
| 80 // static | 80 // static |
| 81 void GAIAInfoUpdateService::RegisterUserPrefs(PrefServiceBase* prefs) { | 81 void GAIAInfoUpdateService::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
| 82 prefs->RegisterInt64Pref( | 82 prefs->RegisterInt64Pref(prefs::kProfileGAIAInfoUpdateTime, |
| 83 prefs::kProfileGAIAInfoUpdateTime, 0, PrefServiceBase::UNSYNCABLE_PREF); | 83 0, |
| 84 prefs->RegisterStringPref( | 84 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 85 prefs::kProfileGAIAInfoPictureURL, "", PrefServiceBase::UNSYNCABLE_PREF); | 85 prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL, |
| 86 "", |
| 87 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 86 } | 88 } |
| 87 | 89 |
| 88 bool GAIAInfoUpdateService::NeedsProfilePicture() const { | 90 bool GAIAInfoUpdateService::NeedsProfilePicture() const { |
| 89 return true; | 91 return true; |
| 90 } | 92 } |
| 91 | 93 |
| 92 int GAIAInfoUpdateService::GetDesiredImageSideLength() const { | 94 int GAIAInfoUpdateService::GetDesiredImageSideLength() const { |
| 93 return 256; | 95 return 256; |
| 94 } | 96 } |
| 95 | 97 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 const base::TimeDelta update_delta = base::Time::Now() - last_updated_; | 203 const base::TimeDelta update_delta = base::Time::Now() - last_updated_; |
| 202 | 204 |
| 203 base::TimeDelta delta; | 205 base::TimeDelta delta; |
| 204 if (update_delta < base::TimeDelta() || update_delta > desired_delta) | 206 if (update_delta < base::TimeDelta() || update_delta > desired_delta) |
| 205 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); | 207 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); |
| 206 else | 208 else |
| 207 delta = desired_delta - update_delta; | 209 delta = desired_delta - update_delta; |
| 208 | 210 |
| 209 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); | 211 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); |
| 210 } | 212 } |
| OLD | NEW |