Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / user_data_dir_dialog_view.h
blob085774a7c8a6e48b2bab37542a3f70eb186a2204
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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_VIEW_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h"
11 #include "base/message_loop/message_pump_dispatcher.h"
12 #include "ui/shell_dialogs/select_file_dialog.h"
13 #include "ui/views/window/dialog_delegate.h"
15 namespace views {
16 class MessageBoxView;
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.
21 class UserDataDirDialogView : public views::DialogDelegate,
22 public base::MessagePumpDispatcher,
23 public ui::SelectFileDialog::Listener {
24 public:
25 explicit UserDataDirDialogView(const base::FilePath& user_data_dir);
26 virtual ~UserDataDirDialogView();
28 base::FilePath user_data_dir() const { return user_data_dir_; }
30 // Overridden from views::DialogDelegate:
31 virtual base::string16 GetDialogButtonLabel(
32 ui::DialogButton button) const OVERRIDE;
33 virtual base::string16 GetWindowTitle() const OVERRIDE;
34 virtual void DeleteDelegate() OVERRIDE;
35 virtual bool Accept() OVERRIDE;
36 virtual bool Cancel() OVERRIDE;
38 // Overridden from views::WidgetDelegate:
39 virtual views::View* GetContentsView() OVERRIDE;
40 virtual views::Widget* GetWidget() OVERRIDE;
41 virtual const views::Widget* GetWidget() const OVERRIDE;
43 // Overridden from MessagePumpDispatcher:
44 virtual bool Dispatch(const base::NativeEvent& msg) OVERRIDE;
46 // Overridden from SelectFileDialog::Listener:
47 virtual void FileSelected(const base::FilePath& path,
48 int index,
49 void* params) OVERRIDE;
50 virtual void FileSelectionCanceled(void* params) OVERRIDE;
52 private:
53 // Empty until the user picks a directory.
54 base::FilePath user_data_dir_;
56 views::MessageBoxView* message_box_view_;
57 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
59 // Used to keep track of whether or not to block the message loop (still
60 // waiting for the user to dismiss the dialog).
61 bool is_blocking_;
63 DISALLOW_COPY_AND_ASSIGN(UserDataDirDialogView);
66 #endif // CHROME_BROWSER_UI_VIEWS_USER_DATA_DIR_DIALOG_VIEW_H_