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

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

Issue 10382155: browser: Refactor the way to show the user data dir dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // A dialog box that tells the user that we can't write to the specified user
6 // data directory. Provides the user a chance to pick a different directory.
7
8 #ifndef CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_H_
9 #define CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_H_
10 #pragma once
11
12 #include "base/basictypes.h"
13 #include "base/message_loop.h"
14 #include "chrome/browser/ui/select_file_dialog.h"
15 #include "ui/views/window/dialog_delegate.h"
16
17 class FilePath;
18
19 namespace views {
20 class MessageBoxView;
21 }
22
23 class UserDataDirDialog : public views::DialogDelegate,
24 public MessageLoopForUI::Dispatcher,
25 public SelectFileDialog::Listener {
26 public:
27 // Creates and runs a user data directory picker dialog. The method blocks
28 // while the dialog is showing. If the user picks a directory, this method
29 // returns the chosen directory. |user_data_dir| is the value of the
30 // directory we were not able to use.
31 static FilePath RunUserDataDirDialog(const FilePath& user_data_dir);
32 virtual ~UserDataDirDialog();
33
34 FilePath user_data_dir() const { return user_data_dir_; }
35
36 // views::DialogDelegate methods:
37 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE;
38 virtual string16 GetWindowTitle() const OVERRIDE;
39 virtual void DeleteDelegate() OVERRIDE;
40 virtual bool Accept() OVERRIDE;
41 virtual bool Cancel() OVERRIDE;
42
43 // views::WidgetDelegate methods:
44 virtual views::View* GetContentsView() OVERRIDE;
45 virtual views::Widget* GetWidget() OVERRIDE;
46 virtual const views::Widget* GetWidget() const OVERRIDE;
47
48 // MessageLoop::Dispatcher method:
49 virtual bool Dispatch(const base::NativeEvent& msg) OVERRIDE;
50
51 // SelectFileDialog::Listener methods:
52 virtual void FileSelected(const FilePath& path,
53 int index,
54 void* params) OVERRIDE;
55 virtual void FileSelectionCanceled(void* params) OVERRIDE;
56
57 private:
58 explicit UserDataDirDialog(const FilePath& user_data_dir);
59
60 // Empty until the user picks a directory.
61 FilePath user_data_dir_;
62
63 views::MessageBoxView* message_box_view_;
64 scoped_refptr<SelectFileDialog> select_file_dialog_;
65
66 // Used to keep track of whether or not to block the message loop (still
67 // waiting for the user to dismiss the dialog).
68 bool is_blocking_;
69
70 DISALLOW_COPY_AND_ASSIGN(UserDataDirDialog);
71 };
72
73 #endif // CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/user_data_dir_dialog.h ('k') | chrome/browser/ui/views/user_data_dir_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698