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

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

Issue 1995113002: Rename WebUI::CallJavascriptFunction to WebUI::CallJavascriptFunctionUnsafe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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_supervised_user_import_handler.h " 5 #include "chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.h "
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 case Profile::CREATE_STATUS_REMOTE_FAIL: 183 case Profile::CREATE_STATUS_REMOTE_FAIL:
184 case Profile::MAX_CREATE_STATUS: { 184 case Profile::MAX_CREATE_STATUS: {
185 NOTREACHED(); 185 NOTREACHED();
186 break; 186 break;
187 } 187 }
188 } 188 }
189 } 189 }
190 190
191 void SigninSupervisedUserImportHandler::RejectCallback( 191 void SigninSupervisedUserImportHandler::RejectCallback(
192 const base::string16& error) { 192 const base::string16& error) {
193 web_ui()->CallJavascriptFunction("cr.webUIResponse", 193 web_ui()->CallJavascriptFunctionUnsafe(
194 base::StringValue(webui_callback_id_), 194 "cr.webUIResponse", base::StringValue(webui_callback_id_),
195 base::FundamentalValue(false), 195 base::FundamentalValue(false), base::StringValue(error));
196 base::StringValue(error));
197 webui_callback_id_.clear(); 196 webui_callback_id_.clear();
198 } 197 }
199 198
200 base::string16 SigninSupervisedUserImportHandler::GetLocalErorrMessage() const { 199 base::string16 SigninSupervisedUserImportHandler::GetLocalErorrMessage() const {
201 return l10n_util::GetStringUTF16( 200 return l10n_util::GetStringUTF16(
202 IDS_LEGACY_SUPERVISED_USER_IMPORT_LOCAL_ERROR); 201 IDS_LEGACY_SUPERVISED_USER_IMPORT_LOCAL_ERROR);
203 } 202 }
204 203
205 base::string16 SigninSupervisedUserImportHandler::GetAuthErorrMessage() const { 204 base::string16 SigninSupervisedUserImportHandler::GetAuthErorrMessage() const {
206 return l10n_util::GetStringUTF16( 205 return l10n_util::GetStringUTF16(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 profiles::GetDefaultAvatarIconUrl(avatar_index); 259 profiles::GetDefaultAvatarIconUrl(avatar_index);
261 supervised_user->SetString("iconURL", avatar_url); 260 supervised_user->SetString("iconURL", avatar_url);
262 bool on_current_device = 261 bool on_current_device =
263 supervised_user_ids.find(it.key()) != supervised_user_ids.end(); 262 supervised_user_ids.find(it.key()) != supervised_user_ids.end();
264 supervised_user->SetBoolean("onCurrentDevice", on_current_device); 263 supervised_user->SetBoolean("onCurrentDevice", on_current_device);
265 264
266 supervised_users.Append(supervised_user); 265 supervised_users.Append(supervised_user);
267 } 266 }
268 267
269 // Resolve callback with response. 268 // Resolve callback with response.
270 web_ui()->CallJavascriptFunction("cr.webUIResponse", 269 web_ui()->CallJavascriptFunctionUnsafe(
271 base::StringValue(webui_callback_id_), 270 "cr.webUIResponse", base::StringValue(webui_callback_id_),
272 base::FundamentalValue(true), 271 base::FundamentalValue(true), supervised_users);
273 supervised_users);
274 webui_callback_id_.clear(); 272 webui_callback_id_.clear();
275 } 273 }
276 274
277 bool SigninSupervisedUserImportHandler::IsAccountConnected( 275 bool SigninSupervisedUserImportHandler::IsAccountConnected(
278 Profile* profile) const { 276 Profile* profile) const {
279 SigninManagerBase* signin_manager = 277 SigninManagerBase* signin_manager =
280 SigninManagerFactory::GetForProfile(profile); 278 SigninManagerFactory::GetForProfile(profile);
281 return signin_manager && signin_manager->IsAuthenticated(); 279 return signin_manager && signin_manager->IsAuthenticated();
282 } 280 }
283 281
284 bool SigninSupervisedUserImportHandler::HasAuthError(Profile* profile) const { 282 bool SigninSupervisedUserImportHandler::HasAuthError(Profile* profile) const {
285 SigninErrorController* error_controller = 283 SigninErrorController* error_controller =
286 SigninErrorControllerFactory::GetForProfile(profile); 284 SigninErrorControllerFactory::GetForProfile(profile);
287 if (!error_controller) 285 if (!error_controller)
288 return true; 286 return true;
289 287
290 GoogleServiceAuthError::State state = error_controller->auth_error().state(); 288 GoogleServiceAuthError::State state = error_controller->auth_error().state();
291 return state != GoogleServiceAuthError::NONE; 289 return state != GoogleServiceAuthError::NONE;
292 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698