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

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

Issue 255013004: Refactor code to clear last signed-in user. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « chrome/browser/android/signin/signin_manager_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 195
196 #endif 196 #endif
197 197
198 void SigninManagerAndroid::OnBrowsingDataRemoverDone() { 198 void SigninManagerAndroid::OnBrowsingDataRemoverDone() {
199 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_); 199 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_);
200 model->RemoveAll(); 200 model->RemoveAll();
201 201
202 // All the Profile data has been wiped. Clear the last signed in username as 202 // All the Profile data has been wiped. Clear the last signed in username as
203 // well, so that the next signin doesn't trigger the acount change dialog. 203 // well, so that the next signin doesn't trigger the acount change dialog.
204 profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesLastUsername); 204 ClearLastSignedInUser();
205 205
206 Java_SigninManager_onProfileDataWiped(base::android::AttachCurrentThread(), 206 Java_SigninManager_onProfileDataWiped(base::android::AttachCurrentThread(),
207 java_signin_manager_.obj()); 207 java_signin_manager_.obj());
208 } 208 }
209 209
210 void SigninManagerAndroid::ClearLastSignedInUser(JNIEnv* env, jobject obj) {
nyquist 2014/04/29 17:18:47 I was under impression that the style guide said n
acleung1 2014/04/29 21:45:54 I can't seem to find that in the style guide. The
nyquist 2014/04/29 22:14:54 Ah. That might be it. Or that I was reading the "o
211 ClearLastSignedInUser();
212 }
213
214 void SigninManagerAndroid::ClearLastSignedInUser() {
215 profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesLastUsername);
216 }
217
210 void SigninManagerAndroid::MergeSessionCompleted( 218 void SigninManagerAndroid::MergeSessionCompleted(
211 const std::string& account_id, 219 const std::string& account_id,
212 const GoogleServiceAuthError& error) { 220 const GoogleServiceAuthError& error) {
213 merge_session_helper_->RemoveObserver(this); 221 merge_session_helper_->RemoveObserver(this);
214 merge_session_helper_.reset(); 222 merge_session_helper_.reset();
215 } 223 }
216 224
217 void SigninManagerAndroid::LogInSignedInUser(JNIEnv* env, jobject obj) { 225 void SigninManagerAndroid::LogInSignedInUser(JNIEnv* env, jobject obj) {
218 SigninManagerBase* signin_manager = 226 SigninManagerBase* signin_manager =
219 SigninManagerFactory::GetForProfile(profile_); 227 SigninManagerFactory::GetForProfile(profile_);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 269 }
262 270
263 static jboolean IsNewProfileManagementEnabled(JNIEnv* env, jclass clazz) { 271 static jboolean IsNewProfileManagementEnabled(JNIEnv* env, jclass clazz) {
264 return switches::IsNewProfileManagement(); 272 return switches::IsNewProfileManagement();
265 } 273 }
266 274
267 // static 275 // static
268 bool SigninManagerAndroid::Register(JNIEnv* env) { 276 bool SigninManagerAndroid::Register(JNIEnv* env) {
269 return RegisterNativesImpl(env); 277 return RegisterNativesImpl(env);
270 } 278 }
OLDNEW
« no previous file with comments | « chrome/browser/android/signin/signin_manager_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698