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 <stddef.h> | 7 #include <stddef.h> |
| 8 |
8 #include <utility> | 9 #include <utility> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/location.h" | 13 #include "base/location.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/profiler/scoped_tracker.h" | 15 #include "base/profiler/scoped_tracker.h" |
15 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 #if defined(USE_ASH) | 883 #if defined(USE_ASH) |
883 can_remove = !ash::Shell::HasInstance(); | 884 can_remove = !ash::Shell::HasInstance(); |
884 #endif | 885 #endif |
885 | 886 |
886 for (const ProfileAttributesEntry* entry : entries) { | 887 for (const ProfileAttributesEntry* entry : entries) { |
887 // Don't show profiles still in the middle of being set up as new legacy | 888 // Don't show profiles still in the middle of being set up as new legacy |
888 // supervised users. | 889 // supervised users. |
889 if (entry->IsOmitted()) | 890 if (entry->IsOmitted()) |
890 continue; | 891 continue; |
891 | 892 |
892 base::DictionaryValue* profile_value = new base::DictionaryValue(); | 893 std::unique_ptr<base::DictionaryValue> profile_value( |
| 894 new base::DictionaryValue()); |
893 base::FilePath profile_path = entry->GetPath(); | 895 base::FilePath profile_path = entry->GetPath(); |
894 | 896 |
895 profile_value->SetString(kKeyUsername, entry->GetUserName()); | 897 profile_value->SetString(kKeyUsername, entry->GetUserName()); |
896 profile_value->SetString(kKeyEmailAddress, entry->GetUserName()); | 898 profile_value->SetString(kKeyEmailAddress, entry->GetUserName()); |
897 profile_value->SetString(kKeyDisplayName, | 899 profile_value->SetString(kKeyDisplayName, |
898 profiles::GetAvatarNameForProfile(profile_path)); | 900 profiles::GetAvatarNameForProfile(profile_path)); |
899 profile_value->Set(kKeyProfilePath, | 901 profile_value->Set(kKeyProfilePath, |
900 base::CreateFilePathValue(profile_path)); | 902 base::CreateFilePathValue(profile_path)); |
901 profile_value->SetBoolean(kKeyPublicAccount, false); | 903 profile_value->SetBoolean(kKeyPublicAccount, false); |
902 profile_value->SetBoolean(kKeyLegacySupervisedUser, | 904 profile_value->SetBoolean(kKeyLegacySupervisedUser, |
(...skipping 20 matching lines...) Expand all Loading... |
923 } | 925 } |
924 profile_value->SetWithoutPathExpansion(kKeyStatistics, | 926 profile_value->SetWithoutPathExpansion(kKeyStatistics, |
925 std::move(stats_dict)); | 927 std::move(stats_dict)); |
926 | 928 |
927 // GetProfileByPath returns a pointer if the profile is fully loaded, NULL | 929 // GetProfileByPath returns a pointer if the profile is fully loaded, NULL |
928 // otherwise. | 930 // otherwise. |
929 Profile* profile = | 931 Profile* profile = |
930 g_browser_process->profile_manager()->GetProfileByPath(profile_path); | 932 g_browser_process->profile_manager()->GetProfileByPath(profile_path); |
931 profile_value->SetBoolean(kKeyIsProfileLoaded, profile != nullptr); | 933 profile_value->SetBoolean(kKeyIsProfileLoaded, profile != nullptr); |
932 | 934 |
933 users_list.Append(profile_value); | 935 users_list.Append(std::move(profile_value)); |
934 } | 936 } |
935 | 937 |
936 web_ui()->CallJavascriptFunctionUnsafe( | 938 web_ui()->CallJavascriptFunctionUnsafe( |
937 "login.AccountPickerScreen.loadUsers", users_list, | 939 "login.AccountPickerScreen.loadUsers", users_list, |
938 base::FundamentalValue(IsGuestModeEnabled())); | 940 base::FundamentalValue(IsGuestModeEnabled())); |
939 | 941 |
940 // This is the latest C++ code we have in the flow to show the UserManager. | 942 // This is the latest C++ code we have in the flow to show the UserManager. |
941 // This may be invoked more than once per UserManager lifetime; the | 943 // This may be invoked more than once per UserManager lifetime; the |
942 // UserManager will ensure all relevant logging only happens once. | 944 // UserManager will ensure all relevant logging only happens once. |
943 UserManager::OnUserManagerShown(); | 945 UserManager::OnUserManagerShown(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 Profile* profile, Profile::CreateStatus profile_create_status) { | 1020 Profile* profile, Profile::CreateStatus profile_create_status) { |
1019 Browser* browser = chrome::FindAnyBrowser(profile, false); | 1021 Browser* browser = chrome::FindAnyBrowser(profile, false); |
1020 if (browser && browser->window()) { | 1022 if (browser && browser->window()) { |
1021 OnBrowserWindowReady(browser); | 1023 OnBrowserWindowReady(browser); |
1022 } else { | 1024 } else { |
1023 registrar_.Add(this, | 1025 registrar_.Add(this, |
1024 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1026 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
1025 content::NotificationService::AllSources()); | 1027 content::NotificationService::AllSources()); |
1026 } | 1028 } |
1027 } | 1029 } |
OLD | NEW |