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(PrefService* prefs) { |
82 prefs->RegisterInt64Pref( | 82 prefs->RegisterInt64Pref( |
83 prefs::kProfileGAIAInfoUpdateTime, 0, PrefServiceBase::UNSYNCABLE_PREF); | 83 prefs::kProfileGAIAInfoUpdateTime, 0, PrefServiceBase::UNSYNCABLE_PREF); |
84 prefs->RegisterStringPref( | 84 prefs->RegisterStringPref( |
85 prefs::kProfileGAIAInfoPictureURL, "", PrefServiceBase::UNSYNCABLE_PREF); | 85 prefs::kProfileGAIAInfoPictureURL, "", PrefServiceBase::UNSYNCABLE_PREF); |
86 } | 86 } |
87 | 87 |
88 bool GAIAInfoUpdateService::NeedsProfilePicture() const { | 88 bool GAIAInfoUpdateService::NeedsProfilePicture() const { |
89 return true; | 89 return true; |
90 } | 90 } |
91 | 91 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 const base::TimeDelta update_delta = base::Time::Now() - last_updated_; | 200 const base::TimeDelta update_delta = base::Time::Now() - last_updated_; |
201 | 201 |
202 base::TimeDelta delta; | 202 base::TimeDelta delta; |
203 if (update_delta < base::TimeDelta() || update_delta > desired_delta) | 203 if (update_delta < base::TimeDelta() || update_delta > desired_delta) |
204 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); | 204 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); |
205 else | 205 else |
206 delta = desired_delta - update_delta; | 206 delta = desired_delta - update_delta; |
207 | 207 |
208 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); | 208 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); |
209 } | 209 } |
OLD | NEW |