| 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" |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 base::FilePath profile_file_path; | 450 base::FilePath profile_file_path; |
| 451 if (!GetProfilePathFromArgs(args, &profile_file_path)) | 451 if (!GetProfilePathFromArgs(args, &profile_file_path)) |
| 452 return; | 452 return; |
| 453 | 453 |
| 454 const ProfileInfoCache& cache = | 454 const ProfileInfoCache& cache = |
| 455 g_browser_process->profile_manager()->GetProfileInfoCache(); | 455 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 456 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_file_path); | 456 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_file_path); |
| 457 if (profile_index == std::string::npos) | 457 if (profile_index == std::string::npos) |
| 458 return; | 458 return; |
| 459 | 459 |
| 460 // Don't show the add/remove desktop shortcut button in the single user case. |
| 461 if (cache.GetNumberOfProfiles() <= 1) |
| 462 return; |
| 463 |
| 460 const base::FilePath profile_path = | 464 const base::FilePath profile_path = |
| 461 cache.GetPathOfProfileAtIndex(profile_index); | 465 cache.GetPathOfProfileAtIndex(profile_index); |
| 462 ProfileShortcutManager* shortcut_manager = | 466 ProfileShortcutManager* shortcut_manager = |
| 463 g_browser_process->profile_manager()->profile_shortcut_manager(); | 467 g_browser_process->profile_manager()->profile_shortcut_manager(); |
| 464 shortcut_manager->HasProfileShortcuts( | 468 shortcut_manager->HasProfileShortcuts( |
| 465 profile_path, base::Bind(&ManageProfileHandler::OnHasProfileShortcuts, | 469 profile_path, base::Bind(&ManageProfileHandler::OnHasProfileShortcuts, |
| 466 weak_factory_.GetWeakPtr())); | 470 weak_factory_.GetWeakPtr())); |
| 467 } | 471 } |
| 468 | 472 |
| 469 void ManageProfileHandler::RequestCreateProfileUpdate( | 473 void ManageProfileHandler::RequestCreateProfileUpdate( |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 | 537 |
| 534 // Update the UI buttons. | 538 // Update the UI buttons. |
| 535 OnHasProfileShortcuts(false); | 539 OnHasProfileShortcuts(false); |
| 536 } | 540 } |
| 537 | 541 |
| 538 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { | 542 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { |
| 539 profiles::UpdateGaiaProfilePhotoIfNeeded(Profile::FromWebUI(web_ui())); | 543 profiles::UpdateGaiaProfilePhotoIfNeeded(Profile::FromWebUI(web_ui())); |
| 540 } | 544 } |
| 541 | 545 |
| 542 } // namespace options | 546 } // namespace options |
| OLD | NEW |