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

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

Issue 2722783002: Use CallJavascriptFunction instead of CallJavascriptFunctionUnsafe in sign-in error dialog. (Closed)
Patch Set: Nit Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_error_handler.h" 5 #include "chrome/browser/ui/webui/signin/signin_error_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/profiles/profile_manager.h" 8 #include "chrome/browser/profiles/profile_manager.h"
9 #include "chrome/browser/profiles/profile_window.h" 9 #include "chrome/browser/profiles/profile_window.h"
10 #include "chrome/browser/signin/signin_ui_util.h" 10 #include "chrome/browser/signin/signin_ui_util.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 void SigninErrorHandler::HandleLearnMore(const base::ListValue* args) { 60 void SigninErrorHandler::HandleLearnMore(const base::ListValue* args) {
61 Browser* browser = signin::GetDesktopBrowser(web_ui()); 61 Browser* browser = signin::GetDesktopBrowser(web_ui());
62 DCHECK(browser); 62 DCHECK(browser);
63 browser->CloseModalSigninWindow(); 63 browser->CloseModalSigninWindow();
64 signin_ui_util::ShowSigninErrorLearnMorePage(browser->profile()); 64 signin_ui_util::ShowSigninErrorLearnMorePage(browser->profile());
65 } 65 }
66 66
67 void SigninErrorHandler::HandleInitializedWithSize( 67 void SigninErrorHandler::HandleInitializedWithSize(
68 const base::ListValue* args) { 68 const base::ListValue* args) {
69 AllowJavascript();
69 if (duplicate_profile_path_.empty()) 70 if (duplicate_profile_path_.empty())
70 web_ui()->CallJavascriptFunctionUnsafe("signin.error.removeSwitchButton"); 71 CallJavascriptFunction("signin.error.removeSwitchButton");
71 72
72 signin::SetInitializedModalHeight(web_ui(), args); 73 signin::SetInitializedModalHeight(web_ui(), args);
73 74
74 // After the dialog is shown, some platforms might have an element focused. 75 // After the dialog is shown, some platforms might have an element focused.
75 // To be consistent, clear the focused element on all platforms. 76 // To be consistent, clear the focused element on all platforms.
76 // TODO(anthonyvd): Figure out why this is needed on Mac and not other 77 // TODO(anthonyvd): Figure out why this is needed on Mac and not other
77 // platforms and if there's a way to start unfocused while avoiding this 78 // platforms and if there's a way to start unfocused while avoiding this
78 // workaround. 79 // workaround.
79 web_ui()->CallJavascriptFunctionUnsafe("signin.error.clearFocus"); 80 CallJavascriptFunction("signin.error.clearFocus");
80 } 81 }
81 82
82 void SigninErrorHandler::CloseDialog() { 83 void SigninErrorHandler::CloseDialog() {
83 if (is_system_profile_) { 84 if (is_system_profile_) {
84 // Avoid closing the user manager window when the error message is displayed 85 // Avoid closing the user manager window when the error message is displayed
85 // without browser window. 86 // without browser window.
86 UserManagerProfileDialog::HideDialog(); 87 UserManagerProfileDialog::HideDialog();
87 } else { 88 } else {
88 Browser* browser = signin::GetDesktopBrowser(web_ui()); 89 Browser* browser = signin::GetDesktopBrowser(web_ui());
89 DCHECK(browser); 90 DCHECK(browser);
90 browser->CloseModalSigninWindow(); 91 browser->CloseModalSigninWindow();
91 } 92 }
92 } 93 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698