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

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

Issue 2163173004: Updates the list of signed-in profiles in user manager on ProfileAuthInfoChanged (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/signin_create_profile_handler.h" 5 #include "chrome/browser/ui/webui/signin/signin_create_profile_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #if defined(ENABLE_SUPERVISED_USERS) 48 #if defined(ENABLE_SUPERVISED_USERS)
49 #include "chrome/browser/supervised_user/legacy/supervised_user_registration_uti lity.h" 49 #include "chrome/browser/supervised_user/legacy/supervised_user_registration_uti lity.h"
50 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h" 50 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h"
51 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service_fac tory.h" 51 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service_fac tory.h"
52 #include "chrome/browser/supervised_user/supervised_user_service.h" 52 #include "chrome/browser/supervised_user/supervised_user_service.h"
53 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" 53 #include "chrome/browser/supervised_user/supervised_user_service_factory.h"
54 #endif 54 #endif
55 55
56 SigninCreateProfileHandler::SigninCreateProfileHandler() 56 SigninCreateProfileHandler::SigninCreateProfileHandler()
57 : profile_creation_type_(NO_CREATION_IN_PROGRESS), 57 : profile_creation_type_(NO_CREATION_IN_PROGRESS),
58 weak_ptr_factory_(this) {} 58 weak_ptr_factory_(this) {
59 g_browser_process->profile_manager()->
60 GetProfileAttributesStorage().AddObserver(this);
61 }
59 62
60 SigninCreateProfileHandler::~SigninCreateProfileHandler() { 63 SigninCreateProfileHandler::~SigninCreateProfileHandler() {
61 #if defined(ENABLE_SUPERVISED_USERS) 64 #if defined(ENABLE_SUPERVISED_USERS)
62 // Cancellation is only supported for supervised users. 65 // Cancellation is only supported for supervised users.
63 CancelProfileRegistration(false); 66 CancelProfileRegistration(false);
64 #endif 67 #endif
68 g_browser_process->profile_manager()->
69 GetProfileAttributesStorage().RemoveObserver(this);
65 } 70 }
66 71
67 void SigninCreateProfileHandler::GetLocalizedValues( 72 void SigninCreateProfileHandler::GetLocalizedValues(
68 base::DictionaryValue* localized_strings) { 73 base::DictionaryValue* localized_strings) {
69 localized_strings->SetString( 74 localized_strings->SetString(
70 "manageProfilesSupervisedSignedInLabel", 75 "manageProfilesSupervisedSignedInLabel",
71 l10n_util::GetStringUTF16( 76 l10n_util::GetStringUTF16(
72 IDS_PROFILES_CREATE_SUPERVISED_MULTI_SIGNED_IN_LABEL)); 77 IDS_PROFILES_CREATE_SUPERVISED_MULTI_SIGNED_IN_LABEL));
73 localized_strings->SetString( 78 localized_strings->SetString(
74 "noSignedInUserMessage", 79 "noSignedInUserMessage",
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 user_info->SetString("username", username); 212 user_info->SetString("username", username);
208 user_info->SetString("profilePath", profile_path); 213 user_info->SetString("profilePath", profile_path);
209 214
210 user_info_list.Append(std::move(user_info)); 215 user_info_list.Append(std::move(user_info));
211 } 216 }
212 web_ui()->CallJavascriptFunctionUnsafe( 217 web_ui()->CallJavascriptFunctionUnsafe(
213 "cr.webUIListenerCallback", base::StringValue("signedin-users-received"), 218 "cr.webUIListenerCallback", base::StringValue("signedin-users-received"),
214 user_info_list); 219 user_info_list);
215 } 220 }
216 221
222 void SigninCreateProfileHandler::OnProfileAuthInfoChanged(
223 const base::FilePath& profile_path) {
224 RequestSignedInProfiles(nullptr);
225 }
226
217 void SigninCreateProfileHandler::CreateProfile(const base::ListValue* args) { 227 void SigninCreateProfileHandler::CreateProfile(const base::ListValue* args) {
218 if (!profiles::IsMultipleProfilesEnabled()) 228 if (!profiles::IsMultipleProfilesEnabled())
219 return; 229 return;
220 230
221 // We can have only one in progress profile creation 231 // We can have only one in progress profile creation
222 // at any given moment, if new ones are initiated just 232 // at any given moment, if new ones are initiated just
223 // ignore them until we are done with the old one. 233 // ignore them until we are done with the old one.
224 if (profile_creation_type_ != NO_CREATION_IN_PROGRESS) 234 if (profile_creation_type_ != NO_CREATION_IN_PROGRESS)
225 return; 235 return;
226 236
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 789
780 profiles::OpenBrowserWindowForProfile( 790 profiles::OpenBrowserWindowForProfile(
781 base::Bind(&SigninCreateProfileHandler::OnBrowserReadyCallback, 791 base::Bind(&SigninCreateProfileHandler::OnBrowserReadyCallback,
782 weak_ptr_factory_.GetWeakPtr()), 792 weak_ptr_factory_.GetWeakPtr()),
783 false, // Don't create a window if one already exists. 793 false, // Don't create a window if one already exists.
784 true, // Create a first run window. 794 true, // Create a first run window.
785 profile, 795 profile,
786 Profile::CREATE_STATUS_INITIALIZED); 796 Profile::CREATE_STATUS_INITIALIZED);
787 } 797 }
788 #endif 798 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698