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

Side by Side Diff: trunk/src/chrome/browser/extensions/extension_service.h

Issue 369863002: Revert 281130 "Replace "external_install" boolean parameter with..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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_EXTENSION_SERVICE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 }; 148 };
149 149
150 // Manages installed and running Chromium extensions. An instance is shared 150 // Manages installed and running Chromium extensions. An instance is shared
151 // between normal and incognito profiles. 151 // between normal and incognito profiles.
152 class ExtensionService 152 class ExtensionService
153 : public ExtensionServiceInterface, 153 : public ExtensionServiceInterface,
154 public extensions::ExternalProviderInterface::VisitorInterface, 154 public extensions::ExternalProviderInterface::VisitorInterface,
155 public content::NotificationObserver, 155 public content::NotificationObserver,
156 public extensions::Blacklist::Observer { 156 public extensions::Blacklist::Observer {
157 public: 157 public:
158 enum UninstallReason {
159 UNINSTALL_REASON_FOR_TESTING, // Used for testing code only
160 UNINSTALL_REASON_USER_INITIATED, // User performed some UI gesture
161 UNINSTALL_REASON_EXTENSION_DISABLED, // Extension disabled due to error
162 UNINSTALL_REASON_INTERNAL_MANAGEMENT, // Internal extensions (see usages)
163 UNINSTALL_REASON_STORAGE_THRESHOLD_EXCEEDED,
164 UNINSTALL_REASON_EXTERNAL_INSTALL_CANCELED,
165 UNINSTALL_REASON_MANAGEMENT_API,
166 UNINSTALL_REASON_SYNC,
167 UNINSTALL_REASON_ORPHANED_SHARED_MODULE,
168 UNINSTALL_REASON_ORPHANED_THEME,
169 UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION,
170 UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION
171 };
172
173 // Attempts to uninstall an extension from a given ExtensionService. Returns 158 // Attempts to uninstall an extension from a given ExtensionService. Returns
174 // true iff the target extension exists. 159 // true iff the target extension exists.
175 static bool UninstallExtensionHelper(ExtensionService* extensions_service, 160 static bool UninstallExtensionHelper(ExtensionService* extensions_service,
176 const std::string& extension_id, 161 const std::string& extension_id);
177 UninstallReason reason);
178 162
179 // Constructor stores pointers to |profile| and |extension_prefs| but 163 // Constructor stores pointers to |profile| and |extension_prefs| but
180 // ownership remains at caller. 164 // ownership remains at caller.
181 ExtensionService(Profile* profile, 165 ExtensionService(Profile* profile,
182 const base::CommandLine* command_line, 166 const base::CommandLine* command_line,
183 const base::FilePath& install_directory, 167 const base::FilePath& install_directory,
184 extensions::ExtensionPrefs* extension_prefs, 168 extensions::ExtensionPrefs* extension_prefs,
185 extensions::Blacklist* blacklist, 169 extensions::Blacklist* blacklist,
186 bool autoupdate_enabled, 170 bool autoupdate_enabled,
187 bool extensions_enabled, 171 bool extensions_enabled,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 void Init(); 233 void Init();
250 234
251 // Called when the associated Profile is going to be destroyed. 235 // Called when the associated Profile is going to be destroyed.
252 void Shutdown(); 236 void Shutdown();
253 237
254 // Reloads the specified extension, sending the onLaunched() event to it if it 238 // Reloads the specified extension, sending the onLaunched() event to it if it
255 // currently has any window showing. 239 // currently has any window showing.
256 void ReloadExtension(const std::string& extension_id); 240 void ReloadExtension(const std::string& extension_id);
257 241
258 // Uninstalls the specified extension. Callers should only call this method 242 // Uninstalls the specified extension. Callers should only call this method
259 // with extensions that exist. |reason| lets the caller specify why the 243 // with extensions that exist. |external_uninstall| is a magical parameter
260 // extension is uninstalled. 244 // that is only used to send information to ExtensionPrefs, which external
245 // callers should never set to true.
246 //
247 // TODO(aa): Remove |external_uninstall| -- this information should be passed
248 // to ExtensionPrefs some other way.
261 virtual bool UninstallExtension(const std::string& extension_id, 249 virtual bool UninstallExtension(const std::string& extension_id,
262 UninstallReason reason, 250 bool external_uninstall,
263 base::string16* error); 251 base::string16* error);
264 252
265 // Enables the extension. If the extension is already enabled, does 253 // Enables the extension. If the extension is already enabled, does
266 // nothing. 254 // nothing.
267 virtual void EnableExtension(const std::string& extension_id); 255 virtual void EnableExtension(const std::string& extension_id);
268 256
269 // Disables the extension. If the extension is already disabled, or 257 // Disables the extension. If the extension is already disabled, or
270 // cannot be disabled, does nothing. 258 // cannot be disabled, does nothing.
271 virtual void DisableExtension( 259 virtual void DisableExtension(
272 const std::string& extension_id, 260 const std::string& extension_id,
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 GreylistedExtensionDisabled); 703 GreylistedExtensionDisabled);
716 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 704 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
717 GreylistDontEnableManuallyDisabled); 705 GreylistDontEnableManuallyDisabled);
718 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 706 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
719 GreylistUnknownDontChange); 707 GreylistUnknownDontChange);
720 708
721 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 709 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
722 }; 710 };
723 711
724 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 712 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698