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

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

Issue 9254003: Merge 118016 - Disable GAIA profile info (Closed) Base URL: svn://svn.chromium.org/chrome/branches/963/src/
Patch Set: Created 8 years, 11 months 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) 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 "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_info_cache.h" 11 #include "chrome/browser/profiles/profile_info_cache.h"
11 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/browser/sync/profile_sync_service.h" 13 #include "chrome/browser/sync/profile_sync_service.h"
13 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
15 #include "content/public/browser/notification_details.h" 17 #include "content/public/browser/notification_details.h"
16 #include "third_party/skia/include/core/SkBitmap.h" 18 #include "third_party/skia/include/core/SkBitmap.h"
17 #include "ui/gfx/image/image.h" 19 #include "ui/gfx/image/image.h"
18 20
19 namespace { 21 namespace {
20 22
21 // Update the user's GAIA info every 24 hours. 23 // Update the user's GAIA info every 24 hours.
22 const int kUpdateIntervalHours = 24; 24 const int kUpdateIntervalHours = 24;
23 25
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // static 58 // static
57 bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) { 59 bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) {
58 #if defined(OS_CHROMEOS) 60 #if defined(OS_CHROMEOS)
59 return false; 61 return false;
60 #endif 62 #endif
61 63
62 // Sync must be allowed. 64 // Sync must be allowed.
63 if (!profile->GetOriginalProfile()->IsSyncAccessible()) 65 if (!profile->GetOriginalProfile()->IsSyncAccessible())
64 return false; 66 return false;
65 67
66 return true; 68 // To enable this feature for testing pass "--gaia-profile-info".
69 if (CommandLine::ForCurrentProcess()->HasSwitch(
70 switches::kGaiaProfileInfo)) {
71 return true;
72 }
73
74 // This feature is disable by default.
75 return false;
67 } 76 }
68 77
69 // static 78 // static
70 void GAIAInfoUpdateService::RegisterUserPrefs(PrefService* prefs) { 79 void GAIAInfoUpdateService::RegisterUserPrefs(PrefService* prefs) {
71 prefs->RegisterInt64Pref( 80 prefs->RegisterInt64Pref(
72 prefs::kProfileGAIAInfoUpdateTime, 0, PrefService::UNSYNCABLE_PREF); 81 prefs::kProfileGAIAInfoUpdateTime, 0, PrefService::UNSYNCABLE_PREF);
73 prefs->RegisterStringPref( 82 prefs->RegisterStringPref(
74 prefs::kProfileGAIAInfoPictureURL, "", PrefService::UNSYNCABLE_PREF); 83 prefs::kProfileGAIAInfoPictureURL, "", PrefService::UNSYNCABLE_PREF);
75 } 84 }
76 85
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 const base::TimeDelta update_delta = base::Time::Now() - last_updated_; 198 const base::TimeDelta update_delta = base::Time::Now() - last_updated_;
190 199
191 base::TimeDelta delta; 200 base::TimeDelta delta;
192 if (update_delta < base::TimeDelta() || update_delta > desired_delta) 201 if (update_delta < base::TimeDelta() || update_delta > desired_delta)
193 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); 202 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds);
194 else 203 else
195 delta = desired_delta - update_delta; 204 delta = desired_delta - update_delta;
196 205
197 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); 206 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update);
198 } 207 }
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