Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/ui/webui/options/manage_profile_handler.h" | 5 #include "chrome/browser/ui/webui/options/manage_profile_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_util.h" | |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/value_conversions.h" | 14 #include "base/value_conversions.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/profiles/gaia_info_update_service.h" | 18 #include "chrome/browser/profiles/gaia_info_update_service.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 20 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 20 #include "chrome/browser/profiles/profile_info_cache.h" | 21 #include "chrome/browser/profiles/profile_info_cache.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 } | 375 } |
| 375 ProfileMetrics::LogProfileUpdate(profile_file_path); | 376 ProfileMetrics::LogProfileUpdate(profile_file_path); |
| 376 | 377 |
| 377 if (profile->IsSupervised()) | 378 if (profile->IsSupervised()) |
| 378 return; | 379 return; |
| 379 | 380 |
| 380 base::string16 new_profile_name; | 381 base::string16 new_profile_name; |
| 381 if (!args->GetString(2, &new_profile_name)) | 382 if (!args->GetString(2, &new_profile_name)) |
| 382 return; | 383 return; |
| 383 | 384 |
| 385 base::TrimWhitespace(new_profile_name, base::TRIM_ALL, &new_profile_name); | |
|
Dan Beam
2014/09/11 17:54:08
CHECK(!new_profile_name.empty());
noms (inactive)
2014/09/15 21:12:26
Done in https://codereview.chromium.org/562233002.
| |
| 384 profiles::UpdateProfileName(profile, new_profile_name); | 386 profiles::UpdateProfileName(profile, new_profile_name); |
| 385 } | 387 } |
| 386 | 388 |
| 387 #if defined(ENABLE_SETTINGS_APP) | 389 #if defined(ENABLE_SETTINGS_APP) |
| 388 void ManageProfileHandler::SwitchAppListProfile(const base::ListValue* args) { | 390 void ManageProfileHandler::SwitchAppListProfile(const base::ListValue* args) { |
| 389 DCHECK(args); | 391 DCHECK(args); |
| 390 DCHECK(profiles::IsMultipleProfilesEnabled()); | 392 DCHECK(profiles::IsMultipleProfilesEnabled()); |
| 391 | 393 |
| 392 const base::Value* file_path_value; | 394 const base::Value* file_path_value; |
| 393 base::FilePath profile_file_path; | 395 base::FilePath profile_file_path; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 | 535 |
| 534 // Update the UI buttons. | 536 // Update the UI buttons. |
| 535 OnHasProfileShortcuts(false); | 537 OnHasProfileShortcuts(false); |
| 536 } | 538 } |
| 537 | 539 |
| 538 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { | 540 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { |
| 539 profiles::UpdateGaiaProfilePhotoIfNeeded(Profile::FromWebUI(web_ui())); | 541 profiles::UpdateGaiaProfilePhotoIfNeeded(Profile::FromWebUI(web_ui())); |
| 540 } | 542 } |
| 541 | 543 |
| 542 } // namespace options | 544 } // namespace options |
| OLD | NEW |