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

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

Issue 2496613002: [Merge] Fix "Switch to {Profile}..." focusing the wrong window. (Closed)
Patch Set: Created 4 years, 1 month 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 20 matching lines...) Expand all
31 web_ui()->RegisterMessageCallback( 31 web_ui()->RegisterMessageCallback(
32 "initializedWithSize", 32 "initializedWithSize",
33 base::Bind(&SigninErrorHandler::HandleInitializedWithSize, 33 base::Bind(&SigninErrorHandler::HandleInitializedWithSize,
34 base::Unretained(this))); 34 base::Unretained(this)));
35 } 35 }
36 36
37 void SigninErrorHandler::HandleSwitchToExistingProfile( 37 void SigninErrorHandler::HandleSwitchToExistingProfile(
38 const base::ListValue* args) { 38 const base::ListValue* args) {
39 if (duplicate_profile_path_.empty()) 39 if (duplicate_profile_path_.empty())
40 return; 40 return;
41
42 // CloseDialog will eventually destroy this object, so nothing should access
43 // its members after this call. However, closing the dialog may steal focus
44 // back to the original window, so make a copy of the path to switch to and
45 // perform the switch after the dialog is closed.
46 base::FilePath path_switching_to = duplicate_profile_path_;
47 CloseDialog();
48
41 // Switch to the existing duplicate profile. Do not create a new window when 49 // Switch to the existing duplicate profile. Do not create a new window when
42 // any existing ones can be reused. 50 // any existing ones can be reused.
43 profiles::SwitchToProfile(duplicate_profile_path_, false, 51 profiles::SwitchToProfile(path_switching_to, false,
44 ProfileManager::CreateCallback(), 52 ProfileManager::CreateCallback(),
45 ProfileMetrics::SWITCH_PROFILE_DUPLICATE); 53 ProfileMetrics::SWITCH_PROFILE_DUPLICATE);
46 // CloseDialog will eventually destroy this object, so nothing should access
47 // its members after this call.
48 CloseDialog();
49 } 54 }
50 55
51 void SigninErrorHandler::HandleConfirm(const base::ListValue* args) { 56 void SigninErrorHandler::HandleConfirm(const base::ListValue* args) {
52 CloseDialog(); 57 CloseDialog();
53 } 58 }
54 59
55 void SigninErrorHandler::HandleLearnMore(const base::ListValue* args) { 60 void SigninErrorHandler::HandleLearnMore(const base::ListValue* args) {
56 Browser* browser = signin::GetDesktopBrowser(web_ui()); 61 Browser* browser = signin::GetDesktopBrowser(web_ui());
57 DCHECK(browser); 62 DCHECK(browser);
58 browser->CloseModalSigninWindow(); 63 browser->CloseModalSigninWindow();
(...skipping 19 matching lines...) Expand all
78 if (is_system_profile_) { 83 if (is_system_profile_) {
79 // Avoid closing the user manager window when the error message is displayed 84 // Avoid closing the user manager window when the error message is displayed
80 // without browser window. 85 // without browser window.
81 UserManager::HideReauthDialog(); 86 UserManager::HideReauthDialog();
82 } else { 87 } else {
83 Browser* browser = signin::GetDesktopBrowser(web_ui()); 88 Browser* browser = signin::GetDesktopBrowser(web_ui());
84 DCHECK(browser); 89 DCHECK(browser);
85 browser->CloseModalSigninWindow(); 90 browser->CloseModalSigninWindow();
86 } 91 }
87 } 92 }
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