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

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: 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/common/chrome_switches.h » ('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" 7 #include "base/command_line.h"
Robert Sesek 2011/11/30 17:50:36 nit: remove this too
sail 2011/11/30 19:03:23 Done.
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"
11 #include "chrome/browser/profiles/profile_info_cache.h" 11 #include "chrome/browser/profiles/profile_info_cache.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/sync/profile_sync_service.h" 13 #include "chrome/browser/sync/profile_sync_service.h"
14 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
17 #include "content/public/browser/notification_details.h" 16 #include "content/public/browser/notification_details.h"
18 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
19 #include "ui/gfx/image/image.h" 18 #include "ui/gfx/image/image.h"
20 19
21 namespace { 20 namespace {
22 21
23 // Update the user's GAIA info every 24 hours. 22 // Update the user's GAIA info every 24 hours.
24 const int kUpdateIntervalHours = 24; 23 const int kUpdateIntervalHours = 24;
25 24
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // static 57 // static
59 bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) { 58 bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) {
60 #if defined(OS_CHROMEOS) 59 #if defined(OS_CHROMEOS)
61 return false; 60 return false;
62 #endif 61 #endif
63 62
64 // Sync must be allowed. 63 // Sync must be allowed.
65 if (!profile->GetOriginalProfile()->IsSyncAccessible()) 64 if (!profile->GetOriginalProfile()->IsSyncAccessible())
66 return false; 65 return false;
67 66
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; 67 return true;
75 } 68 }
76 69
77 // static 70 // static
78 void GAIAInfoUpdateService::RegisterUserPrefs(PrefService* prefs) { 71 void GAIAInfoUpdateService::RegisterUserPrefs(PrefService* prefs) {
79 prefs->RegisterInt64Pref( 72 prefs->RegisterInt64Pref(
80 prefs::kProfileGAIAInfoUpdateTime, 0, PrefService::UNSYNCABLE_PREF); 73 prefs::kProfileGAIAInfoUpdateTime, 0, PrefService::UNSYNCABLE_PREF);
81 } 74 }
82 75
83 int GAIAInfoUpdateService::GetDesiredImageSideLength() { 76 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_; 159 const base::TimeDelta update_delta = base::Time::Now() - last_updated_;
167 160
168 base::TimeDelta delta; 161 base::TimeDelta delta;
169 if (update_delta < base::TimeDelta() || update_delta > desired_delta) 162 if (update_delta < base::TimeDelta() || update_delta > desired_delta)
170 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); 163 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds);
171 else 164 else
172 delta = desired_delta - update_delta; 165 delta = desired_delta - update_delta;
173 166
174 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); 167 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update);
175 } 168 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698