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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_DIALOG_VIEW_H_
8 #include "base/callback_forward.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/strings/string16.h"
11 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
12 #include "extensions/common/extension.h"
13 #include "ui/base/ui_base_types.h"
14 #include "ui/views/window/dialog_delegate.h"
18 } // namespace content
20 namespace file_manager
{
22 } // namespace file_manager
28 // Represents a dialog shown to a user for granting access to a file system.
29 class RequestFileSystemDialogView
: public views::DialogDelegate
{
31 ~RequestFileSystemDialogView() override
;
33 // Shows the dialog and calls |callback| on completion.
34 static void ShowDialog(
35 content::WebContents
* web_contents
,
36 const extensions::Extension
& extension
,
37 base::WeakPtr
<file_manager::Volume
> volume
,
39 const base::Callback
<void(ui::DialogButton
)>& callback
);
41 // views::DialogDelegate overrides:
42 base::string16
GetDialogTitle() const override
;
43 int GetDefaultDialogButton() const override
;
44 base::string16
GetDialogButtonLabel(ui::DialogButton button
) const override
;
45 ui::ModalType
GetModalType() const override
;
46 views::View
* GetContentsView() override
;
47 views::Widget
* GetWidget() override
;
48 const views::Widget
* GetWidget() const override
;
49 bool Cancel() override
;
50 bool Accept() override
;
53 RequestFileSystemDialogView(
54 const extensions::Extension
& extension
,
55 base::WeakPtr
<file_manager::Volume
> volume
,
57 const base::Callback
<void(ui::DialogButton
)>& callback
);
59 const base::Callback
<void(ui::DialogButton
)> callback_
;
60 views::View
* const contents_view_
;
62 DISALLOW_COPY_AND_ASSIGN(RequestFileSystemDialogView
);
65 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_DIALOG_VIEW_H_