Chromium Code Reviews| 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_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIALOG_ HELPER_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIALOG_ HELPER_H_ | |
| 7 | |
| 8 #include "base/bind.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "chrome/browser/extensions/extension_install_prompt.h" | |
| 11 | |
| 12 class Profile; | |
| 13 | |
| 14 namespace content { | |
| 15 class BrowserContext; | |
| 16 class WebContents; | |
| 17 } | |
| 18 | |
| 19 namespace extensions { | |
| 20 class Extension; | |
| 21 | |
| 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::WebContents* web_contents, | |
| 28 content::BrowserContext* browser_context, | |
|
not at google - send to devlin
2015/03/16 17:39:55
I don't think it's necessarily worth taking action
Devlin
2015/03/16 21:10:55
I figured best to avoid the GetBrowserContext() on
| |
| 29 const Extension* extension, | |
| 30 bool from_extensions_page, | |
|
not at google - send to devlin
2015/03/16 17:39:55
This flag is actually a bit confusing. I don't kno
Devlin
2015/03/16 21:10:55
The reason I said from_extensions_page was to matc
| |
| 31 const base::Closure& on_complete); | |
| 32 | |
| 33 private: | |
| 34 ShowPermissionsDialogHelper(Profile* profile, | |
| 35 const base::Closure& on_complete); | |
| 36 ~ShowPermissionsDialogHelper() override; // Manages its own lifetime. | |
| 37 | |
| 38 // Shows the old-style (not AppInfo) permissions dialog. | |
| 39 void ShowPermissionsDialog(content::WebContents* web_contents, | |
| 40 const Extension* extension); | |
| 41 | |
| 42 // ExtensionInstallPrompt::Delegate: | |
| 43 void InstallUIProceed() override; | |
| 44 void InstallUIAbort(bool user_initiated) override; | |
| 45 | |
| 46 scoped_ptr<ExtensionInstallPrompt> prompt_; | |
| 47 | |
| 48 Profile* profile_; | |
| 49 | |
| 50 base::Closure on_complete_; | |
| 51 | |
| 52 std::string extension_id_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(ShowPermissionsDialogHelper); | |
| 55 }; | |
| 56 | |
| 57 } // namespace extensions | |
| 58 | |
| 59 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIAL OG_HELPER_H_ | |
| OLD | NEW |