summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/first_run_dialog.cc
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-28 10:41:04 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-28 10:41:04 +0000
commit24d5f5688319b8b673a5b0121138d41ede949a71 (patch)
tree2d5caf8cff73d338312391a641587b6cf7c17975 /chrome/browser/ui/views/first_run_dialog.cc
parent900a3242b7d49415814ad43a24a57a9d61dfb211 (diff)
downloadchromium_src-24d5f5688319b8b673a5b0121138d41ede949a71.zip
chromium_src-24d5f5688319b8b673a5b0121138d41ede949a71.tar.gz
chromium_src-24d5f5688319b8b673a5b0121138d41ede949a71.tar.bz2
Use the default dispatcher where possible for nested message loops.
Notable changes: * Add QuitNestedMessageLoop() to client::DispatcherClient, which can be used to terminate a nested loop started by RunWithDispatcher(). * FirstRunDialog and SimpleMessageBoxViews are no longer MessagePumpDispatchers. The default dispatcher is used instead, and QuitNestedMessageLoop() is called to terminate the loop instead of returning POST_DISPATCH_QUIT_LOOP from the Dispatch() override. BUG=none R=sky@chromium.org Previously committed in r253723, but reverted in r253744 because it broke interactive_ui_tests on win-dbg. Review URL: https://codereview.chromium.org/182143002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254089 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/views/first_run_dialog.cc')
-rw-r--r--chrome/browser/ui/views/first_run_dialog.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/chrome/browser/ui/views/first_run_dialog.cc b/chrome/browser/ui/views/first_run_dialog.cc
index 2a236b5..dc84312 100644
--- a/chrome/browser/ui/views/first_run_dialog.cc
+++ b/chrome/browser/ui/views/first_run_dialog.cc
@@ -65,7 +65,7 @@ bool FirstRunDialog::Show(Profile* profile) {
aura::Window* anchor = dialog->GetWidget()->GetNativeWindow();
aura::client::DispatcherClient* client =
aura::client::GetDispatcherClient(anchor->GetRootWindow());
- client->RunWithDispatcher(dialog, anchor);
+ client->RunWithDispatcher(NULL, anchor);
dialog_shown = true;
}
#endif // defined(GOOGLE_CHROME_BUILD)
@@ -76,8 +76,7 @@ bool FirstRunDialog::Show(Profile* profile) {
FirstRunDialog::FirstRunDialog(Profile* profile)
: profile_(profile),
make_default_(NULL),
- report_crashes_(NULL),
- should_show_dialog_(true) {
+ report_crashes_(NULL) {
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
@@ -102,6 +101,13 @@ FirstRunDialog::FirstRunDialog(Profile* profile)
FirstRunDialog::~FirstRunDialog() {
}
+void FirstRunDialog::Done() {
+ aura::Window* window = GetWidget()->GetNativeView();
+ aura::client::DispatcherClient* client =
+ aura::client::GetDispatcherClient(window->GetRootWindow());
+ client->QuitNestedMessageLoop();
+}
+
views::View* FirstRunDialog::CreateExtraView() {
views::Link* link = new views::Link(l10n_util::GetStringUTF16(
IDS_LEARN_MORE));
@@ -110,12 +116,11 @@ views::View* FirstRunDialog::CreateExtraView() {
}
void FirstRunDialog::OnClosed() {
- should_show_dialog_ = false;
first_run::SetShouldShowWelcomePage();
+ Done();
}
bool FirstRunDialog::Accept() {
- should_show_dialog_ = false;
GetWidget()->Hide();
if (report_crashes_ && report_crashes_->checked()) {
@@ -128,6 +133,7 @@ bool FirstRunDialog::Accept() {
if (make_default_ && make_default_->checked())
ShellIntegration::SetAsDefaultBrowser();
+ Done();
return true;
}
@@ -138,10 +144,3 @@ int FirstRunDialog::GetDialogButtons() const {
void FirstRunDialog::LinkClicked(views::Link* source, int event_flags) {
platform_util::OpenExternal(profile_, GURL(chrome::kLearnMoreReportingURL));
}
-
-uint32_t FirstRunDialog::Dispatch(const base::NativeEvent& event) {
- uint32_t action = POST_DISPATCH_PERFORM_DEFAULT;
- if (!should_show_dialog_)
- action |= POST_DISPATCH_QUIT_LOOP;
- return action;
-}