Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / api / developer_private / show_permissions_dialog_helper.h
blob474eb37eb3cf87b54f3722f7d737e5b74e449ae2
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_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIALOG_HELPER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIALOG_HELPER_H_
8 #include "base/bind.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/extensions/extension_install_prompt.h"
12 class Profile;
14 namespace content {
15 class BrowserContext;
16 class WebContents;
19 namespace extensions {
20 class Extension;
22 // Helper class to handle showing a permissions dialog for an extension. Will
23 // show either the newer AppInfo-style permissions dialog, or the traditional,
24 // install-prompt style dialog.
25 class ShowPermissionsDialogHelper : public ExtensionInstallPrompt::Delegate {
26 public:
27 static void Show(content::BrowserContext* browser_context,
28 content::WebContents* web_contents,
29 const Extension* extension,
30 bool from_webui,
31 const base::Closure& on_complete);
33 private:
34 ShowPermissionsDialogHelper(Profile* profile,
35 const base::Closure& on_complete);
36 ~ShowPermissionsDialogHelper() override; // Manages its own lifetime.
38 // Shows the old-style (not AppInfo) permissions dialog.
39 void ShowPermissionsDialog(content::WebContents* web_contents,
40 const Extension* extension);
42 // ExtensionInstallPrompt::Delegate:
43 void InstallUIProceed() override;
44 void InstallUIAbort(bool user_initiated) override;
46 scoped_ptr<ExtensionInstallPrompt> prompt_;
48 Profile* profile_;
50 base::Closure on_complete_;
52 std::string extension_id_;
54 DISALLOW_COPY_AND_ASSIGN(ShowPermissionsDialogHelper);
57 } // namespace extensions
59 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIALOG_HELPER_H_