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

Side by Side Diff: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc

Issue 114883004: Add base:: namespace to straggling string16s left in chrome/browser/ui. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: found more Created 7 years 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 | « chrome/browser/ui/webui/performance_monitor/performance_monitor_l10n.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/ui/webui/signin/user_manager_screen_handler.h" 5 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/value_conversions.h" 8 #include "base/value_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 info_cache.IsUsingGAIAPictureOfProfileAtIndex(index) && 85 info_cache.IsUsingGAIAPictureOfProfileAtIndex(index) &&
86 info_cache.GetGAIAPictureOfProfileAtIndex(index); 86 info_cache.GetGAIAPictureOfProfileAtIndex(index);
87 87
88 gfx::Image icon = profiles::GetSizedAvatarIconWithBorder( 88 gfx::Image icon = profiles::GetSizedAvatarIconWithBorder(
89 info_cache.GetAvatarIconOfProfileAtIndex(index), 89 info_cache.GetAvatarIconOfProfileAtIndex(index),
90 is_gaia_picture, kAvatarIconSize, kAvatarIconSize); 90 is_gaia_picture, kAvatarIconSize, kAvatarIconSize);
91 return webui::GetBitmapDataUrl(icon.AsBitmap()); 91 return webui::GetBitmapDataUrl(icon.AsBitmap());
92 } 92 }
93 93
94 size_t GetIndexOfProfileWithEmailAndName(const ProfileInfoCache& info_cache, 94 size_t GetIndexOfProfileWithEmailAndName(const ProfileInfoCache& info_cache,
95 const string16& email, 95 const base::string16& email,
96 const string16& name) { 96 const base::string16& name) {
97 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) { 97 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) {
98 if (info_cache.GetUserNameOfProfileAtIndex(i) == email && 98 if (info_cache.GetUserNameOfProfileAtIndex(i) == email &&
99 info_cache.GetNameOfProfileAtIndex(i) == name) { 99 info_cache.GetNameOfProfileAtIndex(i) == name) {
100 return i; 100 return i;
101 } 101 }
102 } 102 }
103 return std::string::npos; 103 return std::string::npos;
104 } 104 }
105 105
106 } // namespace 106 } // namespace
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 web_ui()->GetWebContents()->GetView()->GetNativeView()); 183 web_ui()->GetWebContents()->GetView()->GetNativeView());
184 } 184 }
185 185
186 void UserManagerScreenHandler::HandleAddUser(const base::ListValue* args) { 186 void UserManagerScreenHandler::HandleAddUser(const base::ListValue* args) {
187 profiles::CreateAndSwitchToNewProfile(desktop_type_, 187 profiles::CreateAndSwitchToNewProfile(desktop_type_,
188 base::Bind(&chrome::HideUserManager)); 188 base::Bind(&chrome::HideUserManager));
189 } 189 }
190 190
191 void UserManagerScreenHandler::HandleAuthenticatedLaunchUser( 191 void UserManagerScreenHandler::HandleAuthenticatedLaunchUser(
192 const base::ListValue* args) { 192 const base::ListValue* args) {
193 string16 email_address; 193 base::string16 email_address;
194 if (!args->GetString(0, &email_address)) 194 if (!args->GetString(0, &email_address))
195 return; 195 return;
196 196
197 string16 display_name; 197 base::string16 display_name;
198 if (!args->GetString(1, &display_name)) 198 if (!args->GetString(1, &display_name))
199 return; 199 return;
200 200
201 std::string password; 201 std::string password;
202 if (!args->GetString(2, &password)) 202 if (!args->GetString(2, &password))
203 return; 203 return;
204 204
205 ProfileInfoCache& info_cache = 205 ProfileInfoCache& info_cache =
206 g_browser_process->profile_manager()->GetProfileInfoCache(); 206 g_browser_process->profile_manager()->GetProfileInfoCache();
207 size_t profile_index = GetIndexOfProfileWithEmailAndName( 207 size_t profile_index = GetIndexOfProfileWithEmailAndName(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 profile_path, 249 profile_path,
250 base::Bind(&OpenNewWindowForProfile, desktop_type_)); 250 base::Bind(&OpenNewWindowForProfile, desktop_type_));
251 } 251 }
252 252
253 void UserManagerScreenHandler::HandleLaunchGuest(const base::ListValue* args) { 253 void UserManagerScreenHandler::HandleLaunchGuest(const base::ListValue* args) {
254 profiles::SwitchToGuestProfile(desktop_type_, 254 profiles::SwitchToGuestProfile(desktop_type_,
255 base::Bind(&chrome::HideUserManager)); 255 base::Bind(&chrome::HideUserManager));
256 } 256 }
257 257
258 void UserManagerScreenHandler::HandleLaunchUser(const base::ListValue* args) { 258 void UserManagerScreenHandler::HandleLaunchUser(const base::ListValue* args) {
259 base::string16 emailAddress; 259 base::string16 email_address;
260 base::string16 displayName; 260 base::string16 display_name;
261 261
262 if (!args->GetString(0, &emailAddress) || 262 if (!args->GetString(0, &email_address) ||
263 !args->GetString(1, &displayName)) { 263 !args->GetString(1, &display_name)) {
264 NOTREACHED(); 264 NOTREACHED();
265 return; 265 return;
266 } 266 }
267 267
268 ProfileInfoCache& info_cache = 268 ProfileInfoCache& info_cache =
269 g_browser_process->profile_manager()->GetProfileInfoCache(); 269 g_browser_process->profile_manager()->GetProfileInfoCache();
270 size_t profile_index = GetIndexOfProfileWithEmailAndName( 270 size_t profile_index = GetIndexOfProfileWithEmailAndName(
271 info_cache, emailAddress, displayName); 271 info_cache, email_address, display_name);
272 272
273 if (profile_index >= info_cache.GetNumberOfProfiles()) { 273 if (profile_index >= info_cache.GetNumberOfProfiles()) {
274 NOTREACHED(); 274 NOTREACHED();
275 return; 275 return;
276 } 276 }
277 277
278 // It's possible that a user breaks into the user-manager page using the 278 // It's possible that a user breaks into the user-manager page using the
279 // JavaScript Inspector and causes a "locked" profile to call this 279 // JavaScript Inspector and causes a "locked" profile to call this
280 // unauthenticated version of "launch" instead of the proper one. Thus, 280 // unauthenticated version of "launch" instead of the proper one. Thus,
281 // we have to validate in (secure) C++ code that it really is a profile 281 // we have to validate in (secure) C++ code that it really is a profile
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 // The row of user pods should display the active user first. 411 // The row of user pods should display the active user first.
412 if (is_active_user) 412 if (is_active_user)
413 users_list.Insert(0, profile_value); 413 users_list.Insert(0, profile_value);
414 else 414 else
415 users_list.Append(profile_value); 415 users_list.Append(profile_value);
416 } 416 }
417 417
418 web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers", 418 web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers",
419 users_list, base::FundamentalValue(false), base::FundamentalValue(true)); 419 users_list, base::FundamentalValue(false), base::FundamentalValue(true));
420 } 420 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/performance_monitor/performance_monitor_l10n.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698