/chromium-webcl/src/chrome/browser/profiles/gaia_info_update_service_factory.cc

https://bitbucket.org/peixuan/chromium_r197479_base · C++ · 51 lines · 37 code · 9 blank · 5 comment · 1 complexity · fd8b93cb1a6e27b0d926b2c414f2f94a MD5 · raw file

  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
  3. // found in the LICENSE file.
  4. #include "chrome/browser/profiles/gaia_info_update_service_factory.h"
  5. #include "chrome/browser/profiles/gaia_info_update_service.h"
  6. #include "chrome/browser/profiles/profile.h"
  7. #include "chrome/browser/profiles/profile_dependency_manager.h"
  8. #include "chrome/common/pref_names.h"
  9. #include "components/user_prefs/pref_registry_syncable.h"
  10. GAIAInfoUpdateServiceFactory::GAIAInfoUpdateServiceFactory()
  11. : ProfileKeyedServiceFactory("GAIAInfoUpdateService",
  12. ProfileDependencyManager::GetInstance()) {
  13. }
  14. GAIAInfoUpdateServiceFactory::~GAIAInfoUpdateServiceFactory() {}
  15. // static
  16. GAIAInfoUpdateService* GAIAInfoUpdateServiceFactory::GetForProfile(
  17. Profile* profile) {
  18. return static_cast<GAIAInfoUpdateService*>(
  19. GetInstance()->GetServiceForProfile(profile, true));
  20. }
  21. // static
  22. GAIAInfoUpdateServiceFactory* GAIAInfoUpdateServiceFactory::GetInstance() {
  23. return Singleton<GAIAInfoUpdateServiceFactory>::get();
  24. }
  25. ProfileKeyedService* GAIAInfoUpdateServiceFactory::BuildServiceInstanceFor(
  26. content::BrowserContext* context) const {
  27. Profile* profile = static_cast<Profile*>(context);
  28. if (!GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile))
  29. return NULL;
  30. return new GAIAInfoUpdateService(profile);
  31. }
  32. void GAIAInfoUpdateServiceFactory::RegisterUserPrefs(
  33. PrefRegistrySyncable* prefs) {
  34. prefs->RegisterInt64Pref(prefs::kProfileGAIAInfoUpdateTime, 0,
  35. PrefRegistrySyncable::UNSYNCABLE_PREF);
  36. prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL,
  37. std::string(),
  38. PrefRegistrySyncable::UNSYNCABLE_PREF);
  39. }
  40. bool GAIAInfoUpdateServiceFactory::ServiceIsNULLWhileTesting() const {
  41. return true;
  42. }