Chromium Code Reviews| 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 <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 void MaybeFinishDelayedInstallations(); | 284 void MaybeFinishDelayedInstallations(); |
| 285 | 285 |
| 286 // Similar to FinishInstallation, but first checks if there still is an update | 286 // Similar to FinishInstallation, but first checks if there still is an update |
| 287 // pending for the extension, and makes sure the extension is still idle. | 287 // pending for the extension, and makes sure the extension is still idle. |
| 288 void MaybeFinishDelayedInstallation(const std::string& extension_id); | 288 void MaybeFinishDelayedInstallation(const std::string& extension_id); |
| 289 | 289 |
| 290 // Finishes installation of an update for an extension with the specified id, | 290 // Finishes installation of an update for an extension with the specified id, |
| 291 // when installation of that extension was previously delayed because the | 291 // when installation of that extension was previously delayed because the |
| 292 // extension was in use. | 292 // extension was in use. |
| 293 virtual void FinishDelayedInstallation( | 293 virtual void FinishDelayedInstallation( |
| 294 const std::string& extension_id) OVERRIDE; | 294 const std::string& extension_id) OVERRIDE; |
| 295 | |
| 296 // Promotes an ephemeral app to being installed permanently. Ephemeral apps | |
| 297 // are already installed in extension system (albiet transiently) and only | |
| 298 // need to be exposed in the UI. Set |user_acknowledged| to true if the | |
| 299 // install was confirmed via a dialog, otherwise set to false (for example, | |
| 300 // if the install was initiated via sync). | |
| 301 void InstallEphemeralApp( | |
| 302 const extensions::Extension* extension, bool user_acknowledged); | |
|
benwells
2014/05/27 01:42:56
Can this be InstallEphemeralAppPermanently? The na
tmdiep
2014/05/27 01:58:54
Yeah, I originally had "InstallEphemeralAppPermane
tmdiep
2014/05/27 07:46:05
Changed to PromoteEphemeralApp, and user_acknowled
| |
| 295 | 303 |
| 296 // Returns an update for an extension with the specified id, if installation | 304 // Returns an update for an extension with the specified id, if installation |
| 297 // of that update was previously delayed because the extension was in use. If | 305 // of that update was previously delayed because the extension was in use. If |
| 298 // no updates are pending for the extension returns NULL. | 306 // no updates are pending for the extension returns NULL. |
| 299 virtual const extensions::Extension* GetPendingExtensionUpdate( | 307 virtual const extensions::Extension* GetPendingExtensionUpdate( |
| 300 const std::string& extension_id) const OVERRIDE; | 308 const std::string& extension_id) const OVERRIDE; |
| 301 | 309 |
| 302 // Go through each extension and unload those that are not allowed to run by | 310 // Go through each extension and unload those that are not allowed to run by |
| 303 // management policy providers (ie. network admin and Google-managed | 311 // management policy providers (ie. network admin and Google-managed |
| 304 // blacklist). | 312 // blacklist). |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 // doesn't notify the user that the extension was terminated, if such a | 430 // doesn't notify the user that the extension was terminated, if such a |
| 423 // notification is desired the calling code is responsible for doing that. | 431 // notification is desired the calling code is responsible for doing that. |
| 424 void TerminateExtension(const std::string& extension_id); | 432 void TerminateExtension(const std::string& extension_id); |
| 425 | 433 |
| 426 #if defined(UNIT_TEST) | 434 #if defined(UNIT_TEST) |
| 427 void TrackTerminatedExtensionForTest(const extensions::Extension* extension) { | 435 void TrackTerminatedExtensionForTest(const extensions::Extension* extension) { |
| 428 TrackTerminatedExtension(extension); | 436 TrackTerminatedExtension(extension); |
| 429 } | 437 } |
| 430 | 438 |
| 431 void FinishInstallationForTest(const extensions::Extension* extension) { | 439 void FinishInstallationForTest(const extensions::Extension* extension) { |
| 432 FinishInstallation(extension); | 440 FinishInstallation(extension, false); |
| 433 } | 441 } |
| 434 #endif | 442 #endif |
| 435 | 443 |
| 436 base::WeakPtr<ExtensionService> AsWeakPtr() { return base::AsWeakPtr(this); } | 444 base::WeakPtr<ExtensionService> AsWeakPtr() { return base::AsWeakPtr(this); } |
| 437 | 445 |
| 438 bool browser_terminating() const { return browser_terminating_; } | 446 bool browser_terminating() const { return browser_terminating_; } |
| 439 | 447 |
| 440 extensions::SharedModuleService* shared_module_service() { | 448 extensions::SharedModuleService* shared_module_service() { |
| 441 return shared_module_service_.get(); | 449 return shared_module_service_.get(); |
| 442 } | 450 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 | 503 |
| 496 // Handles sending notification that |extension| was loaded. | 504 // Handles sending notification that |extension| was loaded. |
| 497 void NotifyExtensionLoaded(const extensions::Extension* extension); | 505 void NotifyExtensionLoaded(const extensions::Extension* extension); |
| 498 | 506 |
| 499 // Handles sending notification that |extension| was unloaded. | 507 // Handles sending notification that |extension| was unloaded. |
| 500 void NotifyExtensionUnloaded( | 508 void NotifyExtensionUnloaded( |
| 501 const extensions::Extension* extension, | 509 const extensions::Extension* extension, |
| 502 extensions::UnloadedExtensionInfo::Reason reason); | 510 extensions::UnloadedExtensionInfo::Reason reason); |
| 503 | 511 |
| 504 // Common helper to finish installing the given extension. | 512 // Common helper to finish installing the given extension. |
| 505 void FinishInstallation(const extensions::Extension* extension); | 513 void FinishInstallation(const extensions::Extension* extension, |
| 514 bool was_ephemeral); | |
|
benwells
2014/05/27 01:42:56
What is |was_ephemeral| if it wasn't installed at
tmdiep
2014/05/27 01:58:54
It should be false. I'll add a comment.
| |
| 506 | 515 |
| 507 // Updates the |extension|'s active permission set to include only permissions | 516 // Updates the |extension|'s active permission set to include only permissions |
| 508 // currently requested by the extension and all the permissions required by | 517 // currently requested by the extension and all the permissions required by |
| 509 // the extension. | 518 // the extension. |
| 510 void UpdateActivePermissions(const extensions::Extension* extension); | 519 void UpdateActivePermissions(const extensions::Extension* extension); |
| 511 | 520 |
| 512 // Disables the extension if the privilege level has increased | 521 // Disables the extension if the privilege level has increased |
| 513 // (e.g., due to an upgrade). | 522 // (e.g., due to an upgrade). |
| 514 void CheckPermissionsIncrease(const extensions::Extension* extension, | 523 void CheckPermissionsIncrease(const extensions::Extension* extension, |
| 515 bool is_extension_installed); | 524 bool is_extension_installed); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 702 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 711 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 703 GreylistedExtensionDisabled); | 712 GreylistedExtensionDisabled); |
| 704 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 713 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 705 GreylistDontEnableManuallyDisabled); | 714 GreylistDontEnableManuallyDisabled); |
| 706 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 715 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 707 GreylistUnknownDontChange); | 716 GreylistUnknownDontChange); |
| 708 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 717 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 709 }; | 718 }; |
| 710 | 719 |
| 711 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 720 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |