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

Side by Side Diff: chrome/browser/android/profiles/profile_downloader_android.cc

Issue 339223003: [Mirror] Fix wrong logic in GetCachedNameForPrimaryAccount (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | 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 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/android/profiles/profile_downloader_android.h" 5 #include "chrome/browser/android/profiles/profile_downloader_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 "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile_android.h" 10 #include "chrome/browser/profiles/profile_android.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // static 109 // static
110 jstring GetCachedNameForPrimaryAccount(JNIEnv* env, 110 jstring GetCachedNameForPrimaryAccount(JNIEnv* env,
111 jclass clazz, 111 jclass clazz,
112 jobject jprofile) { 112 jobject jprofile) {
113 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); 113 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
114 ProfileInfoInterface& info = 114 ProfileInfoInterface& info =
115 g_browser_process->profile_manager()->GetProfileInfoCache(); 115 g_browser_process->profile_manager()->GetProfileInfoCache();
116 const size_t index = info.GetIndexOfProfileWithPath(profile->GetPath()); 116 const size_t index = info.GetIndexOfProfileWithPath(profile->GetPath());
117 117
118 base::string16 name; 118 base::string16 name;
119 119 if (index != std::string::npos)
120 if (index != std::string::npos &&
121 !info.ProfileIsUsingDefaultNameAtIndex(index)) {
122 name = info.GetGAIANameOfProfileAtIndex(index); 120 name = info.GetGAIANameOfProfileAtIndex(index);
123 if (name.empty())
124 name = info.GetNameOfProfileAtIndex(index);
125 }
126 121
127 return base::android::ConvertUTF16ToJavaString(env, name).Release(); 122 return base::android::ConvertUTF16ToJavaString(env, name).Release();
128 } 123 }
129 124
130 // static 125 // static
131 jobject GetCachedAvatarForPrimaryAccount(JNIEnv* env, 126 jobject GetCachedAvatarForPrimaryAccount(JNIEnv* env,
132 jclass clazz, 127 jclass clazz,
133 jobject jprofile) { 128 jobject jprofile) {
134 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); 129 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
135 ProfileInfoInterface& info = 130 ProfileInfoInterface& info =
(...skipping 26 matching lines...) Expand all
162 base::android::ConvertJavaStringToUTF8(env, jaccount_id); 157 base::android::ConvertJavaStringToUTF8(env, jaccount_id);
163 AccountInfoRetriever* retriever = 158 AccountInfoRetriever* retriever =
164 new AccountInfoRetriever(profile, account_id, image_side_pixels); 159 new AccountInfoRetriever(profile, account_id, image_side_pixels);
165 retriever->Start(); 160 retriever->Start();
166 } 161 }
167 162
168 // static 163 // static
169 bool ProfileDownloaderAndroid::Register(JNIEnv* env) { 164 bool ProfileDownloaderAndroid::Register(JNIEnv* env) {
170 return RegisterNativesImpl(env); 165 return RegisterNativesImpl(env);
171 } 166 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698