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

Side by Side Diff: chrome/browser/android/signin/signin_manager_android.cc

Issue 44083005: policy: Remove UserCloudPolicyManagerFactory's dependency on Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/android/signin/signin_manager_android.h" 5 #include "chrome/browser/android/signin/signin_manager_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void SigninManagerAndroid::SignOut(JNIEnv* env, jobject obj) { 129 void SigninManagerAndroid::SignOut(JNIEnv* env, jobject obj) {
130 SigninManagerFactory::GetForProfile(profile_)->SignOut(); 130 SigninManagerFactory::GetForProfile(profile_)->SignOut();
131 } 131 }
132 132
133 base::android::ScopedJavaLocalRef<jstring> 133 base::android::ScopedJavaLocalRef<jstring>
134 SigninManagerAndroid::GetManagementDomain(JNIEnv* env, jobject obj) { 134 SigninManagerAndroid::GetManagementDomain(JNIEnv* env, jobject obj) {
135 base::android::ScopedJavaLocalRef<jstring> domain; 135 base::android::ScopedJavaLocalRef<jstring> domain;
136 136
137 #if defined(ENABLE_CONFIGURATION_POLICY) 137 #if defined(ENABLE_CONFIGURATION_POLICY)
138 policy::UserCloudPolicyManager* manager = 138 policy::UserCloudPolicyManager* manager =
139 policy::UserCloudPolicyManagerFactory::GetForProfile(profile_); 139 policy::UserCloudPolicyManagerFactory::GetForBrowserContext(profile_);
140 policy::CloudPolicyStore* store = manager->core()->store(); 140 policy::CloudPolicyStore* store = manager->core()->store();
141 141
142 if (store && store->is_managed() && store->policy()->has_username()) { 142 if (store && store->is_managed() && store->policy()->has_username()) {
143 domain.Reset( 143 domain.Reset(
144 base::android::ConvertUTF8ToJavaString( 144 base::android::ConvertUTF8ToJavaString(
145 env, gaia::ExtractDomainName(store->policy()->username()))); 145 env, gaia::ExtractDomainName(store->policy()->username())));
146 } 146 }
147 #endif 147 #endif
148 148
149 return domain; 149 return domain;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return !policy::BrowserPolicyConnector::IsNonEnterpriseUser(username); 220 return !policy::BrowserPolicyConnector::IsNonEnterpriseUser(username);
221 #else 221 #else
222 return false; 222 return false;
223 #endif 223 #endif
224 } 224 }
225 225
226 // static 226 // static
227 bool SigninManagerAndroid::Register(JNIEnv* env) { 227 bool SigninManagerAndroid::Register(JNIEnv* env) {
228 return RegisterNativesImpl(env); 228 return RegisterNativesImpl(env);
229 } 229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698