| OLD | NEW |
| 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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "google_apis/gaia/gaia_auth_fetcher.h" | 38 #include "google_apis/gaia/gaia_auth_fetcher.h" |
| 39 #include "google_apis/gaia/gaia_constants.h" | 39 #include "google_apis/gaia/gaia_constants.h" |
| 40 #include "third_party/skia/include/core/SkBitmap.h" | 40 #include "third_party/skia/include/core/SkBitmap.h" |
| 41 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
| 42 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
| 43 #include "ui/base/webui/web_ui_util.h" | 43 #include "ui/base/webui/web_ui_util.h" |
| 44 #include "ui/gfx/image/image.h" | 44 #include "ui/gfx/image/image.h" |
| 45 #include "ui/gfx/image/image_skia.h" | 45 #include "ui/gfx/image/image_skia.h" |
| 46 #include "ui/gfx/image/image_util.h" | 46 #include "ui/gfx/image/image_util.h" |
| 47 | 47 |
| 48 #if defined(OS_WIN) |
| 49 #include "base/win/metro.h" |
| 50 #endif |
| 51 |
| 48 namespace { | 52 namespace { |
| 49 // User dictionary keys. | 53 // User dictionary keys. |
| 50 const char kKeyUsername[] = "username"; | 54 const char kKeyUsername[] = "username"; |
| 51 const char kKeyDisplayName[]= "displayName"; | 55 const char kKeyDisplayName[]= "displayName"; |
| 52 const char kKeyEmailAddress[] = "emailAddress"; | 56 const char kKeyEmailAddress[] = "emailAddress"; |
| 53 const char kKeyProfilePath[] = "profilePath"; | 57 const char kKeyProfilePath[] = "profilePath"; |
| 54 const char kKeyPublicAccount[] = "publicAccount"; | 58 const char kKeyPublicAccount[] = "publicAccount"; |
| 55 const char kKeySupervisedUser[] = "supervisedUser"; | 59 const char kKeySupervisedUser[] = "supervisedUser"; |
| 56 const char kKeyChildUser[] = "childUser"; | 60 const char kKeyChildUser[] = "childUser"; |
| 57 const char kKeyCanRemove[] = "canRemove"; | 61 const char kKeyCanRemove[] = "canRemove"; |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 localized_strings->SetString("multiProfilesPrimaryOnlyPolicyMsg", | 630 localized_strings->SetString("multiProfilesPrimaryOnlyPolicyMsg", |
| 627 base::string16()); | 631 base::string16()); |
| 628 localized_strings->SetString("multiProfilesOwnerPrimaryOnlyMsg", | 632 localized_strings->SetString("multiProfilesOwnerPrimaryOnlyMsg", |
| 629 base::string16()); | 633 base::string16()); |
| 630 } | 634 } |
| 631 | 635 |
| 632 void UserManagerScreenHandler::SendUserList() { | 636 void UserManagerScreenHandler::SendUserList() { |
| 633 base::ListValue users_list; | 637 base::ListValue users_list; |
| 634 const ProfileInfoCache& info_cache = | 638 const ProfileInfoCache& info_cache = |
| 635 g_browser_process->profile_manager()->GetProfileInfoCache(); | 639 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 640 user_auth_type_map_.clear(); |
| 636 | 641 |
| 637 user_auth_type_map_.clear(); | 642 // Profile deletion is not allowed in Metro mode. |
| 643 bool can_remove = true; |
| 644 #if defined(OS_WIN) |
| 645 can_remove = !base::win::IsMetroProcess(); |
| 646 #endif |
| 638 | 647 |
| 639 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) { | 648 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) { |
| 640 base::DictionaryValue* profile_value = new base::DictionaryValue(); | 649 base::DictionaryValue* profile_value = new base::DictionaryValue(); |
| 641 base::FilePath profile_path = info_cache.GetPathOfProfileAtIndex(i); | 650 base::FilePath profile_path = info_cache.GetPathOfProfileAtIndex(i); |
| 642 | 651 |
| 643 profile_value->SetString( | 652 profile_value->SetString( |
| 644 kKeyUsername, info_cache.GetUserNameOfProfileAtIndex(i)); | 653 kKeyUsername, info_cache.GetUserNameOfProfileAtIndex(i)); |
| 645 profile_value->SetString( | 654 profile_value->SetString( |
| 646 kKeyEmailAddress, info_cache.GetUserNameOfProfileAtIndex(i)); | 655 kKeyEmailAddress, info_cache.GetUserNameOfProfileAtIndex(i)); |
| 647 profile_value->SetString( | 656 profile_value->SetString( |
| 648 kKeyDisplayName, | 657 kKeyDisplayName, |
| 649 profiles::GetAvatarNameForProfile(profile_path)); | 658 profiles::GetAvatarNameForProfile(profile_path)); |
| 650 profile_value->Set( | 659 profile_value->Set( |
| 651 kKeyProfilePath, base::CreateFilePathValue(profile_path)); | 660 kKeyProfilePath, base::CreateFilePathValue(profile_path)); |
| 652 profile_value->SetBoolean(kKeyPublicAccount, false); | 661 profile_value->SetBoolean(kKeyPublicAccount, false); |
| 653 profile_value->SetBoolean( | 662 profile_value->SetBoolean( |
| 654 kKeySupervisedUser, info_cache.ProfileIsSupervisedAtIndex(i)); | 663 kKeySupervisedUser, info_cache.ProfileIsSupervisedAtIndex(i)); |
| 655 profile_value->SetBoolean( | 664 profile_value->SetBoolean( |
| 656 kKeyChildUser, info_cache.ProfileIsChildAtIndex(i)); | 665 kKeyChildUser, info_cache.ProfileIsChildAtIndex(i)); |
| 657 profile_value->SetBoolean( | 666 profile_value->SetBoolean( |
| 658 kKeyNeedsSignin, info_cache.ProfileIsSigninRequiredAtIndex(i)); | 667 kKeyNeedsSignin, info_cache.ProfileIsSigninRequiredAtIndex(i)); |
| 659 profile_value->SetBoolean(kKeyIsOwner, false); | 668 profile_value->SetBoolean(kKeyIsOwner, false); |
| 660 profile_value->SetBoolean(kKeyCanRemove, true); | 669 profile_value->SetBoolean(kKeyCanRemove, can_remove); |
| 661 profile_value->SetBoolean(kKeyIsDesktop, true); | 670 profile_value->SetBoolean(kKeyIsDesktop, true); |
| 662 profile_value->SetString( | 671 profile_value->SetString( |
| 663 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache)); | 672 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache)); |
| 664 | 673 |
| 665 users_list.Append(profile_value); | 674 users_list.Append(profile_value); |
| 666 } | 675 } |
| 667 | 676 |
| 668 web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers", | 677 web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers", |
| 669 users_list, base::FundamentalValue(IsGuestModeEnabled())); | 678 users_list, base::FundamentalValue(IsGuestModeEnabled())); |
| 670 } | 679 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 Profile* profile, Profile::CreateStatus profile_create_status) { | 767 Profile* profile, Profile::CreateStatus profile_create_status) { |
| 759 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); | 768 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); |
| 760 if (browser && browser->window()) { | 769 if (browser && browser->window()) { |
| 761 OnBrowserWindowReady(browser); | 770 OnBrowserWindowReady(browser); |
| 762 } else { | 771 } else { |
| 763 registrar_.Add(this, | 772 registrar_.Add(this, |
| 764 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 773 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 765 content::NotificationService::AllSources()); | 774 content::NotificationService::AllSources()); |
| 766 } | 775 } |
| 767 } | 776 } |
| OLD | NEW |