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

Side by Side Diff: chrome/browser/invalidation/profile_invalidation_provider_factory.cc

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/invalidation/profile_invalidation_provider_factory.h" 5 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/prefs/pref_registry.h" 8 #include "base/prefs/pref_registry.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/invalidation/ticl_profile_settings_provider.h" 10 #include "chrome/browser/invalidation/ticl_profile_settings_provider.h"
(...skipping 18 matching lines...) Expand all
29 #include "components/signin/core/browser/signin_manager.h" 29 #include "components/signin/core/browser/signin_manager.h"
30 #include "net/url_request/url_request_context_getter.h" 30 #include "net/url_request/url_request_context_getter.h"
31 31
32 #if defined(OS_ANDROID) 32 #if defined(OS_ANDROID)
33 #include "chrome/browser/invalidation/invalidation_controller_android.h" 33 #include "chrome/browser/invalidation/invalidation_controller_android.h"
34 #include "chrome/browser/invalidation/invalidation_service_android.h" 34 #include "chrome/browser/invalidation/invalidation_service_android.h"
35 #endif // defined(OS_ANDROID) 35 #endif // defined(OS_ANDROID)
36 36
37 #if defined(OS_CHROMEOS) 37 #if defined(OS_CHROMEOS)
38 #include "base/files/file_path.h" 38 #include "base/files/file_path.h"
39 #include "chrome/browser/chromeos/login/users/user_manager.h"
40 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 39 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
41 #include "chrome/browser/chromeos/profiles/profile_helper.h" 40 #include "chrome/browser/chromeos/profiles/profile_helper.h"
42 #include "chrome/browser/chromeos/settings/device_identity_provider.h" 41 #include "chrome/browser/chromeos/settings/device_identity_provider.h"
43 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " 42 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h "
43 #include "components/user_manager/user_manager.h"
44 #endif 44 #endif
45 45
46 namespace invalidation { 46 namespace invalidation {
47 47
48 // static 48 // static
49 ProfileInvalidationProvider* ProfileInvalidationProviderFactory::GetForProfile( 49 ProfileInvalidationProvider* ProfileInvalidationProviderFactory::GetForProfile(
50 Profile* profile) { 50 Profile* profile) {
51 #if defined(OS_CHROMEOS) 51 #if defined(OS_CHROMEOS)
52 // Using ProfileHelper::GetSigninProfile() here would lead to an infinite loop 52 // Using ProfileHelper::GetSigninProfile() here would lead to an infinite loop
53 // when this method is called during the creation of the sign-in profile 53 // when this method is called during the creation of the sign-in profile
54 // itself. Using ProfileHelper::GetSigninProfileDir() is safe because it does 54 // itself. Using ProfileHelper::GetSigninProfileDir() is safe because it does
55 // not try to access the sign-in profile. 55 // not try to access the sign-in profile.
56 if (profile->GetPath() == chromeos::ProfileHelper::GetSigninProfileDir()|| 56 if (profile->GetPath() == chromeos::ProfileHelper::GetSigninProfileDir() ||
57 (chromeos::UserManager::IsInitialized() && 57 (user_manager::UserManager::IsInitialized() &&
58 chromeos::UserManager::Get()->IsLoggedInAsGuest())) { 58 user_manager::UserManager::Get()->IsLoggedInAsGuest())) {
59 // The Chrome OS login and Chrome OS guest profiles do not have GAIA 59 // The Chrome OS login and Chrome OS guest profiles do not have GAIA
60 // credentials and do not support invalidation. 60 // credentials and do not support invalidation.
61 return NULL; 61 return NULL;
62 } 62 }
63 #endif 63 #endif
64 return static_cast<ProfileInvalidationProvider*>( 64 return static_cast<ProfileInvalidationProvider*>(
65 GetInstance()->GetServiceForBrowserContext(profile, true)); 65 GetInstance()->GetServiceForBrowserContext(profile, true));
66 } 66 }
67 67
68 // static 68 // static
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return new ProfileInvalidationProvider(scoped_ptr<InvalidationService>( 103 return new ProfileInvalidationProvider(scoped_ptr<InvalidationService>(
104 new InvalidationServiceAndroid(profile, 104 new InvalidationServiceAndroid(profile,
105 new InvalidationControllerAndroid()))); 105 new InvalidationControllerAndroid())));
106 #else 106 #else
107 107
108 scoped_ptr<IdentityProvider> identity_provider; 108 scoped_ptr<IdentityProvider> identity_provider;
109 109
110 #if defined(OS_CHROMEOS) 110 #if defined(OS_CHROMEOS)
111 policy::BrowserPolicyConnectorChromeOS* connector = 111 policy::BrowserPolicyConnectorChromeOS* connector =
112 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 112 g_browser_process->platform_part()->browser_policy_connector_chromeos();
113 if (chromeos::UserManager::IsInitialized() && 113 if (user_manager::UserManager::IsInitialized() &&
114 chromeos::UserManager::Get()->IsLoggedInAsKioskApp() && 114 user_manager::UserManager::Get()->IsLoggedInAsKioskApp() &&
115 connector->IsEnterpriseManaged()) { 115 connector->IsEnterpriseManaged()) {
116 identity_provider.reset(new chromeos::DeviceIdentityProvider( 116 identity_provider.reset(new chromeos::DeviceIdentityProvider(
117 chromeos::DeviceOAuth2TokenServiceFactory::Get())); 117 chromeos::DeviceOAuth2TokenServiceFactory::Get()));
118 } 118 }
119 #endif 119 #endif
120 120
121 if (!identity_provider) { 121 if (!identity_provider) {
122 identity_provider.reset(new ProfileIdentityProvider( 122 identity_provider.reset(new ProfileIdentityProvider(
123 SigninManagerFactory::GetForProfile(profile), 123 SigninManagerFactory::GetForProfile(profile),
124 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 124 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
(...skipping 17 matching lines...) Expand all
142 void ProfileInvalidationProviderFactory::RegisterProfilePrefs( 142 void ProfileInvalidationProviderFactory::RegisterProfilePrefs(
143 user_prefs::PrefRegistrySyncable* registry) { 143 user_prefs::PrefRegistrySyncable* registry) {
144 registry->RegisterBooleanPref( 144 registry->RegisterBooleanPref(
145 prefs::kInvalidationServiceUseGCMChannel, 145 prefs::kInvalidationServiceUseGCMChannel,
146 false, 146 false,
147 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 147 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
148 InvalidatorStorage::RegisterProfilePrefs(registry); 148 InvalidatorStorage::RegisterProfilePrefs(registry);
149 } 149 }
150 150
151 } // namespace invalidation 151 } // namespace invalidation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698