Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.h

Issue 1534123002: [Extensions] Migrate ExtensionInstallPrompt::Delegate to be a callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIALOG_ HELPER_H_ 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_ 6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIALOG_ HELPER_H_
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/extensions/extension_install_prompt.h" 11 #include "chrome/browser/extensions/extension_install_prompt.h"
12 12
13 class Profile; 13 class Profile;
14 14
15 namespace content { 15 namespace content {
16 class BrowserContext; 16 class BrowserContext;
17 class WebContents; 17 class WebContents;
18 } 18 }
19 19
20 namespace extensions { 20 namespace extensions {
21 class Extension; 21 class Extension;
22 22
23 // Helper class to handle showing a permissions dialog for an extension. Will 23 // Helper class to handle showing a permissions dialog for an extension. Will
24 // show either the newer AppInfo-style permissions dialog, or the traditional, 24 // show either the newer AppInfo-style permissions dialog, or the traditional,
25 // install-prompt style dialog. 25 // install-prompt style dialog.
26 class ShowPermissionsDialogHelper : public ExtensionInstallPrompt::Delegate { 26 class ShowPermissionsDialogHelper {
27 public: 27 public:
28 static void Show(content::BrowserContext* browser_context, 28 static void Show(content::BrowserContext* browser_context,
29 content::WebContents* web_contents, 29 content::WebContents* web_contents,
30 const Extension* extension, 30 const Extension* extension,
31 bool from_webui, 31 bool from_webui,
32 const base::Closure& on_complete); 32 const base::Closure& on_complete);
33 33
34 private: 34 private:
35 ShowPermissionsDialogHelper(Profile* profile, 35 ShowPermissionsDialogHelper(Profile* profile,
36 const base::Closure& on_complete); 36 const base::Closure& on_complete);
37 ~ShowPermissionsDialogHelper() override; // Manages its own lifetime. 37 ~ShowPermissionsDialogHelper(); // Manages its own lifetime.
38 38
39 // Shows the old-style (not AppInfo) permissions dialog. 39 // Shows the old-style (not AppInfo) permissions dialog.
40 void ShowPermissionsDialog(content::WebContents* web_contents, 40 void ShowPermissionsDialog(content::WebContents* web_contents,
41 const Extension* extension); 41 const Extension* extension);
42 42
43 // ExtensionInstallPrompt::Delegate: 43 void OnInstallPromptDone(ExtensionInstallPrompt::Result result);
44 void InstallUIProceed() override;
45 void InstallUIAbort(bool user_initiated) override;
46 44
47 scoped_ptr<ExtensionInstallPrompt> prompt_; 45 scoped_ptr<ExtensionInstallPrompt> prompt_;
48 46
49 Profile* profile_; 47 Profile* profile_;
50 48
51 base::Closure on_complete_; 49 base::Closure on_complete_;
52 50
53 std::string extension_id_; 51 std::string extension_id_;
54 52
55 DISALLOW_COPY_AND_ASSIGN(ShowPermissionsDialogHelper); 53 DISALLOW_COPY_AND_ASSIGN(ShowPermissionsDialogHelper);
56 }; 54 };
57 55
58 } // namespace extensions 56 } // namespace extensions
59 57
60 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIAL OG_HELPER_H_ 58 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIAL OG_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698