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

Side by Side Diff: chrome/browser/ui/views/user_data_dir_dialog_view.h

Issue 135563004: Nukes MessageLoop::Dispatcher (2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_USER_DATA_DIR_DIALOG_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_VIEW_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_pump_dispatcher.h"
12 #include "ui/shell_dialogs/select_file_dialog.h" 12 #include "ui/shell_dialogs/select_file_dialog.h"
13 #include "ui/views/window/dialog_delegate.h" 13 #include "ui/views/window/dialog_delegate.h"
14 14
15 namespace views { 15 namespace views {
16 class MessageBoxView; 16 class MessageBoxView;
17 } 17 }
18 18
19 // A dialog box that tells the user that we can't write to the specified user 19 // A dialog box that tells the user that we can't write to the specified user
20 // data directory. Provides the user a chance to pick a different directory. 20 // data directory. Provides the user a chance to pick a different directory.
21 class UserDataDirDialogView : public views::DialogDelegate, 21 class UserDataDirDialogView : public views::DialogDelegate,
22 public base::MessageLoopForUI::Dispatcher, 22 public base::MessagePumpDispatcher,
23 public ui::SelectFileDialog::Listener { 23 public ui::SelectFileDialog::Listener {
24 public: 24 public:
25 explicit UserDataDirDialogView(const base::FilePath& user_data_dir); 25 explicit UserDataDirDialogView(const base::FilePath& user_data_dir);
26 virtual ~UserDataDirDialogView(); 26 virtual ~UserDataDirDialogView();
27 27
28 base::FilePath user_data_dir() const { return user_data_dir_; } 28 base::FilePath user_data_dir() const { return user_data_dir_; }
29 29
30 // Overridden from views::DialogDelegate: 30 // Overridden from views::DialogDelegate:
31 virtual base::string16 GetDialogButtonLabel( 31 virtual base::string16 GetDialogButtonLabel(
32 ui::DialogButton button) const OVERRIDE; 32 ui::DialogButton button) const OVERRIDE;
33 virtual base::string16 GetWindowTitle() const OVERRIDE; 33 virtual base::string16 GetWindowTitle() const OVERRIDE;
34 virtual void DeleteDelegate() OVERRIDE; 34 virtual void DeleteDelegate() OVERRIDE;
35 virtual bool Accept() OVERRIDE; 35 virtual bool Accept() OVERRIDE;
36 virtual bool Cancel() OVERRIDE; 36 virtual bool Cancel() OVERRIDE;
37 37
38 // Overridden from views::WidgetDelegate: 38 // Overridden from views::WidgetDelegate:
39 virtual views::View* GetContentsView() OVERRIDE; 39 virtual views::View* GetContentsView() OVERRIDE;
40 virtual views::Widget* GetWidget() OVERRIDE; 40 virtual views::Widget* GetWidget() OVERRIDE;
41 virtual const views::Widget* GetWidget() const OVERRIDE; 41 virtual const views::Widget* GetWidget() const OVERRIDE;
42 42
43 // Overridden from MessageLoopForUI::Dispatcher: 43 // Overridden from MessagePumpDispatcher:
44 virtual bool Dispatch(const base::NativeEvent& msg) OVERRIDE; 44 virtual bool Dispatch(const base::NativeEvent& msg) OVERRIDE;
45 45
46 // Overridden from SelectFileDialog::Listener: 46 // Overridden from SelectFileDialog::Listener:
47 virtual void FileSelected(const base::FilePath& path, 47 virtual void FileSelected(const base::FilePath& path,
48 int index, 48 int index,
49 void* params) OVERRIDE; 49 void* params) OVERRIDE;
50 virtual void FileSelectionCanceled(void* params) OVERRIDE; 50 virtual void FileSelectionCanceled(void* params) OVERRIDE;
51 51
52 private: 52 private:
53 // Empty until the user picks a directory. 53 // Empty until the user picks a directory.
54 base::FilePath user_data_dir_; 54 base::FilePath user_data_dir_;
55 55
56 views::MessageBoxView* message_box_view_; 56 views::MessageBoxView* message_box_view_;
57 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; 57 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
58 58
59 // Used to keep track of whether or not to block the message loop (still 59 // Used to keep track of whether or not to block the message loop (still
60 // waiting for the user to dismiss the dialog). 60 // waiting for the user to dismiss the dialog).
61 bool is_blocking_; 61 bool is_blocking_;
62 62
63 DISALLOW_COPY_AND_ASSIGN(UserDataDirDialogView); 63 DISALLOW_COPY_AND_ASSIGN(UserDataDirDialogView);
64 }; 64 };
65 65
66 #endif // CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_VIEW_H_ 66 #endif // CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698