| OLD | NEW |
| 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/file_path.h" | 17 #include "base/file_path.h" |
| 18 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
| 19 #include "base/memory/linked_ptr.h" | 19 #include "base/memory/linked_ptr.h" |
| 20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
| 22 #include "base/property_bag.h" | 22 #include "base/property_bag.h" |
| 23 #include "base/time.h" | 23 #include "base/time.h" |
| 24 #include "base/tuple.h" | 24 #include "base/tuple.h" |
| 25 #include "chrome/browser/extensions/apps_promo.h" | 25 #include "chrome/browser/extensions/apps_promo.h" |
| 26 #include "chrome/browser/extensions/extension_icon_manager.h" | 26 #include "chrome/browser/extensions/extension_icon_manager.h" |
| 27 #include "chrome/browser/extensions/extension_menu_manager.h" | 27 #include "chrome/browser/extensions/extension_menu_manager.h" |
| 28 #include "chrome/browser/extensions/extension_permissions_api.h" | |
| 29 #include "chrome/browser/extensions/extension_prefs.h" | 28 #include "chrome/browser/extensions/extension_prefs.h" |
| 30 #include "chrome/browser/extensions/extension_process_manager.h" | 29 #include "chrome/browser/extensions/extension_process_manager.h" |
| 31 #include "chrome/browser/extensions/extension_sync_data.h" | 30 #include "chrome/browser/extensions/extension_sync_data.h" |
| 32 #include "chrome/browser/extensions/extension_toolbar_model.h" | 31 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 33 #include "chrome/browser/extensions/extension_warning_set.h" | 32 #include "chrome/browser/extensions/extension_warning_set.h" |
| 34 #include "chrome/browser/extensions/extensions_quota_service.h" | 33 #include "chrome/browser/extensions/extensions_quota_service.h" |
| 35 #include "chrome/browser/extensions/external_extension_provider_interface.h" | 34 #include "chrome/browser/extensions/external_extension_provider_interface.h" |
| 36 #include "chrome/browser/extensions/pending_extension_manager.h" | 35 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 37 #include "chrome/browser/extensions/process_map.h" | 36 #include "chrome/browser/extensions/process_map.h" |
| 38 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" | 37 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 341 |
| 343 // Enables the extension. If the extension is already enabled, does | 342 // Enables the extension. If the extension is already enabled, does |
| 344 // nothing. | 343 // nothing. |
| 345 virtual void EnableExtension(const std::string& extension_id); | 344 virtual void EnableExtension(const std::string& extension_id); |
| 346 | 345 |
| 347 // Disables the extension. If the extension is already disabled, or | 346 // Disables the extension. If the extension is already disabled, or |
| 348 // cannot be disabled, does nothing. | 347 // cannot be disabled, does nothing. |
| 349 virtual void DisableExtension(const std::string& extension_id); | 348 virtual void DisableExtension(const std::string& extension_id); |
| 350 | 349 |
| 351 // Updates the |extension|'s granted permissions lists to include all | 350 // Updates the |extension|'s granted permissions lists to include all |
| 352 // permissions in the |extension|'s manifest. | |
| 353 void GrantPermissions(const Extension* extension); | |
| 354 | |
| 355 // Updates the |extension|'s granted permissions lists to include all | |
| 356 // permissions in the |extension|'s manifest and re-enables the | 351 // permissions in the |extension|'s manifest and re-enables the |
| 357 // extension. | 352 // extension. |
| 358 void GrantPermissionsAndEnableExtension(const Extension* extension); | 353 void GrantPermissionsAndEnableExtension(const Extension* extension); |
| 359 | 354 |
| 360 // Sets the |extension|'s active permissions to |permissions|. | |
| 361 void UpdateActivePermissions(const Extension* extension, | |
| 362 const ExtensionPermissionSet* permissions); | |
| 363 | |
| 364 // Check for updates (or potentially new extensions from external providers) | 355 // Check for updates (or potentially new extensions from external providers) |
| 365 void CheckForExternalUpdates(); | 356 void CheckForExternalUpdates(); |
| 366 | 357 |
| 367 // Unload the specified extension. | 358 // Unload the specified extension. |
| 368 virtual void UnloadExtension( | 359 virtual void UnloadExtension( |
| 369 const std::string& extension_id, | 360 const std::string& extension_id, |
| 370 extension_misc::UnloadedExtensionReason reason) OVERRIDE; | 361 extension_misc::UnloadedExtensionReason reason) OVERRIDE; |
| 371 | 362 |
| 372 // Unload all extensions. This is currently only called on shutdown, and | 363 // Unload all extensions. This is currently only called on shutdown, and |
| 373 // does not send notifications. | 364 // does not send notifications. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } | 460 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } |
| 470 | 461 |
| 471 ExtensionsQuotaService* quota_service() { return "a_service_; } | 462 ExtensionsQuotaService* quota_service() { return "a_service_; } |
| 472 | 463 |
| 473 ExtensionMenuManager* menu_manager() { return &menu_manager_; } | 464 ExtensionMenuManager* menu_manager() { return &menu_manager_; } |
| 474 | 465 |
| 475 AppNotificationManager* app_notification_manager() { | 466 AppNotificationManager* app_notification_manager() { |
| 476 return app_notification_manager_.get(); | 467 return app_notification_manager_.get(); |
| 477 } | 468 } |
| 478 | 469 |
| 479 ExtensionPermissionsManager* permissions_manager() { | |
| 480 return &permissions_manager_; | |
| 481 } | |
| 482 | |
| 483 ExtensionBrowserEventRouter* browser_event_router() { | 470 ExtensionBrowserEventRouter* browser_event_router() { |
| 484 return browser_event_router_.get(); | 471 return browser_event_router_.get(); |
| 485 } | 472 } |
| 486 | 473 |
| 487 #if defined(OS_CHROMEOS) | 474 #if defined(OS_CHROMEOS) |
| 488 ExtensionFileBrowserEventRouter* file_browser_event_router() { | 475 ExtensionFileBrowserEventRouter* file_browser_event_router() { |
| 489 return file_browser_event_router_.get(); | 476 return file_browser_event_router_.get(); |
| 490 } | 477 } |
| 491 chromeos::ExtensionInputMethodEventRouter* input_method_event_router() { | 478 chromeos::ExtensionInputMethodEventRouter* input_method_event_router() { |
| 492 return input_method_event_router_.get(); | 479 return input_method_event_router_.get(); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 | 776 |
| 790 // Keeps track of loading and unloading component extensions. | 777 // Keeps track of loading and unloading component extensions. |
| 791 scoped_ptr<extensions::ComponentLoader> component_loader_; | 778 scoped_ptr<extensions::ComponentLoader> component_loader_; |
| 792 | 779 |
| 793 // Keeps track of menu items added by extensions. | 780 // Keeps track of menu items added by extensions. |
| 794 ExtensionMenuManager menu_manager_; | 781 ExtensionMenuManager menu_manager_; |
| 795 | 782 |
| 796 // Keeps track of app notifications. | 783 // Keeps track of app notifications. |
| 797 scoped_refptr<AppNotificationManager> app_notification_manager_; | 784 scoped_refptr<AppNotificationManager> app_notification_manager_; |
| 798 | 785 |
| 799 // Keeps track of extension permissions. | |
| 800 ExtensionPermissionsManager permissions_manager_; | |
| 801 | |
| 802 // Keeps track of favicon-sized omnibox icons for extensions. | 786 // Keeps track of favicon-sized omnibox icons for extensions. |
| 803 ExtensionIconManager omnibox_icon_manager_; | 787 ExtensionIconManager omnibox_icon_manager_; |
| 804 ExtensionIconManager omnibox_popup_icon_manager_; | 788 ExtensionIconManager omnibox_popup_icon_manager_; |
| 805 | 789 |
| 806 // Manages the promotion of the web store. | 790 // Manages the promotion of the web store. |
| 807 AppsPromo apps_promo_; | 791 AppsPromo apps_promo_; |
| 808 | 792 |
| 809 // Flag to make sure event routers are only initialized once. | 793 // Flag to make sure event routers are only initialized once. |
| 810 bool event_routers_initialized_; | 794 bool event_routers_initialized_; |
| 811 | 795 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 ImageLoadingTracker tracker_; | 844 ImageLoadingTracker tracker_; |
| 861 | 845 |
| 862 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 846 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 863 InstallAppsWithUnlimtedStorage); | 847 InstallAppsWithUnlimtedStorage); |
| 864 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 848 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 865 InstallAppsAndCheckStorageProtection); | 849 InstallAppsAndCheckStorageProtection); |
| 866 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 850 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 867 }; | 851 }; |
| 868 | 852 |
| 869 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 853 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |