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

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

Issue 863063002: Don't allow profile deletion in Metro mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove spurious new lines Created 5 years, 11 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
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/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/value_conversions.h" 10 #include "base/value_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "base/win/metro.h"
12 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap i.h" 15 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap i.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 17 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
17 #include "chrome/browser/profiles/profile_info_cache.h" 18 #include "chrome/browser/profiles/profile_info_cache.h"
18 #include "chrome/browser/profiles/profile_info_cache_observer.h" 19 #include "chrome/browser/profiles/profile_info_cache_observer.h"
19 #include "chrome/browser/profiles/profile_manager.h" 20 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/profiles/profile_metrics.h" 21 #include "chrome/browser/profiles/profile_metrics.h"
21 #include "chrome/browser/profiles/profile_window.h" 22 #include "chrome/browser/profiles/profile_window.h"
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 localized_strings->SetString("multiProfilesPrimaryOnlyPolicyMsg", 627 localized_strings->SetString("multiProfilesPrimaryOnlyPolicyMsg",
627 base::string16()); 628 base::string16());
628 localized_strings->SetString("multiProfilesOwnerPrimaryOnlyMsg", 629 localized_strings->SetString("multiProfilesOwnerPrimaryOnlyMsg",
629 base::string16()); 630 base::string16());
630 } 631 }
631 632
632 void UserManagerScreenHandler::SendUserList() { 633 void UserManagerScreenHandler::SendUserList() {
633 base::ListValue users_list; 634 base::ListValue users_list;
634 const ProfileInfoCache& info_cache = 635 const ProfileInfoCache& info_cache =
635 g_browser_process->profile_manager()->GetProfileInfoCache(); 636 g_browser_process->profile_manager()->GetProfileInfoCache();
636 637 // Profile deletion is not allowed in Metro mode.
638 bool can_remove = !base::win::IsMetroProcess();
tapted 2015/01/26 23:36:07 here too, but this might be shared with ChromeOS,
noms (inactive) 2015/01/28 02:20:13 This is not shared with ChromeOS. This is desktop-
637 user_auth_type_map_.clear(); 639 user_auth_type_map_.clear();
638 640
639 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) { 641 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) {
640 base::DictionaryValue* profile_value = new base::DictionaryValue(); 642 base::DictionaryValue* profile_value = new base::DictionaryValue();
641 base::FilePath profile_path = info_cache.GetPathOfProfileAtIndex(i); 643 base::FilePath profile_path = info_cache.GetPathOfProfileAtIndex(i);
642 644
643 profile_value->SetString( 645 profile_value->SetString(
644 kKeyUsername, info_cache.GetUserNameOfProfileAtIndex(i)); 646 kKeyUsername, info_cache.GetUserNameOfProfileAtIndex(i));
645 profile_value->SetString( 647 profile_value->SetString(
646 kKeyEmailAddress, info_cache.GetUserNameOfProfileAtIndex(i)); 648 kKeyEmailAddress, info_cache.GetUserNameOfProfileAtIndex(i));
647 profile_value->SetString( 649 profile_value->SetString(
648 kKeyDisplayName, 650 kKeyDisplayName,
649 profiles::GetAvatarNameForProfile(profile_path)); 651 profiles::GetAvatarNameForProfile(profile_path));
650 profile_value->Set( 652 profile_value->Set(
651 kKeyProfilePath, base::CreateFilePathValue(profile_path)); 653 kKeyProfilePath, base::CreateFilePathValue(profile_path));
652 profile_value->SetBoolean(kKeyPublicAccount, false); 654 profile_value->SetBoolean(kKeyPublicAccount, false);
653 profile_value->SetBoolean( 655 profile_value->SetBoolean(
654 kKeySupervisedUser, info_cache.ProfileIsSupervisedAtIndex(i)); 656 kKeySupervisedUser, info_cache.ProfileIsSupervisedAtIndex(i));
655 profile_value->SetBoolean( 657 profile_value->SetBoolean(
656 kKeyChildUser, info_cache.ProfileIsChildAtIndex(i)); 658 kKeyChildUser, info_cache.ProfileIsChildAtIndex(i));
657 profile_value->SetBoolean( 659 profile_value->SetBoolean(
658 kKeyNeedsSignin, info_cache.ProfileIsSigninRequiredAtIndex(i)); 660 kKeyNeedsSignin, info_cache.ProfileIsSigninRequiredAtIndex(i));
659 profile_value->SetBoolean(kKeyIsOwner, false); 661 profile_value->SetBoolean(kKeyIsOwner, false);
660 profile_value->SetBoolean(kKeyCanRemove, true); 662 profile_value->SetBoolean(kKeyCanRemove, can_remove);
661 profile_value->SetBoolean(kKeyIsDesktop, true); 663 profile_value->SetBoolean(kKeyIsDesktop, true);
662 profile_value->SetString( 664 profile_value->SetString(
663 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache)); 665 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache));
664 666
665 users_list.Append(profile_value); 667 users_list.Append(profile_value);
666 } 668 }
667 669
668 web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers", 670 web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers",
669 users_list, base::FundamentalValue(IsGuestModeEnabled())); 671 users_list, base::FundamentalValue(IsGuestModeEnabled()));
670 } 672 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 Profile* profile, Profile::CreateStatus profile_create_status) { 760 Profile* profile, Profile::CreateStatus profile_create_status) {
759 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); 761 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_);
760 if (browser && browser->window()) { 762 if (browser && browser->window()) {
761 OnBrowserWindowReady(browser); 763 OnBrowserWindowReady(browser);
762 } else { 764 } else {
763 registrar_.Add(this, 765 registrar_.Add(this,
764 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 766 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
765 content::NotificationService::AllSources()); 767 content::NotificationService::AllSources());
766 } 768 }
767 } 769 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698