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 a regular installed app. Ephemeral apps |
| 297 // are already installed in extension system (albiet transiently) and only |
| 298 // need to be exposed in the UI. Set |is_from_sync| to true if the |
| 299 // install was initiated via sync. |
| 300 void PromoteEphemeralApp( |
| 301 const extensions::Extension* extension, bool is_from_sync); |
295 | 302 |
296 // Returns an update for an extension with the specified id, if installation | 303 // 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 | 304 // of that update was previously delayed because the extension was in use. If |
298 // no updates are pending for the extension returns NULL. | 305 // no updates are pending for the extension returns NULL. |
299 virtual const extensions::Extension* GetPendingExtensionUpdate( | 306 virtual const extensions::Extension* GetPendingExtensionUpdate( |
300 const std::string& extension_id) const OVERRIDE; | 307 const std::string& extension_id) const OVERRIDE; |
301 | 308 |
302 // Go through each extension and unload those that are not allowed to run by | 309 // Go through each extension and unload those that are not allowed to run by |
303 // management policy providers (ie. network admin and Google-managed | 310 // management policy providers (ie. network admin and Google-managed |
304 // blacklist). | 311 // 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 | 429 // 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. | 430 // notification is desired the calling code is responsible for doing that. |
424 void TerminateExtension(const std::string& extension_id); | 431 void TerminateExtension(const std::string& extension_id); |
425 | 432 |
426 #if defined(UNIT_TEST) | 433 #if defined(UNIT_TEST) |
427 void TrackTerminatedExtensionForTest(const extensions::Extension* extension) { | 434 void TrackTerminatedExtensionForTest(const extensions::Extension* extension) { |
428 TrackTerminatedExtension(extension); | 435 TrackTerminatedExtension(extension); |
429 } | 436 } |
430 | 437 |
431 void FinishInstallationForTest(const extensions::Extension* extension) { | 438 void FinishInstallationForTest(const extensions::Extension* extension) { |
432 FinishInstallation(extension); | 439 FinishInstallation(extension, false); |
433 } | 440 } |
434 #endif | 441 #endif |
435 | 442 |
436 base::WeakPtr<ExtensionService> AsWeakPtr() { return base::AsWeakPtr(this); } | 443 base::WeakPtr<ExtensionService> AsWeakPtr() { return base::AsWeakPtr(this); } |
437 | 444 |
438 bool browser_terminating() const { return browser_terminating_; } | 445 bool browser_terminating() const { return browser_terminating_; } |
439 | 446 |
440 extensions::SharedModuleService* shared_module_service() { | 447 extensions::SharedModuleService* shared_module_service() { |
441 return shared_module_service_.get(); | 448 return shared_module_service_.get(); |
442 } | 449 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 const std::string& install_parameter); | 501 const std::string& install_parameter); |
495 | 502 |
496 // Handles sending notification that |extension| was loaded. | 503 // Handles sending notification that |extension| was loaded. |
497 void NotifyExtensionLoaded(const extensions::Extension* extension); | 504 void NotifyExtensionLoaded(const extensions::Extension* extension); |
498 | 505 |
499 // Handles sending notification that |extension| was unloaded. | 506 // Handles sending notification that |extension| was unloaded. |
500 void NotifyExtensionUnloaded( | 507 void NotifyExtensionUnloaded( |
501 const extensions::Extension* extension, | 508 const extensions::Extension* extension, |
502 extensions::UnloadedExtensionInfo::Reason reason); | 509 extensions::UnloadedExtensionInfo::Reason reason); |
503 | 510 |
504 // Common helper to finish installing the given extension. | 511 // Common helper to finish installing the given extension. |was_ephemeral| |
505 void FinishInstallation(const extensions::Extension* extension); | 512 // should be true if the extension was previously installed and ephemeral. |
| 513 void FinishInstallation(const extensions::Extension* extension, |
| 514 bool was_ephemeral); |
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 |