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_
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/extensions/extension_install_prompt.h"
19 namespace extensions
{
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
{
27 static void Show(content::BrowserContext
* browser_context
,
28 content::WebContents
* web_contents
,
29 const Extension
* extension
,
31 const base::Closure
& on_complete
);
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_
;
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_