| OLD | NEW |
| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 browser->signin_view_controller()->CloseModalSignin(); | 63 browser->signin_view_controller()->CloseModalSignin(); |
| 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 AllowJavascript(); |
| 70 if (duplicate_profile_path_.empty()) | 70 if (duplicate_profile_path_.empty()) |
| 71 CallJavascriptFunction("signin.error.removeSwitchButton"); | 71 CallJavascriptFunction("signin.error.removeSwitchButton"); |
| 72 | 72 |
| 73 signin::SetInitializedModalHeight(web_ui(), args); | 73 signin::SetInitializedModalHeight(signin::GetDesktopBrowser(web_ui()), |
| 74 web_ui(), args); |
| 74 | 75 |
| 75 // After the dialog is shown, some platforms might have an element focused. | 76 // After the dialog is shown, some platforms might have an element focused. |
| 76 // To be consistent, clear the focused element on all platforms. | 77 // To be consistent, clear the focused element on all platforms. |
| 77 // TODO(anthonyvd): Figure out why this is needed on Mac and not other | 78 // TODO(anthonyvd): Figure out why this is needed on Mac and not other |
| 78 // platforms and if there's a way to start unfocused while avoiding this | 79 // platforms and if there's a way to start unfocused while avoiding this |
| 79 // workaround. | 80 // workaround. |
| 80 CallJavascriptFunction("signin.error.clearFocus"); | 81 CallJavascriptFunction("signin.error.clearFocus"); |
| 81 } | 82 } |
| 82 | 83 |
| 83 void SigninErrorHandler::CloseDialog() { | 84 void SigninErrorHandler::CloseDialog() { |
| 84 if (is_system_profile_) { | 85 if (is_system_profile_) { |
| 85 // Avoid closing the user manager window when the error message is displayed | 86 // Avoid closing the user manager window when the error message is displayed |
| 86 // without browser window. | 87 // without browser window. |
| 87 UserManagerProfileDialog::HideDialog(); | 88 UserManagerProfileDialog::HideDialog(); |
| 88 } else { | 89 } else { |
| 89 Browser* browser = signin::GetDesktopBrowser(web_ui()); | 90 Browser* browser = signin::GetDesktopBrowser(web_ui()); |
| 90 DCHECK(browser); | 91 DCHECK(browser); |
| 91 browser->signin_view_controller()->CloseModalSignin(); | 92 browser->signin_view_controller()->CloseModalSignin(); |
| 92 } | 93 } |
| 93 } | 94 } |
| OLD | NEW |