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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // To enable this feature for testing pass "--gaia-profile-info". | 70 // To enable this feature for testing pass "--gaia-profile-info". |
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 | |
81 void GAIAInfoUpdateService::RegisterUserPrefs(PrefServiceSyncable* prefs) { | |
82 prefs->RegisterInt64Pref(prefs::kProfileGAIAInfoUpdateTime, | |
83 0, | |
84 PrefServiceSyncable::UNSYNCABLE_PREF); | |
85 prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL, | |
86 "", | |
87 PrefServiceSyncable::UNSYNCABLE_PREF); | |
88 } | |
89 | |
90 bool GAIAInfoUpdateService::NeedsProfilePicture() const { | 80 bool GAIAInfoUpdateService::NeedsProfilePicture() const { |
91 return true; | 81 return true; |
92 } | 82 } |
93 | 83 |
94 int GAIAInfoUpdateService::GetDesiredImageSideLength() const { | 84 int GAIAInfoUpdateService::GetDesiredImageSideLength() const { |
95 return 256; | 85 return 256; |
96 } | 86 } |
97 | 87 |
98 Profile* GAIAInfoUpdateService::GetBrowserProfile() { | 88 Profile* GAIAInfoUpdateService::GetBrowserProfile() { |
99 return profile_; | 89 return profile_; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 const base::TimeDelta update_delta = base::Time::Now() - last_updated_; | 193 const base::TimeDelta update_delta = base::Time::Now() - last_updated_; |
204 | 194 |
205 base::TimeDelta delta; | 195 base::TimeDelta delta; |
206 if (update_delta < base::TimeDelta() || update_delta > desired_delta) | 196 if (update_delta < base::TimeDelta() || update_delta > desired_delta) |
207 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); | 197 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); |
208 else | 198 else |
209 delta = desired_delta - update_delta; | 199 delta = desired_delta - update_delta; |
210 | 200 |
211 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); | 201 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); |
212 } | 202 } |
OLD | NEW |