OLD | NEW |
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_MANAGEMENT_MANAGEMENT_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
10 #include "chrome/browser/extensions/event_router.h" | 10 #include "chrome/browser/extensions/event_router.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 ExtensionService* service(); | 27 ExtensionService* service(); |
28 }; | 28 }; |
29 | 29 |
30 class AsyncManagementFunction : public AsyncExtensionFunction { | 30 class AsyncManagementFunction : public AsyncExtensionFunction { |
31 protected: | 31 protected: |
32 virtual ~AsyncManagementFunction() {} | 32 virtual ~AsyncManagementFunction() {} |
33 | 33 |
34 ExtensionService* service(); | 34 ExtensionService* service(); |
35 }; | 35 }; |
36 | 36 |
37 class GetAllExtensionsFunction : public ManagementFunction { | 37 class ManagementGetAllFunction : public ManagementFunction { |
38 public: | 38 public: |
39 DECLARE_EXTENSION_FUNCTION_NAME("management.getAll"); | 39 DECLARE_EXTENSION_FUNCTION_NAME("management.getAll"); |
40 | 40 |
41 protected: | 41 protected: |
42 virtual ~GetAllExtensionsFunction() {} | 42 virtual ~ManagementGetAllFunction() {} |
43 | 43 |
44 // ExtensionFunction: | 44 // ExtensionFunction: |
45 virtual bool RunImpl() OVERRIDE; | 45 virtual bool RunImpl() OVERRIDE; |
46 }; | 46 }; |
47 | 47 |
48 class GetExtensionByIdFunction : public ManagementFunction { | 48 class ManagementGetFunction : public ManagementFunction { |
49 public: | 49 public: |
50 DECLARE_EXTENSION_FUNCTION_NAME("management.get"); | 50 DECLARE_EXTENSION_FUNCTION_NAME("management.get"); |
51 | 51 |
52 protected: | 52 protected: |
53 virtual ~GetExtensionByIdFunction() {} | 53 virtual ~ManagementGetFunction() {} |
54 | 54 |
55 // ExtensionFunction: | 55 // ExtensionFunction: |
56 virtual bool RunImpl() OVERRIDE; | 56 virtual bool RunImpl() OVERRIDE; |
57 }; | 57 }; |
58 | 58 |
59 class GetPermissionWarningsByIdFunction : public ManagementFunction { | 59 class ManagementGetPermissionWarningsByIdFunction : public ManagementFunction { |
60 public: | 60 public: |
61 DECLARE_EXTENSION_FUNCTION_NAME("management.getPermissionWarningsById"); | 61 DECLARE_EXTENSION_FUNCTION_NAME("management.getPermissionWarningsById"); |
62 | 62 |
63 protected: | 63 protected: |
64 virtual ~GetPermissionWarningsByIdFunction() {} | 64 virtual ~ManagementGetPermissionWarningsByIdFunction() {} |
65 | 65 |
66 // ExtensionFunction: | 66 // ExtensionFunction: |
67 virtual bool RunImpl() OVERRIDE; | 67 virtual bool RunImpl() OVERRIDE; |
68 }; | 68 }; |
69 | 69 |
70 class GetPermissionWarningsByManifestFunction : public AsyncExtensionFunction { | 70 class ManagementGetPermissionWarningsByManifestFunction |
| 71 : public AsyncExtensionFunction { |
71 public: | 72 public: |
72 DECLARE_EXTENSION_FUNCTION_NAME( | 73 DECLARE_EXTENSION_FUNCTION_NAME( |
73 "management.getPermissionWarningsByManifest"); | 74 "management.getPermissionWarningsByManifest"); |
74 | 75 |
75 // Called when utility process finishes. | 76 // Called when utility process finishes. |
76 void OnParseSuccess(base::DictionaryValue* parsed_manifest); | 77 void OnParseSuccess(base::DictionaryValue* parsed_manifest); |
77 void OnParseFailure(const std::string& error); | 78 void OnParseFailure(const std::string& error); |
78 | 79 |
79 protected: | 80 protected: |
80 virtual ~GetPermissionWarningsByManifestFunction() {} | 81 virtual ~ManagementGetPermissionWarningsByManifestFunction() {} |
81 | 82 |
82 // ExtensionFunction: | 83 // ExtensionFunction: |
83 virtual bool RunImpl() OVERRIDE; | 84 virtual bool RunImpl() OVERRIDE; |
84 }; | 85 }; |
85 | 86 |
86 class LaunchAppFunction : public ManagementFunction { | 87 class ManagementLaunchAppFunction : public ManagementFunction { |
87 public: | 88 public: |
88 DECLARE_EXTENSION_FUNCTION_NAME("management.launchApp"); | 89 DECLARE_EXTENSION_FUNCTION_NAME("management.launchApp"); |
89 | 90 |
90 protected: | 91 protected: |
91 virtual ~LaunchAppFunction() {} | 92 virtual ~ManagementLaunchAppFunction() {} |
92 | 93 |
93 // ExtensionFunction: | 94 // ExtensionFunction: |
94 virtual bool RunImpl() OVERRIDE; | 95 virtual bool RunImpl() OVERRIDE; |
95 }; | 96 }; |
96 | 97 |
97 class SetEnabledFunction : public AsyncManagementFunction, | 98 class ManagementSetEnabledFunction : public AsyncManagementFunction, |
98 public ExtensionInstallPrompt::Delegate { | 99 public ExtensionInstallPrompt::Delegate { |
99 public: | 100 public: |
100 DECLARE_EXTENSION_FUNCTION_NAME("management.setEnabled"); | 101 DECLARE_EXTENSION_FUNCTION_NAME("management.setEnabled"); |
101 | 102 |
102 SetEnabledFunction(); | 103 ManagementSetEnabledFunction(); |
103 | 104 |
104 protected: | 105 protected: |
105 virtual ~SetEnabledFunction(); | 106 virtual ~ManagementSetEnabledFunction(); |
106 | 107 |
107 // ExtensionFunction: | 108 // ExtensionFunction: |
108 virtual bool RunImpl() OVERRIDE; | 109 virtual bool RunImpl() OVERRIDE; |
109 | 110 |
110 // ExtensionInstallPrompt::Delegate. | 111 // ExtensionInstallPrompt::Delegate. |
111 virtual void InstallUIProceed() OVERRIDE; | 112 virtual void InstallUIProceed() OVERRIDE; |
112 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | 113 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; |
113 | 114 |
114 private: | 115 private: |
115 std::string extension_id_; | 116 std::string extension_id_; |
116 | 117 |
117 // Used for prompting to re-enable items with permissions escalation updates. | 118 // Used for prompting to re-enable items with permissions escalation updates. |
118 scoped_ptr<ExtensionInstallPrompt> install_prompt_; | 119 scoped_ptr<ExtensionInstallPrompt> install_prompt_; |
119 }; | 120 }; |
120 | 121 |
121 class UninstallFunction : public AsyncManagementFunction, | 122 class ManagementUninstallFunction : public AsyncManagementFunction, |
122 public ExtensionUninstallDialog::Delegate { | 123 public ExtensionUninstallDialog::Delegate { |
123 public: | 124 public: |
124 DECLARE_EXTENSION_FUNCTION_NAME("management.uninstall"); | 125 DECLARE_EXTENSION_FUNCTION_NAME("management.uninstall"); |
125 | 126 |
126 UninstallFunction(); | 127 ManagementUninstallFunction(); |
127 static void SetAutoConfirmForTest(bool should_proceed); | 128 static void SetAutoConfirmForTest(bool should_proceed); |
128 | 129 |
129 // ExtensionUninstallDialog::Delegate implementation. | 130 // ExtensionUninstallDialog::Delegate implementation. |
130 virtual void ExtensionUninstallAccepted() OVERRIDE; | 131 virtual void ExtensionUninstallAccepted() OVERRIDE; |
131 virtual void ExtensionUninstallCanceled() OVERRIDE; | 132 virtual void ExtensionUninstallCanceled() OVERRIDE; |
132 | 133 |
133 private: | 134 private: |
134 virtual ~UninstallFunction(); | 135 virtual ~ManagementUninstallFunction(); |
135 | 136 |
136 virtual bool RunImpl() OVERRIDE; | 137 virtual bool RunImpl() OVERRIDE; |
137 | 138 |
138 // If should_uninstall is true, this method does the actual uninstall. | 139 // If should_uninstall is true, this method does the actual uninstall. |
139 // If |show_uninstall_dialog|, then this function will be called by one of the | 140 // If |show_uninstall_dialog|, then this function will be called by one of the |
140 // Accepted/Canceled callbacks. Otherwise, it's called directly from RunImpl. | 141 // Accepted/Canceled callbacks. Otherwise, it's called directly from RunImpl. |
141 void Finish(bool should_uninstall); | 142 void Finish(bool should_uninstall); |
142 | 143 |
143 std::string extension_id_; | 144 std::string extension_id_; |
144 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; | 145 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 192 |
192 // Created lazily upon OnListenerAdded. | 193 // Created lazily upon OnListenerAdded. |
193 scoped_ptr<ManagementEventRouter> management_event_router_; | 194 scoped_ptr<ManagementEventRouter> management_event_router_; |
194 | 195 |
195 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); | 196 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); |
196 }; | 197 }; |
197 | 198 |
198 } // namespace extensions | 199 } // namespace extensions |
199 | 200 |
200 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ | 201 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
OLD | NEW |