OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 int GAIAInfoUpdateService::GetDesiredImageSideLength() { | 83 int GAIAInfoUpdateService::GetDesiredImageSideLength() { |
84 return 256; | 84 return 256; |
85 } | 85 } |
86 | 86 |
87 Profile* GAIAInfoUpdateService::GetBrowserProfile() { | 87 Profile* GAIAInfoUpdateService::GetBrowserProfile() { |
88 return profile_; | 88 return profile_; |
89 } | 89 } |
90 | 90 |
91 bool GAIAInfoUpdateService::GetShouldUseOAuthRefreshToken() { | |
92 return true; | |
93 } | |
94 | |
95 void GAIAInfoUpdateService::OnDownloadComplete(ProfileDownloader* downloader, | 91 void GAIAInfoUpdateService::OnDownloadComplete(ProfileDownloader* downloader, |
96 bool success) { | 92 bool success) { |
97 // Save the last updated time. | 93 // Save the last updated time. |
98 last_updated_ = base::Time::Now(); | 94 last_updated_ = base::Time::Now(); |
99 profile_->GetPrefs()->SetInt64(prefs::kProfileGAIAInfoUpdateTime, | 95 profile_->GetPrefs()->SetInt64(prefs::kProfileGAIAInfoUpdateTime, |
100 last_updated_.ToInternalValue()); | 96 last_updated_.ToInternalValue()); |
101 ScheduleNextUpdate(); | 97 ScheduleNextUpdate(); |
102 | 98 |
103 if (!success) { | 99 if (!success) { |
104 profile_image_downloader_.reset(); | 100 profile_image_downloader_.reset(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 const base::TimeDelta update_delta = base::Time::Now() - last_updated_; | 166 const base::TimeDelta update_delta = base::Time::Now() - last_updated_; |
171 | 167 |
172 base::TimeDelta delta; | 168 base::TimeDelta delta; |
173 if (update_delta < base::TimeDelta() || update_delta > desired_delta) | 169 if (update_delta < base::TimeDelta() || update_delta > desired_delta) |
174 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); | 170 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); |
175 else | 171 else |
176 delta = desired_delta - update_delta; | 172 delta = desired_delta - update_delta; |
177 | 173 |
178 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); | 174 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); |
179 } | 175 } |
OLD | NEW |