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

Side by Side Diff: chrome/browser/extensions/api/permissions/permissions_api.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, 12 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PERMISSIONS_PERMISSIONS_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 DECLARE_EXTENSION_FUNCTION("permissions.remove", PERMISSIONS_REMOVE) 44 DECLARE_EXTENSION_FUNCTION("permissions.remove", PERMISSIONS_REMOVE)
45 45
46 protected: 46 protected:
47 ~PermissionsRemoveFunction() override {} 47 ~PermissionsRemoveFunction() override {}
48 48
49 // ExtensionFunction: 49 // ExtensionFunction:
50 bool RunSync() override; 50 bool RunSync() override;
51 }; 51 };
52 52
53 // chrome.permissions.request 53 // chrome.permissions.request
54 class PermissionsRequestFunction : public ChromeAsyncExtensionFunction, 54 class PermissionsRequestFunction : public ChromeAsyncExtensionFunction {
55 public ExtensionInstallPrompt::Delegate {
56 public: 55 public:
57 DECLARE_EXTENSION_FUNCTION("permissions.request", PERMISSIONS_REQUEST) 56 DECLARE_EXTENSION_FUNCTION("permissions.request", PERMISSIONS_REQUEST)
58 57
59 PermissionsRequestFunction(); 58 PermissionsRequestFunction();
60 59
61 // FOR TESTS ONLY to bypass the confirmation UI. 60 // FOR TESTS ONLY to bypass the confirmation UI.
62 static void SetAutoConfirmForTests(bool should_proceed); 61 static void SetAutoConfirmForTests(bool should_proceed);
63 static void SetIgnoreUserGestureForTests(bool ignore); 62 static void SetIgnoreUserGestureForTests(bool ignore);
64 63
65 // ExtensionInstallPrompt::Delegate:
66 void InstallUIProceed() override;
67 void InstallUIAbort(bool user_initiated) override;
68
69 protected: 64 protected:
70 ~PermissionsRequestFunction() override; 65 ~PermissionsRequestFunction() override;
71 66
72 // ExtensionFunction: 67 // ExtensionFunction:
73 bool RunAsync() override; 68 bool RunAsync() override;
74 69
75 private: 70 private:
71 void OnInstallPromptDone(ExtensionInstallPrompt::Result result);
72
76 scoped_ptr<ExtensionInstallPrompt> install_ui_; 73 scoped_ptr<ExtensionInstallPrompt> install_ui_;
77 scoped_ptr<const PermissionSet> requested_permissions_; 74 scoped_ptr<const PermissionSet> requested_permissions_;
75
76 DISALLOW_COPY_AND_ASSIGN(PermissionsRequestFunction);
Avi (use Gerrit) 2015/12/29 03:10:45 base/macros.h
Devlin 2016/01/04 22:59:23 Done.
78 }; 77 };
79 78
80 } // namespace extensions 79 } // namespace extensions
81 80
82 #endif // CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ 81 #endif // CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698