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

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

Issue 2351173004: Display local signin error without browser and record the path of selected profile in user manager. (Closed)
Patch Set: cr Created 4 years, 3 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_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 SigninErrorHandler::SigninErrorHandler(bool is_system_profile)
19 : is_system_profile_(is_system_profile) {}
20
17 void SigninErrorHandler::RegisterMessages() { 21 void SigninErrorHandler::RegisterMessages() {
18 web_ui()->RegisterMessageCallback( 22 web_ui()->RegisterMessageCallback(
19 "confirm", 23 "confirm",
20 base::Bind(&SigninErrorHandler::HandleConfirm, base::Unretained(this))); 24 base::Bind(&SigninErrorHandler::HandleConfirm, base::Unretained(this)));
21 web_ui()->RegisterMessageCallback( 25 web_ui()->RegisterMessageCallback(
22 "switchToExistingProfile", 26 "switchToExistingProfile",
23 base::Bind(&SigninErrorHandler::HandleSwitchToExistingProfile, 27 base::Bind(&SigninErrorHandler::HandleSwitchToExistingProfile,
24 base::Unretained(this))); 28 base::Unretained(this)));
25 web_ui()->RegisterMessageCallback( 29 web_ui()->RegisterMessageCallback(
26 "learnMore", 30 "learnMore",
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 67
64 // After the dialog is shown, some platforms might have an element focused. 68 // After the dialog is shown, some platforms might have an element focused.
65 // To be consistent, clear the focused element on all platforms. 69 // To be consistent, clear the focused element on all platforms.
66 // TODO(anthonyvd): Figure out why this is needed on Mac and not other 70 // TODO(anthonyvd): Figure out why this is needed on Mac and not other
67 // platforms and if there's a way to start unfocused while avoiding this 71 // platforms and if there's a way to start unfocused while avoiding this
68 // workaround. 72 // workaround.
69 web_ui()->CallJavascriptFunctionUnsafe("signin.error.clearFocus"); 73 web_ui()->CallJavascriptFunctionUnsafe("signin.error.clearFocus");
70 } 74 }
71 75
72 void SigninErrorHandler::CloseDialog() { 76 void SigninErrorHandler::CloseDialog() {
73 Browser* browser = signin::GetDesktopBrowser(web_ui()); 77 if (is_system_profile_) {
74 DCHECK(browser); 78 UserManager::HideReauthDialog();
75 browser->CloseModalSigninWindow(); 79 } else {
80 Browser* browser = signin::GetDesktopBrowser(web_ui());
81 DCHECK(browser);
82 browser->CloseModalSigninWindow();
83 }
76 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698