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_attributes_entry.h" | 8 #include "chrome/browser/profiles/profile_attributes_entry.h" |
9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
10 #include "chrome/browser/profiles/profile_window.h" | 10 #include "chrome/browser/profiles/profile_window.h" |
11 #include "chrome/browser/signin/signin_ui_util.h" | 11 #include "chrome/browser/signin/signin_ui_util.h" |
12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
13 #include "chrome/browser/ui/user_manager.h" | |
13 #include "chrome/browser/ui/webui/signin/signin_utils.h" | 14 #include "chrome/browser/ui/webui/signin/signin_utils.h" |
14 #include "content/public/browser/web_ui.h" | 15 #include "content/public/browser/web_ui.h" |
15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
16 | 17 |
18 // static | |
19 SigninErrorHandler* SigninErrorHandler::Create(bool is_system_profile) { | |
20 if (is_system_profile) | |
21 return new SigninErrorWithoutBrowserHandler(); | |
pastarmovj
2016/09/21 08:44:10
I haven't looked at the calling site but it would
zmin
2016/09/21 16:40:04
The handler will be assigned to webui
https://cs.c
| |
22 else | |
23 return new SigninErrorHandler(); | |
24 } | |
25 | |
17 void SigninErrorHandler::RegisterMessages() { | 26 void SigninErrorHandler::RegisterMessages() { |
18 web_ui()->RegisterMessageCallback( | 27 web_ui()->RegisterMessageCallback( |
19 "confirm", | 28 "confirm", |
20 base::Bind(&SigninErrorHandler::HandleConfirm, base::Unretained(this))); | 29 base::Bind(&SigninErrorHandler::HandleConfirm, base::Unretained(this))); |
21 web_ui()->RegisterMessageCallback( | 30 web_ui()->RegisterMessageCallback( |
22 "switchToExistingProfile", | 31 "switchToExistingProfile", |
23 base::Bind(&SigninErrorHandler::HandleSwitchToExistingProfile, | 32 base::Bind(&SigninErrorHandler::HandleSwitchToExistingProfile, |
24 base::Unretained(this))); | 33 base::Unretained(this))); |
25 web_ui()->RegisterMessageCallback( | 34 web_ui()->RegisterMessageCallback( |
26 "learnMore", | 35 "learnMore", |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 // platforms and if there's a way to start unfocused while avoiding this | 76 // platforms and if there's a way to start unfocused while avoiding this |
68 // workaround. | 77 // workaround. |
69 web_ui()->CallJavascriptFunctionUnsafe("signin.error.clearFocus"); | 78 web_ui()->CallJavascriptFunctionUnsafe("signin.error.clearFocus"); |
70 } | 79 } |
71 | 80 |
72 void SigninErrorHandler::CloseDialog() { | 81 void SigninErrorHandler::CloseDialog() { |
73 Browser* browser = signin::GetDesktopBrowser(web_ui()); | 82 Browser* browser = signin::GetDesktopBrowser(web_ui()); |
74 DCHECK(browser); | 83 DCHECK(browser); |
75 browser->CloseModalSigninWindow(); | 84 browser->CloseModalSigninWindow(); |
76 } | 85 } |
86 | |
87 SigninErrorWithoutBrowserHandler::SigninErrorWithoutBrowserHandler() | |
88 : SigninErrorHandler() {} | |
89 | |
90 void SigninErrorWithoutBrowserHandler::CloseDialog() { | |
91 UserManager::HideReauthDialog(); | |
92 } | |
OLD | NEW |