OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_DIALOG_VIE
W_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_REQUEST_FILE_SYSTEM_DIALOG_VIEW_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_DIALOG_VIE
W_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_REQUEST_FILE_SYSTEM_DIALOG_VIEW_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | |
13 #include "extensions/common/extension.h" | |
14 #include "ui/base/ui_base_types.h" | 12 #include "ui/base/ui_base_types.h" |
15 #include "ui/views/window/dialog_delegate.h" | 13 #include "ui/views/window/dialog_delegate.h" |
16 | 14 |
17 namespace content { | 15 namespace content { |
18 class WebContents; | 16 class WebContents; |
19 } // namespace content | 17 } // namespace content |
20 | 18 |
21 namespace file_manager { | |
22 class Volume; | |
23 } // namespace file_manager | |
24 | |
25 namespace views { | 19 namespace views { |
26 class View; | 20 class View; |
27 } // namespace views | 21 } // namespace views |
28 | 22 |
29 // Represents a dialog shown to a user for granting access to a file system. | 23 // Represents a dialog shown to a user for granting access to a file system. |
30 class RequestFileSystemDialogView : public views::DialogDelegate { | 24 class RequestFileSystemDialogView : public views::DialogDelegateView { |
31 public: | 25 public: |
32 ~RequestFileSystemDialogView() override; | 26 ~RequestFileSystemDialogView() override; |
33 | 27 |
34 // Shows the dialog and calls |callback| on completion. | 28 // Shows the dialog and calls |callback| on completion. |
35 static void ShowDialog( | 29 static void ShowDialog( |
36 content::WebContents* web_contents, | 30 content::WebContents* web_contents, |
37 const extensions::Extension& extension, | 31 const std::string& extension_name, |
38 base::WeakPtr<file_manager::Volume> volume, | 32 const std::string& volume_label, |
39 bool writable, | 33 bool writable, |
40 const base::Callback<void(ui::DialogButton)>& callback); | 34 const base::Callback<void(ui::DialogButton)>& callback); |
41 | 35 |
42 // views::DialogDelegate overrides: | 36 // views::DialogDelegate overrides: |
43 base::string16 GetAccessibleWindowTitle() const override; | 37 base::string16 GetAccessibleWindowTitle() const override; |
44 int GetDefaultDialogButton() const override; | 38 int GetDefaultDialogButton() const override; |
45 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 39 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
46 ui::ModalType GetModalType() const override; | 40 ui::ModalType GetModalType() const override; |
47 views::View* GetContentsView() override; | |
48 views::Widget* GetWidget() override; | |
49 const views::Widget* GetWidget() const override; | |
50 bool Cancel() override; | 41 bool Cancel() override; |
51 bool Accept() override; | 42 bool Accept() override; |
| 43 gfx::Size GetPreferredSize() const override; |
| 44 gfx::Insets GetInsets() const override; |
52 | 45 |
53 private: | 46 private: |
54 RequestFileSystemDialogView( | 47 RequestFileSystemDialogView( |
55 const extensions::Extension& extension, | 48 const std::string& extension_name, |
56 base::WeakPtr<file_manager::Volume> volume, | 49 const std::string& volume_label, |
57 bool writable, | 50 bool writable, |
58 const base::Callback<void(ui::DialogButton)>& callback); | 51 const base::Callback<void(ui::DialogButton)>& callback); |
59 | 52 |
60 const base::Callback<void(ui::DialogButton)> callback_; | 53 const base::Callback<void(ui::DialogButton)> callback_; |
61 views::View* const contents_view_; | 54 views::View* const contents_view_; |
62 | 55 |
63 DISALLOW_COPY_AND_ASSIGN(RequestFileSystemDialogView); | 56 DISALLOW_COPY_AND_ASSIGN(RequestFileSystemDialogView); |
64 }; | 57 }; |
65 | 58 |
66 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_DIALOG_
VIEW_H_ | 59 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_REQUEST_FILE_SYSTEM_DIALOG_VIEW_H_ |
OLD | NEW |