Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: chrome/browser/profiles/gaia_info_update_service.cc

Issue 8743007: Enable GAIA profile info downloader by default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/profiles/gaia_info_update_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
8 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_info_cache.h" 10 #include "chrome/browser/profiles/profile_info_cache.h"
12 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/sync/profile_sync_service.h" 12 #include "chrome/browser/sync/profile_sync_service.h"
14 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
17 #include "content/public/browser/notification_details.h" 15 #include "content/public/browser/notification_details.h"
18 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
19 #include "ui/gfx/image/image.h" 17 #include "ui/gfx/image/image.h"
20 18
21 namespace { 19 namespace {
22 20
23 // Update the user's GAIA info every 24 hours. 21 // Update the user's GAIA info every 24 hours.
24 const int kUpdateIntervalHours = 24; 22 const int kUpdateIntervalHours = 24;
25 23
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // static 56 // static
59 bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) { 57 bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) {
60 #if defined(OS_CHROMEOS) 58 #if defined(OS_CHROMEOS)
61 return false; 59 return false;
62 #endif 60 #endif
63 61
64 // Sync must be allowed. 62 // Sync must be allowed.
65 if (!profile->GetOriginalProfile()->IsSyncAccessible()) 63 if (!profile->GetOriginalProfile()->IsSyncAccessible())
66 return false; 64 return false;
67 65
68 // TODO(sail): For now put this feature behind a flag.
69 if (!CommandLine::ForCurrentProcess()->HasSwitch(
70 switches::kGaiaProfileInfo)) {
71 return false;
72 }
73
74 return true; 66 return true;
75 } 67 }
76 68
77 // static 69 // static
78 void GAIAInfoUpdateService::RegisterUserPrefs(PrefService* prefs) { 70 void GAIAInfoUpdateService::RegisterUserPrefs(PrefService* prefs) {
79 prefs->RegisterInt64Pref( 71 prefs->RegisterInt64Pref(
80 prefs::kProfileGAIAInfoUpdateTime, 0, PrefService::UNSYNCABLE_PREF); 72 prefs::kProfileGAIAInfoUpdateTime, 0, PrefService::UNSYNCABLE_PREF);
81 } 73 }
82 74
83 int GAIAInfoUpdateService::GetDesiredImageSideLength() { 75 int GAIAInfoUpdateService::GetDesiredImageSideLength() {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 const base::TimeDelta update_delta = base::Time::Now() - last_updated_; 158 const base::TimeDelta update_delta = base::Time::Now() - last_updated_;
167 159
168 base::TimeDelta delta; 160 base::TimeDelta delta;
169 if (update_delta < base::TimeDelta() || update_delta > desired_delta) 161 if (update_delta < base::TimeDelta() || update_delta > desired_delta)
170 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); 162 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds);
171 else 163 else
172 delta = desired_delta - update_delta; 164 delta = desired_delta - update_delta;
173 165
174 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); 166 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update);
175 } 167 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/gaia_info_update_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698