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

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: remove unused header include 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..a737bdec30537efb12581281bb2cfa2c5ddd175d 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
@@ -19,7 +19,7 @@
#include "chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
+#include "chrome/browser/ui/browser_window.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/url_formatter/elide_url.h"
@@ -68,14 +68,21 @@ void OnModelCreated(std::unique_ptr<SettingsResetPromptModel> model) {
// Ensure that there is at least one non-incognito browser open for the
// profile before attempting to show the dialog.
- if (!chrome::FindTabbedBrowser(profile, /*match_original_profiles=*/false))
+ Browser* browser =
+ chrome::FindTabbedBrowser(profile, /*match_original_profiles=*/false);
+ if (!browser)
return;
- chrome::ScopedTabbedBrowserDisplayer displayer(profile);
+ // First, show the browser window, and only then show the dialog so that the
+ // dialog will have focus.
+ if (browser->window()->IsMinimized())
+ browser->window()->Restore();
+ browser->window()->Show();
+
// 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