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_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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 void SetBeingReloaded(const std::string& extension_id, bool value); | 248 void SetBeingReloaded(const std::string& extension_id, bool value); |
249 | 249 |
250 // Initialize and start all installed extensions. | 250 // Initialize and start all installed extensions. |
251 void Init(); | 251 void Init(); |
252 | 252 |
253 // Called when the associated Profile is going to be destroyed. | 253 // Called when the associated Profile is going to be destroyed. |
254 void Shutdown(); | 254 void Shutdown(); |
255 | 255 |
256 // Reloads the specified extension, sending the onLaunched() event to it if it | 256 // Reloads the specified extension, sending the onLaunched() event to it if it |
257 // currently has any window showing. | 257 // currently has any window showing. |
| 258 // Allows noisy failures. |
258 void ReloadExtension(const std::string& extension_id); | 259 void ReloadExtension(const std::string& extension_id); |
259 | 260 |
| 261 // Suppresses noisy failures. |
| 262 void ReloadExtensionWithQuietFailure(const std::string& extension_id); |
| 263 |
260 // Uninstalls the specified extension. Callers should only call this method | 264 // Uninstalls the specified extension. Callers should only call this method |
261 // with extensions that exist. |reason| lets the caller specify why the | 265 // with extensions that exist. |reason| lets the caller specify why the |
262 // extension is uninstalled. | 266 // extension is uninstalled. |
263 virtual bool UninstallExtension(const std::string& extension_id, | 267 virtual bool UninstallExtension(const std::string& extension_id, |
264 UninstallReason reason, | 268 UninstallReason reason, |
265 base::string16* error); | 269 base::string16* error); |
266 | 270 |
267 // Enables the extension. If the extension is already enabled, does | 271 // Enables the extension. If the extension is already enabled, does |
268 // nothing. | 272 // nothing. |
269 virtual void EnableExtension(const std::string& extension_id); | 273 virtual void EnableExtension(const std::string& extension_id); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 446 |
443 // Set a callback to be called when all external providers are ready and their | 447 // Set a callback to be called when all external providers are ready and their |
444 // extensions have been installed. | 448 // extensions have been installed. |
445 void set_external_updates_finished_callback_for_test( | 449 void set_external_updates_finished_callback_for_test( |
446 const base::Closure& callback) { | 450 const base::Closure& callback) { |
447 external_updates_finished_callback_ = callback; | 451 external_updates_finished_callback_ = callback; |
448 } | 452 } |
449 | 453 |
450 | 454 |
451 private: | 455 private: |
| 456 // Reloads the specified extension, sending the onLaunched() event to it if it |
| 457 // currently has any window showing. |be_noisy| determines whether noisy |
| 458 // failures are allowed for unpacked extension installs. |
| 459 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy); |
| 460 |
452 // content::NotificationObserver implementation: | 461 // content::NotificationObserver implementation: |
453 virtual void Observe(int type, | 462 virtual void Observe(int type, |
454 const content::NotificationSource& source, | 463 const content::NotificationSource& source, |
455 const content::NotificationDetails& details) OVERRIDE; | 464 const content::NotificationDetails& details) OVERRIDE; |
456 | 465 |
457 // extensions::Blacklist::Observer implementation. | 466 // extensions::Blacklist::Observer implementation. |
458 virtual void OnBlacklistUpdated() OVERRIDE; | 467 virtual void OnBlacklistUpdated() OVERRIDE; |
459 | 468 |
460 // Similar to FinishInstallation, but first checks if there still is an update | 469 // Similar to FinishInstallation, but first checks if there still is an update |
461 // pending for the extension, and makes sure the extension is still idle. | 470 // pending for the extension, and makes sure the extension is still idle. |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 GreylistedExtensionDisabled); | 726 GreylistedExtensionDisabled); |
718 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 727 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
719 GreylistDontEnableManuallyDisabled); | 728 GreylistDontEnableManuallyDisabled); |
720 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 729 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
721 GreylistUnknownDontChange); | 730 GreylistUnknownDontChange); |
722 | 731 |
723 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 732 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
724 }; | 733 }; |
725 | 734 |
726 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 735 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |