| 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_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_DIALOG_VIE
W_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_DIALOG_VIE
W_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 "chrome/browser/chromeos/file_manager/volume_manager.h" | |
| 13 #include "extensions/common/extension.h" | |
| 14 #include "ui/base/ui_base_types.h" | |
| 15 #include "ui/views/window/dialog_delegate.h" | |
| 16 | |
| 17 namespace content { | |
| 18 class WebContents; | |
| 19 } // namespace content | |
| 20 | |
| 21 namespace file_manager { | |
| 22 class Volume; | |
| 23 } // namespace file_manager | |
| 24 | |
| 25 namespace views { | |
| 26 class View; | |
| 27 } // namespace views | |
| 28 | |
| 29 // Represents a dialog shown to a user for granting access to a file system. | |
| 30 class RequestFileSystemDialogView : public views::DialogDelegate { | |
| 31 public: | |
| 32 ~RequestFileSystemDialogView() override; | |
| 33 | |
| 34 // Shows the dialog and calls |callback| on completion. | |
| 35 static void ShowDialog( | |
| 36 content::WebContents* web_contents, | |
| 37 const extensions::Extension& extension, | |
| 38 base::WeakPtr<file_manager::Volume> volume, | |
| 39 bool writable, | |
| 40 const base::Callback<void(ui::DialogButton)>& callback); | |
| 41 | |
| 42 // views::DialogDelegate overrides: | |
| 43 base::string16 GetAccessibleWindowTitle() const override; | |
| 44 int GetDefaultDialogButton() const override; | |
| 45 base::string16 GetDialogButtonLabel(ui::DialogButton button) 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; | |
| 51 bool Accept() override; | |
| 52 | |
| 53 private: | |
| 54 RequestFileSystemDialogView( | |
| 55 const extensions::Extension& extension, | |
| 56 base::WeakPtr<file_manager::Volume> volume, | |
| 57 bool writable, | |
| 58 const base::Callback<void(ui::DialogButton)>& callback); | |
| 59 | |
| 60 const base::Callback<void(ui::DialogButton)> callback_; | |
| 61 views::View* const contents_view_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(RequestFileSystemDialogView); | |
| 64 }; | |
| 65 | |
| 66 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_DIALOG_
VIEW_H_ | |
| OLD | NEW |