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" | 12 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
13 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
14 #include "ui/base/ui_base_types.h" | 14 #include "ui/base/ui_base_types.h" |
15 #include "ui/views/window/dialog_delegate.h" | 15 #include "ui/views/window/dialog_delegate.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class WebContents; | 18 class WebContents; |
19 } // namespace content | 19 } // namespace content |
20 | 20 |
21 namespace file_manager { | 21 namespace file_manager { |
22 class Volume; | 22 class Volume; |
23 } // namespace file_manager | 23 } // namespace file_manager |
24 | 24 |
25 namespace views { | 25 namespace views { |
26 class View; | 26 class View; |
27 } // namespace views | 27 } // namespace views |
28 | 28 |
29 // Represents a dialog shown to a user for granting access to a file system. | 29 // Represents a dialog shown to a user for granting access to a file system. |
30 class RequestFileSystemDialogView : public views::DialogDelegate { | 30 class RequestFileSystemDialogView : public views::DialogDelegateView { |
31 public: | 31 public: |
32 ~RequestFileSystemDialogView() override; | 32 ~RequestFileSystemDialogView() override; |
33 | 33 |
34 // Shows the dialog and calls |callback| on completion. | 34 // Shows the dialog and calls |callback| on completion. |
35 static void ShowDialog( | 35 static void ShowDialog( |
36 content::WebContents* web_contents, | 36 content::WebContents* web_contents, |
37 const extensions::Extension& extension, | 37 const extensions::Extension& extension, |
38 base::WeakPtr<file_manager::Volume> volume, | 38 base::WeakPtr<file_manager::Volume> volume, |
39 bool writable, | 39 bool writable, |
40 const base::Callback<void(ui::DialogButton)>& callback); | 40 const base::Callback<void(ui::DialogButton)>& callback); |
41 | 41 |
42 // views::DialogDelegate overrides: | 42 // views::DialogDelegate overrides: |
43 base::string16 GetAccessibleWindowTitle() const override; | 43 base::string16 GetAccessibleWindowTitle() const override; |
44 int GetDefaultDialogButton() const override; | 44 int GetDefaultDialogButton() const override; |
45 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 45 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
46 ui::ModalType GetModalType() const override; | 46 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; | 47 bool Cancel() override; |
51 bool Accept() override; | 48 bool Accept() override; |
52 | 49 |
50 // View overrides: | |
Peter Kasting
2017/04/26 18:26:25
Nit: You don't subclass View, just DialogDelegateV
ananta
2017/04/26 19:42:21
Done.
| |
51 gfx::Size GetPreferredSize() const override; | |
52 gfx::Insets GetInsets() const override; | |
53 | |
53 private: | 54 private: |
54 RequestFileSystemDialogView( | 55 RequestFileSystemDialogView( |
55 const extensions::Extension& extension, | 56 const extensions::Extension& extension, |
56 base::WeakPtr<file_manager::Volume> volume, | 57 base::WeakPtr<file_manager::Volume> volume, |
57 bool writable, | 58 bool writable, |
58 const base::Callback<void(ui::DialogButton)>& callback); | 59 const base::Callback<void(ui::DialogButton)>& callback); |
59 | 60 |
60 const base::Callback<void(ui::DialogButton)> callback_; | 61 const base::Callback<void(ui::DialogButton)> callback_; |
61 views::View* const contents_view_; | 62 views::View* const contents_view_; |
62 | 63 |
63 DISALLOW_COPY_AND_ASSIGN(RequestFileSystemDialogView); | 64 DISALLOW_COPY_AND_ASSIGN(RequestFileSystemDialogView); |
64 }; | 65 }; |
65 | 66 |
66 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_DIALOG_ VIEW_H_ | 67 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_REQUEST_FILE_SYSTEM_DIALOG_VIEW_H_ |
OLD | NEW |