OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_H_ |
7 | 7 |
| 8 #include "base/message_loop/message_pump_dispatcher.h" |
8 #include "ui/views/controls/link_listener.h" | 9 #include "ui/views/controls/link_listener.h" |
9 #include "ui/views/window/dialog_delegate.h" | 10 #include "ui/views/window/dialog_delegate.h" |
10 | 11 |
11 class Profile; | 12 class Profile; |
12 | 13 |
13 namespace views { | 14 namespace views { |
14 class Checkbox; | 15 class Checkbox; |
15 class Link; | 16 class Link; |
16 } | 17 } |
17 | 18 |
18 class FirstRunDialog : public views::DialogDelegateView, | 19 class FirstRunDialog : public views::DialogDelegateView, |
19 public views::LinkListener { | 20 public views::LinkListener, |
| 21 public base::MessagePumpDispatcher { |
20 public: | 22 public: |
21 // Displays the first run UI for reporting opt-in, import data etc. | 23 // Displays the first run UI for reporting opt-in, import data etc. |
22 // Returns true if the dialog was shown. | 24 // Returns true if the dialog was shown. |
23 static bool Show(Profile* profile); | 25 static bool Show(Profile* profile); |
24 | 26 |
25 private: | 27 private: |
26 explicit FirstRunDialog(Profile* profile); | 28 explicit FirstRunDialog(Profile* profile); |
27 virtual ~FirstRunDialog(); | 29 virtual ~FirstRunDialog(); |
28 | 30 |
29 // This terminates the nested message-loop. | |
30 void Done(); | |
31 | |
32 // views::DialogDelegate: | 31 // views::DialogDelegate: |
33 virtual views::View* CreateExtraView() OVERRIDE; | 32 virtual views::View* CreateExtraView() OVERRIDE; |
34 virtual void OnClosed() OVERRIDE; | 33 virtual void OnClosed() OVERRIDE; |
35 virtual bool Accept() OVERRIDE; | 34 virtual bool Accept() OVERRIDE; |
36 virtual int GetDialogButtons() const OVERRIDE; | 35 virtual int GetDialogButtons() const OVERRIDE; |
37 | 36 |
38 // views::LinkListener: | 37 // views::LinkListener: |
39 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 38 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
40 | 39 |
| 40 // Overridden from MessagePumpDispatcher: |
| 41 virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE; |
| 42 |
41 Profile* profile_; | 43 Profile* profile_; |
42 views::Checkbox* make_default_; | 44 views::Checkbox* make_default_; |
43 views::Checkbox* report_crashes_; | 45 views::Checkbox* report_crashes_; |
44 | 46 |
45 DISALLOW_COPY_AND_ASSIGN(FirstRunDialog); | 47 // Set to false as soon as the user clicks a dialog button; this tells the |
| 48 // dispatcher we're done. |
| 49 bool should_show_dialog_; |
46 }; | 50 }; |
47 | 51 |
48 #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_H_ | 52 #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_H_ |
OLD | NEW |