Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: chrome/browser/extensions/extension_service.h

Issue 8493017: Cleanup extension permissions module. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 316
318 // Enables the extension. If the extension is already enabled, does 317 // Enables the extension. If the extension is already enabled, does
319 // nothing. 318 // nothing.
320 virtual void EnableExtension(const std::string& extension_id); 319 virtual void EnableExtension(const std::string& extension_id);
321 320
322 // Disables the extension. If the extension is already disabled, or 321 // Disables the extension. If the extension is already disabled, or
323 // cannot be disabled, does nothing. 322 // cannot be disabled, does nothing.
324 virtual void DisableExtension(const std::string& extension_id); 323 virtual void DisableExtension(const std::string& extension_id);
325 324
326 // Updates the |extension|'s granted permissions lists to include all 325 // Updates the |extension|'s granted permissions lists to include all
327 // permissions in the |extension|'s manifest.
328 void GrantPermissions(const Extension* extension);
329
330 // Updates the |extension|'s granted permissions lists to include all
331 // permissions in the |extension|'s manifest and re-enables the 326 // permissions in the |extension|'s manifest and re-enables the
332 // extension. 327 // extension.
333 void GrantPermissionsAndEnableExtension(const Extension* extension); 328 void GrantPermissionsAndEnableExtension(const Extension* extension);
334 329
335 // Sets the |extension|'s active permissions to |permissions|.
336 void UpdateActivePermissions(const Extension* extension,
337 const ExtensionPermissionSet* permissions);
338
339 // Check for updates (or potentially new extensions from external providers) 330 // Check for updates (or potentially new extensions from external providers)
340 void CheckForExternalUpdates(); 331 void CheckForExternalUpdates();
341 332
342 // Unload the specified extension. 333 // Unload the specified extension.
343 virtual void UnloadExtension( 334 virtual void UnloadExtension(
344 const std::string& extension_id, 335 const std::string& extension_id,
345 extension_misc::UnloadedExtensionReason reason) OVERRIDE; 336 extension_misc::UnloadedExtensionReason reason) OVERRIDE;
346 337
347 // Unload all extensions. This is currently only called on shutdown, and 338 // Unload all extensions. This is currently only called on shutdown, and
348 // does not send notifications. 339 // does not send notifications.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } 447 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; }
457 448
458 ExtensionsQuotaService* quota_service() { return &quota_service_; } 449 ExtensionsQuotaService* quota_service() { return &quota_service_; }
459 450
460 ExtensionMenuManager* menu_manager() { return &menu_manager_; } 451 ExtensionMenuManager* menu_manager() { return &menu_manager_; }
461 452
462 AppNotificationManager* app_notification_manager() { 453 AppNotificationManager* app_notification_manager() {
463 return app_notification_manager_.get(); 454 return app_notification_manager_.get();
464 } 455 }
465 456
466 ExtensionPermissionsManager* permissions_manager() {
467 return &permissions_manager_;
468 }
469
470 ExtensionBrowserEventRouter* browser_event_router() { 457 ExtensionBrowserEventRouter* browser_event_router() {
471 return browser_event_router_.get(); 458 return browser_event_router_.get();
472 } 459 }
473 460
474 #if defined(OS_CHROMEOS) 461 #if defined(OS_CHROMEOS)
475 ExtensionFileBrowserEventRouter* file_browser_event_router() { 462 ExtensionFileBrowserEventRouter* file_browser_event_router() {
476 return file_browser_event_router_.get(); 463 return file_browser_event_router_.get();
477 } 464 }
478 chromeos::ExtensionInputMethodEventRouter* input_method_event_router() { 465 chromeos::ExtensionInputMethodEventRouter* input_method_event_router() {
479 return input_method_event_router_.get(); 466 return input_method_event_router_.get();
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 764
778 // Keeps track of loading and unloading component extensions. 765 // Keeps track of loading and unloading component extensions.
779 scoped_ptr<extensions::ComponentLoader> component_loader_; 766 scoped_ptr<extensions::ComponentLoader> component_loader_;
780 767
781 // Keeps track of menu items added by extensions. 768 // Keeps track of menu items added by extensions.
782 ExtensionMenuManager menu_manager_; 769 ExtensionMenuManager menu_manager_;
783 770
784 // Keeps track of app notifications. 771 // Keeps track of app notifications.
785 scoped_refptr<AppNotificationManager> app_notification_manager_; 772 scoped_refptr<AppNotificationManager> app_notification_manager_;
786 773
787 // Keeps track of extension permissions.
788 ExtensionPermissionsManager permissions_manager_;
789
790 // Keeps track of favicon-sized omnibox icons for extensions. 774 // Keeps track of favicon-sized omnibox icons for extensions.
791 ExtensionIconManager omnibox_icon_manager_; 775 ExtensionIconManager omnibox_icon_manager_;
792 ExtensionIconManager omnibox_popup_icon_manager_; 776 ExtensionIconManager omnibox_popup_icon_manager_;
793 777
794 // Manages the promotion of the web store. 778 // Manages the promotion of the web store.
795 AppsPromo apps_promo_; 779 AppsPromo apps_promo_;
796 780
797 // Flag to make sure event routers are only initialized once. 781 // Flag to make sure event routers are only initialized once.
798 bool event_routers_initialized_; 782 bool event_routers_initialized_;
799 783
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 ImageLoadingTracker tracker_; 832 ImageLoadingTracker tracker_;
849 833
850 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 834 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
851 InstallAppsWithUnlimtedStorage); 835 InstallAppsWithUnlimtedStorage);
852 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 836 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
853 InstallAppsAndCheckStorageProtection); 837 InstallAppsAndCheckStorageProtection);
854 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 838 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
855 }; 839 };
856 840
857 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 841 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698