OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_REQUEST_FILE_SYSTEM_DIALOG_VIEW_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_REQUEST_FILE_SYSTEM_DIALOG_VIEW_H_ | |
7 | |
8 #include "base/callback_forward.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "base/strings/string16.h" | |
12 #include "ui/base/ui_base_types.h" | |
13 #include "ui/views/window/dialog_delegate.h" | |
14 | |
15 namespace content { | |
16 class WebContents; | |
17 } // namespace content | |
18 | |
19 namespace views { | |
20 class View; | |
21 } // namespace views | |
22 | |
23 // Represents a dialog shown to a user for granting access to a file system. | |
24 class RequestFileSystemDialogView : public views::DialogDelegateView { | |
25 public: | |
26 ~RequestFileSystemDialogView() override; | |
27 | |
28 // Shows the dialog and calls |callback| on completion. | |
29 static void ShowDialog( | |
30 content::WebContents* web_contents, | |
31 const std::string& extension_name, | |
32 const std::string& volume_label, | |
33 bool writable, | |
34 const base::Callback<void(ui::DialogButton)>& callback); | |
35 | |
36 // views::DialogDelegate overrides: | |
37 base::string16 GetAccessibleWindowTitle() const override; | |
38 int GetDefaultDialogButton() const override; | |
39 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | |
40 ui::ModalType GetModalType() const override; | |
41 bool Cancel() override; | |
42 bool Accept() override; | |
43 gfx::Size GetPreferredSize() const override; | |
44 gfx::Insets GetInsets() const override; | |
45 | |
46 private: | |
47 RequestFileSystemDialogView( | |
48 const std::string& extension_name, | |
49 const std::string& volume_label, | |
50 bool writable, | |
51 const base::Callback<void(ui::DialogButton)>& callback); | |
52 | |
53 const base::Callback<void(ui::DialogButton)> callback_; | |
54 views::View* const contents_view_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(RequestFileSystemDialogView); | |
57 }; | |
58 | |
59 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_REQUEST_FILE_SYSTEM_DIALOG_VIEW_H_ | |
OLD | NEW |