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

Unified Diff: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc

Issue 2764033004: Settings reset prompt: the dialog should have focus when shown. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc
diff --git a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc
index 1cce55ebc0959f5c33286b67a3272bd9f443f175..ed1f918ca8c6c1201bb6d0c95f3e84de5ee7e00b 100644
--- a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc
+++ b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc
@@ -71,11 +71,17 @@ void OnModelCreated(std::unique_ptr<SettingsResetPromptModel> model) {
if (!chrome::FindTabbedBrowser(profile, /*match_original_profiles=*/false))
return;
- chrome::ScopedTabbedBrowserDisplayer displayer(profile);
+ // First, find a browser window and show it, and only then show the dialog so
+ // that the dialog will have focus.
+ Browser* browser = nullptr;
+ {
+ chrome::ScopedTabbedBrowserDisplayer displayer(profile);
sky 2017/03/21 20:36:01 If a new browser is created by ScopedTabbedBrowser
alito2 2017/03/21 20:44:17 Just above this line, I do make sure that there is
sky 2017/03/21 20:52:18 Indeed. In that case you should use the return val
alito 2017/03/21 21:02:42 Done.
+ browser = displayer.browser();
+ }
// The |SettingsResetPromptController| object will delete itself after the
// reset prompt dialog has been closed.
SettingsResetPromptController::ShowSettingsResetPrompt(
- displayer.browser(), new SettingsResetPromptController(std::move(model)));
+ browser, new SettingsResetPromptController(std::move(model)));
}
void MaybeShowSettingsResetPrompt(
« 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