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

Side by Side Diff: chrome/browser/chromeos/login/managed/locally_managed_user_creation_screen.cc

Issue 105193002: Replace string16 with base::string16. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/chromeos/login/managed/locally_managed_user_creation_sc reen.h" 5 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc reen.h"
6 6
7 #include "ash/desktop_background/desktop_background_controller.h" 7 #include "ash/desktop_background/desktop_background_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 controller_.reset(); 184 controller_.reset();
185 controller_.reset(new LocallyManagedUserCreationController(this, manager_id)); 185 controller_.reset(new LocallyManagedUserCreationController(this, manager_id));
186 186
187 ExistingUserController::current_controller()-> 187 ExistingUserController::current_controller()->
188 Login(UserContext(manager_id, 188 Login(UserContext(manager_id,
189 manager_password, 189 manager_password,
190 std::string() /* auth_code */)); 190 std::string() /* auth_code */));
191 } 191 }
192 192
193 void LocallyManagedUserCreationScreen::CreateManagedUser( 193 void LocallyManagedUserCreationScreen::CreateManagedUser(
194 const string16& display_name, 194 const base::string16& display_name,
195 const std::string& managed_user_password) { 195 const std::string& managed_user_password) {
196 DCHECK(controller_.get()); 196 DCHECK(controller_.get());
197 int image; 197 int image;
198 if (selected_image_ == User::kExternalImageIndex) 198 if (selected_image_ == User::kExternalImageIndex)
199 // TODO(dzhioev): crbug/249660 199 // TODO(dzhioev): crbug/249660
200 image = LocallyManagedUserCreationController::kDummyAvatarIndex; 200 image = LocallyManagedUserCreationController::kDummyAvatarIndex;
201 else 201 else
202 image = selected_image_; 202 image = selected_image_;
203 controller_->SetUpCreation(display_name, managed_user_password, image); 203 controller_->SetUpCreation(display_name, managed_user_password, image);
204 controller_->StartCreation(); 204 controller_->StartCreation();
205 } 205 }
206 206
207 void LocallyManagedUserCreationScreen::ImportManagedUser( 207 void LocallyManagedUserCreationScreen::ImportManagedUser(
208 const std::string& user_id) { 208 const std::string& user_id) {
209 DCHECK(controller_.get()); 209 DCHECK(controller_.get());
210 DCHECK(existing_users_.get()); 210 DCHECK(existing_users_.get());
211 VLOG(1) << "Importing user " << user_id; 211 VLOG(1) << "Importing user " << user_id;
212 DictionaryValue* user_info; 212 DictionaryValue* user_info;
213 if (!existing_users_->GetDictionary(user_id, &user_info)) { 213 if (!existing_users_->GetDictionary(user_id, &user_info)) {
214 LOG(ERROR) << "Can not import non-existing user " << user_id; 214 LOG(ERROR) << "Can not import non-existing user " << user_id;
215 return; 215 return;
216 } 216 }
217 string16 display_name; 217 base::string16 display_name;
218 std::string master_key; 218 std::string master_key;
219 std::string avatar; 219 std::string avatar;
220 bool exists; 220 bool exists;
221 int avatar_index = LocallyManagedUserCreationController::kDummyAvatarIndex; 221 int avatar_index = LocallyManagedUserCreationController::kDummyAvatarIndex;
222 user_info->GetString(ManagedUserSyncService::kName, &display_name); 222 user_info->GetString(ManagedUserSyncService::kName, &display_name);
223 user_info->GetString(ManagedUserSyncService::kMasterKey, &master_key); 223 user_info->GetString(ManagedUserSyncService::kMasterKey, &master_key);
224 user_info->GetString(ManagedUserSyncService::kChromeOsAvatar, &avatar); 224 user_info->GetString(ManagedUserSyncService::kChromeOsAvatar, &avatar);
225 user_info->GetBoolean(kUserExists, &exists); 225 user_info->GetBoolean(kUserExists, &exists);
226 226
227 // We should not get here with existing user selected, so just display error. 227 // We should not get here with existing user selected, so just display error.
(...skipping 23 matching lines...) Expand all
251 const std::string& user_id, 251 const std::string& user_id,
252 const std::string& password) { 252 const std::string& password) {
253 DCHECK(controller_.get()); 253 DCHECK(controller_.get());
254 DCHECK(existing_users_.get()); 254 DCHECK(existing_users_.get());
255 VLOG(1) << "Importing user " << user_id; 255 VLOG(1) << "Importing user " << user_id;
256 DictionaryValue* user_info; 256 DictionaryValue* user_info;
257 if (!existing_users_->GetDictionary(user_id, &user_info)) { 257 if (!existing_users_->GetDictionary(user_id, &user_info)) {
258 LOG(ERROR) << "Can not import non-existing user " << user_id; 258 LOG(ERROR) << "Can not import non-existing user " << user_id;
259 return; 259 return;
260 } 260 }
261 string16 display_name; 261 base::string16 display_name;
262 std::string master_key; 262 std::string master_key;
263 std::string avatar; 263 std::string avatar;
264 bool exists; 264 bool exists;
265 int avatar_index = LocallyManagedUserCreationController::kDummyAvatarIndex; 265 int avatar_index = LocallyManagedUserCreationController::kDummyAvatarIndex;
266 user_info->GetString(ManagedUserSyncService::kName, &display_name); 266 user_info->GetString(ManagedUserSyncService::kName, &display_name);
267 user_info->GetString(ManagedUserSyncService::kMasterKey, &master_key); 267 user_info->GetString(ManagedUserSyncService::kMasterKey, &master_key);
268 user_info->GetString(ManagedUserSyncService::kChromeOsAvatar, &avatar); 268 user_info->GetString(ManagedUserSyncService::kChromeOsAvatar, &avatar);
269 user_info->GetBoolean(kUserExists, &exists); 269 user_info->GetBoolean(kUserExists, &exists);
270 270
271 // We should not get here with existing user selected, so just display error. 271 // We should not get here with existing user selected, so just display error.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 326 }
327 327
328 void LocallyManagedUserCreationScreen::OnActorDestroyed( 328 void LocallyManagedUserCreationScreen::OnActorDestroyed(
329 LocallyManagedUserCreationScreenHandler* actor) { 329 LocallyManagedUserCreationScreenHandler* actor) {
330 if (actor_ == actor) 330 if (actor_ == actor)
331 actor_ = NULL; 331 actor_ = NULL;
332 } 332 }
333 333
334 void LocallyManagedUserCreationScreen::OnCreationError( 334 void LocallyManagedUserCreationScreen::OnCreationError(
335 LocallyManagedUserCreationController::ErrorCode code) { 335 LocallyManagedUserCreationController::ErrorCode code) {
336 string16 title; 336 base::string16 title;
337 string16 message; 337 base::string16 message;
338 string16 button; 338 base::string16 button;
339 // TODO(antrim) : find out which errors do we really have. 339 // TODO(antrim) : find out which errors do we really have.
340 // We might reuse some error messages from ordinary user flow. 340 // We might reuse some error messages from ordinary user flow.
341 switch (code) { 341 switch (code) {
342 case LocallyManagedUserCreationController::CRYPTOHOME_NO_MOUNT: 342 case LocallyManagedUserCreationController::CRYPTOHOME_NO_MOUNT:
343 case LocallyManagedUserCreationController::CRYPTOHOME_FAILED_MOUNT: 343 case LocallyManagedUserCreationController::CRYPTOHOME_FAILED_MOUNT:
344 case LocallyManagedUserCreationController::CRYPTOHOME_FAILED_TPM: 344 case LocallyManagedUserCreationController::CRYPTOHOME_FAILED_TPM:
345 title = l10n_util::GetStringUTF16( 345 title = l10n_util::GetStringUTF16(
346 IDS_CREATE_LOCALLY_MANAGED_USER_TPM_ERROR_TITLE); 346 IDS_CREATE_LOCALLY_MANAGED_USER_TPM_ERROR_TITLE);
347 message = l10n_util::GetStringUTF16( 347 message = l10n_util::GetStringUTF16(
348 IDS_CREATE_LOCALLY_MANAGED_USER_TPM_ERROR); 348 IDS_CREATE_LOCALLY_MANAGED_USER_TPM_ERROR);
(...skipping 24 matching lines...) Expand all
373 } 373 }
374 374
375 void LocallyManagedUserCreationScreen::OnLongCreationWarning() { 375 void LocallyManagedUserCreationScreen::OnLongCreationWarning() {
376 if (actor_) { 376 if (actor_) {
377 actor_->ShowStatusMessage(true /* progress */, l10n_util::GetStringUTF16( 377 actor_->ShowStatusMessage(true /* progress */, l10n_util::GetStringUTF16(
378 IDS_PROFILES_CREATE_MANAGED_JUST_SIGNED_IN)); 378 IDS_PROFILES_CREATE_MANAGED_JUST_SIGNED_IN));
379 } 379 }
380 } 380 }
381 381
382 bool LocallyManagedUserCreationScreen::FindUserByDisplayName( 382 bool LocallyManagedUserCreationScreen::FindUserByDisplayName(
383 const string16& display_name, 383 const base::string16& display_name,
384 std::string *out_id) const { 384 std::string *out_id) const {
385 if (!existing_users_.get()) 385 if (!existing_users_.get())
386 return false; 386 return false;
387 for (base::DictionaryValue::Iterator it(*existing_users_.get()); 387 for (base::DictionaryValue::Iterator it(*existing_users_.get());
388 !it.IsAtEnd(); it.Advance()) { 388 !it.IsAtEnd(); it.Advance()) {
389 const base::DictionaryValue* user_info = 389 const base::DictionaryValue* user_info =
390 static_cast<const base::DictionaryValue*>(&it.value()); 390 static_cast<const base::DictionaryValue*>(&it.value());
391 string16 user_display_name; 391 base::string16 user_display_name;
392 if (user_info->GetString(ManagedUserSyncService::kName, 392 if (user_info->GetString(ManagedUserSyncService::kName,
393 &user_display_name)) { 393 &user_display_name)) {
394 if (display_name == user_display_name) { 394 if (display_name == user_display_name) {
395 if (out_id) 395 if (out_id)
396 *out_id = it.key(); 396 *out_id = it.key();
397 return true; 397 return true;
398 } 398 }
399 } 399 }
400 } 400 }
401 return false; 401 return false;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 local_copy->SetString( 479 local_copy->SetString(
480 ManagedUserSyncService::kChromeOsAvatar, 480 ManagedUserSyncService::kChromeOsAvatar,
481 ManagedUserSyncService::BuildAvatarString(i)); 481 ManagedUserSyncService::BuildAvatarString(i));
482 local_copy->SetBoolean(kRandomAvatarKey, true); 482 local_copy->SetBoolean(kRandomAvatarKey, true);
483 ui_copy->SetString(kAvatarURLKey, GetDefaultImageUrl(i)); 483 ui_copy->SetString(kAvatarURLKey, GetDefaultImageUrl(i));
484 } 484 }
485 485
486 local_copy->SetBoolean(kUserExists, false); 486 local_copy->SetBoolean(kUserExists, false);
487 ui_copy->SetBoolean(kUserExists, false); 487 ui_copy->SetBoolean(kUserExists, false);
488 488
489 string16 display_name; 489 base::string16 display_name;
490 local_copy->GetString(ManagedUserSyncService::kName, &display_name); 490 local_copy->GetString(ManagedUserSyncService::kName, &display_name);
491 491
492 if (supervised_user_manager->FindBySyncId(it.key())) { 492 if (supervised_user_manager->FindBySyncId(it.key())) {
493 local_copy->SetBoolean(kUserExists, true); 493 local_copy->SetBoolean(kUserExists, true);
494 ui_copy->SetBoolean(kUserExists, true); 494 ui_copy->SetBoolean(kUserExists, true);
495 local_copy->SetString(kUserConflict, kUserConflictImported); 495 local_copy->SetString(kUserConflict, kUserConflictImported);
496 ui_copy->SetString(kUserConflict, kUserConflictImported); 496 ui_copy->SetString(kUserConflict, kUserConflictImported);
497 } else if (supervised_user_manager->FindByDisplayName(display_name)) { 497 } else if (supervised_user_manager->FindByDisplayName(display_name)) {
498 local_copy->SetBoolean(kUserExists, true); 498 local_copy->SetBoolean(kUserExists, true);
499 ui_copy->SetBoolean(kUserExists, true); 499 ui_copy->SetBoolean(kUserExists, true);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 selected_image_ = User::kExternalImageIndex; 552 selected_image_ = User::kExternalImageIndex;
553 } else { 553 } else {
554 NOTREACHED() << "Unexpected image type: " << image_type; 554 NOTREACHED() << "Unexpected image type: " << image_type;
555 } 555 }
556 } 556 }
557 557
558 void LocallyManagedUserCreationScreen::OnImageAccepted() { 558 void LocallyManagedUserCreationScreen::OnImageAccepted() {
559 } 559 }
560 560
561 } // namespace chromeos 561 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698