summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/ui/views/first_run_dialog.cc23
-rw-r--r--chrome/browser/ui/views/first_run_dialog.h14
2 files changed, 16 insertions, 21 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;
-}
diff --git a/chrome/browser/ui/views/first_run_dialog.h b/chrome/browser/ui/views/first_run_dialog.h
index 9e374a6..2eb9d5d 100644
--- a/chrome/browser/ui/views/first_run_dialog.h
+++ b/chrome/browser/ui/views/first_run_dialog.h
@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_H_
#define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_H_
-#include "base/message_loop/message_pump_dispatcher.h"
#include "ui/views/controls/link_listener.h"
#include "ui/views/window/dialog_delegate.h"
@@ -17,8 +16,7 @@ class Link;
}
class FirstRunDialog : public views::DialogDelegateView,
- public views::LinkListener,
- public base::MessagePumpDispatcher {
+ public views::LinkListener {
public:
// Displays the first run UI for reporting opt-in, import data etc.
// Returns true if the dialog was shown.
@@ -28,6 +26,9 @@ class FirstRunDialog : public views::DialogDelegateView,
explicit FirstRunDialog(Profile* profile);
virtual ~FirstRunDialog();
+ // This terminates the nested message-loop.
+ void Done();
+
// views::DialogDelegate:
virtual views::View* CreateExtraView() OVERRIDE;
virtual void OnClosed() OVERRIDE;
@@ -37,16 +38,11 @@ class FirstRunDialog : public views::DialogDelegateView,
// views::LinkListener:
virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
- // Overridden from MessagePumpDispatcher:
- virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE;
-
Profile* profile_;
views::Checkbox* make_default_;
views::Checkbox* report_crashes_;
- // Set to false as soon as the user clicks a dialog button; this tells the
- // dispatcher we're done.
- bool should_show_dialog_;
+ DISALLOW_COPY_AND_ASSIGN(FirstRunDialog);
};
#endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_H_