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

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

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. Created 8 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
OLDNEW
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 #ifndef CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_
6 #define CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_ 6 #define CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/prefs/public/pref_member.h" 11 #include "base/prefs/public/pref_member.h"
12 #include "base/timer.h" 12 #include "base/timer.h"
13 #include "chrome/browser/profiles/profile_downloader.h" 13 #include "chrome/browser/profiles/profile_downloader.h"
14 #include "chrome/browser/profiles/profile_downloader_delegate.h" 14 #include "chrome/browser/profiles/profile_downloader_delegate.h"
15 15
16 class PrefServiceSyncable;
16 class Profile; 17 class Profile;
17 class ProfileDownloader; 18 class ProfileDownloader;
18 19
19 // This service kicks off a download of the user's name and profile picture. 20 // This service kicks off a download of the user's name and profile picture.
20 // The results are saved in the profile info cache. 21 // The results are saved in the profile info cache.
21 class GAIAInfoUpdateService : public ProfileDownloaderDelegate { 22 class GAIAInfoUpdateService : public ProfileDownloaderDelegate {
22 public: 23 public:
23 explicit GAIAInfoUpdateService(Profile* profile); 24 explicit GAIAInfoUpdateService(Profile* profile);
24 virtual ~GAIAInfoUpdateService(); 25 virtual ~GAIAInfoUpdateService();
25 26
26 // Updates the GAIA info for the profile associated with this instance. 27 // Updates the GAIA info for the profile associated with this instance.
27 virtual void Update(); 28 virtual void Update();
28 29
29 // Checks if downloading GAIA info for the given profile is allowed. 30 // Checks if downloading GAIA info for the given profile is allowed.
30 static bool ShouldUseGAIAProfileInfo(Profile* profile); 31 static bool ShouldUseGAIAProfileInfo(Profile* profile);
31 32
32 // Register prefs for a profile. 33 // Register prefs for a profile.
33 static void RegisterUserPrefs(PrefServiceBase* prefs); 34 static void RegisterUserPrefs(PrefServiceSyncable* prefs);
34 35
35 // ProfileDownloaderDelegate: 36 // ProfileDownloaderDelegate:
36 virtual bool NeedsProfilePicture() const OVERRIDE; 37 virtual bool NeedsProfilePicture() const OVERRIDE;
37 virtual int GetDesiredImageSideLength() const OVERRIDE; 38 virtual int GetDesiredImageSideLength() const OVERRIDE;
38 virtual Profile* GetBrowserProfile() OVERRIDE; 39 virtual Profile* GetBrowserProfile() OVERRIDE;
39 virtual std::string GetCachedPictureURL() const OVERRIDE; 40 virtual std::string GetCachedPictureURL() const OVERRIDE;
40 virtual void OnProfileDownloadSuccess(ProfileDownloader* downloader) OVERRIDE; 41 virtual void OnProfileDownloadSuccess(ProfileDownloader* downloader) OVERRIDE;
41 virtual void OnProfileDownloadFailure( 42 virtual void OnProfileDownloadFailure(
42 ProfileDownloader* downloader, 43 ProfileDownloader* downloader,
43 ProfileDownloaderDelegate::FailureReason reason) OVERRIDE; 44 ProfileDownloaderDelegate::FailureReason reason) OVERRIDE;
44 45
45 private: 46 private:
46 FRIEND_TEST_ALL_PREFIXES(GAIAInfoUpdateServiceTest, ScheduleUpdate); 47 FRIEND_TEST_ALL_PREFIXES(GAIAInfoUpdateServiceTest, ScheduleUpdate);
47 48
48 void OnUsernameChanged(); 49 void OnUsernameChanged();
49 void ScheduleNextUpdate(); 50 void ScheduleNextUpdate();
50 51
51 Profile* profile_; 52 Profile* profile_;
52 scoped_ptr<ProfileDownloader> profile_image_downloader_; 53 scoped_ptr<ProfileDownloader> profile_image_downloader_;
53 StringPrefMember username_pref_; 54 StringPrefMember username_pref_;
54 base::Time last_updated_; 55 base::Time last_updated_;
55 base::OneShotTimer<GAIAInfoUpdateService> timer_; 56 base::OneShotTimer<GAIAInfoUpdateService> timer_;
56 57
57 DISALLOW_COPY_AND_ASSIGN(GAIAInfoUpdateService); 58 DISALLOW_COPY_AND_ASSIGN(GAIAInfoUpdateService);
58 }; 59 };
59 60
60 #endif // CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_ 61 #endif // CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/chrome_version_service.cc ('k') | chrome/browser/profiles/gaia_info_update_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698