| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 void OnExtensionInstalled(const extensions::Extension* extension, | 329 void OnExtensionInstalled(const extensions::Extension* extension, |
| 330 const syncer::StringOrdinal& page_ordinal) { | 330 const syncer::StringOrdinal& page_ordinal) { |
| 331 OnExtensionInstalled(extension, | 331 OnExtensionInstalled(extension, |
| 332 page_ordinal, | 332 page_ordinal, |
| 333 static_cast<int>(extensions::kInstallFlagNone)); | 333 static_cast<int>(extensions::kInstallFlagNone)); |
| 334 } | 334 } |
| 335 | 335 |
| 336 // Checks for delayed installation for all pending installs. | 336 // Checks for delayed installation for all pending installs. |
| 337 void MaybeFinishDelayedInstallations(); | 337 void MaybeFinishDelayedInstallations(); |
| 338 | 338 |
| 339 // Promotes an ephemeral app to a regular installed app. Ephemeral apps | |
| 340 // are already installed in extension system (albiet transiently) and only | |
| 341 // need to be exposed in the UI. Set |is_from_sync| to true if the | |
| 342 // install was initiated via sync. | |
| 343 void PromoteEphemeralApp( | |
| 344 const extensions::Extension* extension, bool is_from_sync); | |
| 345 | |
| 346 // ExtensionHost of background page calls this method right after its render | 339 // ExtensionHost of background page calls this method right after its render |
| 347 // view has been created. | 340 // view has been created. |
| 348 void DidCreateRenderViewForBackgroundPage(extensions::ExtensionHost* host); | 341 void DidCreateRenderViewForBackgroundPage(extensions::ExtensionHost* host); |
| 349 | 342 |
| 350 // Changes sequenced task runner for crx installation tasks to |task_runner|. | 343 // Changes sequenced task runner for crx installation tasks to |task_runner|. |
| 351 void SetFileTaskRunnerForTesting( | 344 void SetFileTaskRunnerForTesting( |
| 352 const scoped_refptr<base::SequencedTaskRunner>& task_runner); | 345 const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
| 353 | 346 |
| 354 // Postpone installations so that we don't have to worry about race | 347 // Postpone installations so that we don't have to worry about race |
| 355 // conditions. | 348 // conditions. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 433 |
| 441 // Simulate an extension being blacklisted for tests. | 434 // Simulate an extension being blacklisted for tests. |
| 442 void BlacklistExtensionForTest(const std::string& extension_id); | 435 void BlacklistExtensionForTest(const std::string& extension_id); |
| 443 | 436 |
| 444 #if defined(UNIT_TEST) | 437 #if defined(UNIT_TEST) |
| 445 void TrackTerminatedExtensionForTest(const extensions::Extension* extension) { | 438 void TrackTerminatedExtensionForTest(const extensions::Extension* extension) { |
| 446 TrackTerminatedExtension(extension->id()); | 439 TrackTerminatedExtension(extension->id()); |
| 447 } | 440 } |
| 448 | 441 |
| 449 void FinishInstallationForTest(const extensions::Extension* extension) { | 442 void FinishInstallationForTest(const extensions::Extension* extension) { |
| 450 FinishInstallation(extension, false /* not ephemeral */); | 443 FinishInstallation(extension); |
| 451 } | 444 } |
| 452 #endif | 445 #endif |
| 453 | 446 |
| 454 void set_browser_terminating_for_test(bool value) { | 447 void set_browser_terminating_for_test(bool value) { |
| 455 browser_terminating_ = value; | 448 browser_terminating_ = value; |
| 456 } | 449 } |
| 457 | 450 |
| 458 // By default ExtensionService will wait with installing an updated extension | 451 // By default ExtensionService will wait with installing an updated extension |
| 459 // until the extension is idle. Tests might not like this behavior, so you can | 452 // until the extension is idle. Tests might not like this behavior, so you can |
| 460 // disable it with this method. | 453 // disable it with this method. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 // Completes extension loading after URLRequestContexts have been updated | 535 // Completes extension loading after URLRequestContexts have been updated |
| 543 // on the IO thread. | 536 // on the IO thread. |
| 544 void OnExtensionRegisteredWithRequestContexts( | 537 void OnExtensionRegisteredWithRequestContexts( |
| 545 scoped_refptr<const extensions::Extension> extension); | 538 scoped_refptr<const extensions::Extension> extension); |
| 546 | 539 |
| 547 // Handles sending notification that |extension| was unloaded. | 540 // Handles sending notification that |extension| was unloaded. |
| 548 void NotifyExtensionUnloaded( | 541 void NotifyExtensionUnloaded( |
| 549 const extensions::Extension* extension, | 542 const extensions::Extension* extension, |
| 550 extensions::UnloadedExtensionInfo::Reason reason); | 543 extensions::UnloadedExtensionInfo::Reason reason); |
| 551 | 544 |
| 552 // Common helper to finish installing the given extension. |was_ephemeral| | 545 // Common helper to finish installing the given extension. |
| 553 // should be true if the extension was previously installed and ephemeral. | 546 void FinishInstallation(const extensions::Extension* extension); |
| 554 void FinishInstallation(const extensions::Extension* extension, | |
| 555 bool was_ephemeral); | |
| 556 | 547 |
| 557 // Disables the extension if the privilege level has increased | 548 // Disables the extension if the privilege level has increased |
| 558 // (e.g., due to an upgrade). | 549 // (e.g., due to an upgrade). |
| 559 void CheckPermissionsIncrease(const extensions::Extension* extension, | 550 void CheckPermissionsIncrease(const extensions::Extension* extension, |
| 560 bool is_extension_installed); | 551 bool is_extension_installed); |
| 561 | 552 |
| 562 // Helper that updates the active extension list used for crash reporting. | 553 // Helper that updates the active extension list used for crash reporting. |
| 563 void UpdateActiveExtensionsInCrashReporter(); | 554 void UpdateActiveExtensionsInCrashReporter(); |
| 564 | 555 |
| 565 // Helper to get the disable reasons for an installed (or upgraded) extension. | 556 // Helper to get the disable reasons for an installed (or upgraded) extension. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 GreylistUnknownDontChange); | 751 GreylistUnknownDontChange); |
| 761 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 752 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 762 ManagementPolicyProhibitsEnableOnInstalled); | 753 ManagementPolicyProhibitsEnableOnInstalled); |
| 763 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 754 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 764 BlockAndUnblockBlacklistedExtension); | 755 BlockAndUnblockBlacklistedExtension); |
| 765 | 756 |
| 766 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 757 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 767 }; | 758 }; |
| 768 | 759 |
| 769 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 760 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |