Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / extensions / api / file_system / request_file_system_dialog_view.h
blobf662a03bfdf760cb05927f9ef29dc121df0a723d
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"
16 namespace content {
17 class WebContents;
18 } // namespace content
20 namespace file_manager {
21 class Volume;
22 } // namespace file_manager
24 namespace views {
25 class View;
26 } // namespace views
28 // Represents a dialog shown to a user for granting access to a file system.
29 class RequestFileSystemDialogView : public views::DialogDelegate {
30 public:
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,
38 bool writable,
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;
52 private:
53 RequestFileSystemDialogView(
54 const extensions::Extension& extension,
55 base::WeakPtr<file_manager::Volume> volume,
56 bool writable,
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_