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

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

Issue 10911300: Move ExtensionAction from common/ to browser/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: proof of concept Created 8 years, 3 months 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) 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 <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/memory/linked_ptr.h" 16 #include "base/memory/linked_ptr.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/string16.h" 19 #include "base/string16.h"
20 #include "base/time.h" 20 #include "base/time.h"
21 #include "base/tuple.h" 21 #include "base/tuple.h"
22 #include "chrome/browser/api/prefs/pref_change_registrar.h" 22 #include "chrome/browser/api/prefs/pref_change_registrar.h"
23 #include "chrome/browser/extensions/app_shortcut_manager.h" 23 #include "chrome/browser/extensions/app_shortcut_manager.h"
24 #include "chrome/browser/extensions/app_sync_bundle.h" 24 #include "chrome/browser/extensions/app_sync_bundle.h"
25 #include "chrome/browser/extensions/extension_action.h"
25 #include "chrome/browser/extensions/extension_icon_manager.h" 26 #include "chrome/browser/extensions/extension_icon_manager.h"
26 #include "chrome/browser/extensions/extension_prefs.h" 27 #include "chrome/browser/extensions/extension_prefs.h"
27 #include "chrome/browser/extensions/extension_process_manager.h" 28 #include "chrome/browser/extensions/extension_process_manager.h"
28 #include "chrome/browser/extensions/extension_sync_bundle.h" 29 #include "chrome/browser/extensions/extension_sync_bundle.h"
29 #include "chrome/browser/extensions/extension_toolbar_model.h" 30 #include "chrome/browser/extensions/extension_toolbar_model.h"
30 #include "chrome/browser/extensions/extension_warning_set.h" 31 #include "chrome/browser/extensions/extension_warning_set.h"
31 #include "chrome/browser/extensions/extensions_quota_service.h" 32 #include "chrome/browser/extensions/extensions_quota_service.h"
32 #include "chrome/browser/extensions/external_provider_interface.h" 33 #include "chrome/browser/extensions/external_provider_interface.h"
33 #include "chrome/browser/extensions/menu_manager.h" 34 #include "chrome/browser/extensions/menu_manager.h"
34 #include "chrome/browser/extensions/pending_extension_manager.h" 35 #include "chrome/browser/extensions/pending_extension_manager.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // permissions the given extension has been granted. 388 // permissions the given extension has been granted.
388 bool ExtensionBindingsAllowed(const GURL& url); 389 bool ExtensionBindingsAllowed(const GURL& url);
389 390
390 // Returns the icon to display in the omnibox for the given extension. 391 // Returns the icon to display in the omnibox for the given extension.
391 gfx::Image GetOmniboxIcon(const std::string& extension_id); 392 gfx::Image GetOmniboxIcon(const std::string& extension_id);
392 393
393 // Returns the icon to display in the omnibox popup window for the given 394 // Returns the icon to display in the omnibox popup window for the given
394 // extension. 395 // extension.
395 gfx::Image GetOmniboxPopupIcon(const std::string& extension_id); 396 gfx::Image GetOmniboxPopupIcon(const std::string& extension_id);
396 397
398 // Retrieves the page action, browser action, or script badge for |extension|.
399 // If the result is not NULL, it remains valid until the extension is
400 // unloaded.
401 ExtensionAction* GetPageAction(const extensions::Extension& extension) const;
402 ExtensionAction* GetBrowserAction(
403 const extensions::Extension& extension) const;
404 ExtensionAction* GetScriptBadge(const extensions::Extension& extension) const;
405
397 // Called when the initial extensions load has completed. 406 // Called when the initial extensions load has completed.
398 virtual void OnLoadedInstalledExtensions(); 407 virtual void OnLoadedInstalledExtensions();
399 408
400 // Adds |extension| to this ExtensionService and notifies observers than an 409 // Adds |extension| to this ExtensionService and notifies observers than an
401 // extension has been loaded. Called by the backend after an extension has 410 // extension has been loaded. Called by the backend after an extension has
402 // been loaded from a file and installed. 411 // been loaded from a file and installed.
403 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE; 412 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE;
404 413
405 // Called by the backend when an extension has been installed. 414 // Called by the backend when an extension has been installed.
406 void OnExtensionInstalled( 415 void OnExtensionInstalled(
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 // Keeps track of app notifications. 821 // Keeps track of app notifications.
813 scoped_refptr<extensions::AppNotificationManager> app_notification_manager_; 822 scoped_refptr<extensions::AppNotificationManager> app_notification_manager_;
814 823
815 // Keeps track of favicon-sized omnibox icons for extensions. 824 // Keeps track of favicon-sized omnibox icons for extensions.
816 ExtensionIconManager omnibox_icon_manager_; 825 ExtensionIconManager omnibox_icon_manager_;
817 ExtensionIconManager omnibox_popup_icon_manager_; 826 ExtensionIconManager omnibox_popup_icon_manager_;
818 827
819 // Flag to make sure event routers are only initialized once. 828 // Flag to make sure event routers are only initialized once.
820 bool event_routers_initialized_; 829 bool event_routers_initialized_;
821 830
831 // Keyed by Extension ID. These maps are populated when the extension is
832 // loaded, and the entries are removed when the extension is unloaded. Not
833 // every extension has a page action or browser action, but all have a script
834 // badge.
835 std::map<std::string, ExtensionAction*> page_actions_;
Jeffrey Yasskin 2012/09/14 19:18:33 These actually need to be stored in an ExtensionAc
Aaron Boodman 2012/09/16 01:42:50 Per current design, it should be ExtensionSystem.
836 std::map<std::string, ExtensionAction*> browser_actions_;
837 std::map<std::string, ExtensionAction*> script_badges_;
838
822 scoped_ptr<HistoryExtensionEventRouter> history_event_router_; 839 scoped_ptr<HistoryExtensionEventRouter> history_event_router_;
823 840
824 scoped_ptr<extensions::BrowserEventRouter> browser_event_router_; 841 scoped_ptr<extensions::BrowserEventRouter> browser_event_router_;
825 842
826 scoped_ptr<extensions::WindowEventRouter> window_event_router_; 843 scoped_ptr<extensions::WindowEventRouter> window_event_router_;
827 844
828 scoped_ptr<ExtensionPreferenceEventRouter> preference_event_router_; 845 scoped_ptr<ExtensionPreferenceEventRouter> preference_event_router_;
829 846
830 scoped_ptr<BookmarkExtensionEventRouter> bookmark_event_router_; 847 scoped_ptr<BookmarkExtensionEventRouter> bookmark_event_router_;
831 848
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 #endif 898 #endif
882 899
883 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 900 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
884 InstallAppsWithUnlimtedStorage); 901 InstallAppsWithUnlimtedStorage);
885 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 902 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
886 InstallAppsAndCheckStorageProtection); 903 InstallAppsAndCheckStorageProtection);
887 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 904 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
888 }; 905 };
889 906
890 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 907 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698