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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 220 |
221 // When app notification setup is done, we call this to save the developer's | 221 // When app notification setup is done, we call this to save the developer's |
222 // oauth client id which we'll need at uninstall time to revoke the oauth | 222 // oauth client id which we'll need at uninstall time to revoke the oauth |
223 // permission grant for sending notifications. | 223 // permission grant for sending notifications. |
224 virtual void SetAppNotificationSetupDone(const std::string& extension_id, | 224 virtual void SetAppNotificationSetupDone(const std::string& extension_id, |
225 const std::string& oauth_client_id); | 225 const std::string& oauth_client_id); |
226 | 226 |
227 virtual void SetAppNotificationDisabled(const std::string& extension_id, | 227 virtual void SetAppNotificationDisabled(const std::string& extension_id, |
228 bool value); | 228 bool value); |
229 | 229 |
230 // Getters and setters for the position of Apps in the NTP. The setters | |
231 // will trigger a sync if needed. | |
232 // The getters return invalid StringOridinals for non-app extensions and | |
233 // setting ordinals for non-apps is an error. | |
234 StringOrdinal GetAppLaunchOrdinal(const std::string& extension_id) const; | |
235 void SetAppLaunchOrdinal(const std::string& extension_id, | |
236 const StringOrdinal& app_launch_ordinal); | |
237 StringOrdinal GetPageOrdinal(const std::string& extension_id) const; | |
238 void SetPageOrdinal(const std::string& extension_id, | |
239 const StringOrdinal& page_ordinal); | |
240 | |
241 // Updates the app launcher value for the moved extension so that it is now | 230 // Updates the app launcher value for the moved extension so that it is now |
242 // located after the given predecessor and before the successor. This will | 231 // located after the given predecessor and before the successor. This will |
243 // trigger a sync if needed. Empty strings are used to indicate no successor | 232 // trigger a sync if needed. Empty strings are used to indicate no successor |
244 // or predecessor. | 233 // or predecessor. |
245 void OnExtensionMoved(const std::string& moved_extension_id, | 234 void OnExtensionMoved(const std::string& moved_extension_id, |
246 const std::string& predecessor_extension_id, | 235 const std::string& predecessor_extension_id, |
247 const std::string& successor_extension_id); | 236 const std::string& successor_extension_id); |
248 | 237 |
249 // Returns true if the given extension can see events and data from another | 238 // Returns true if the given extension can see events and data from another |
250 // sub-profile (incognito to original profile, or vice versa). | 239 // sub-profile (incognito to original profile, or vice versa). |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // Unload all extensions. This is currently only called on shutdown, and | 357 // Unload all extensions. This is currently only called on shutdown, and |
369 // does not send notifications. | 358 // does not send notifications. |
370 void UnloadAllExtensions(); | 359 void UnloadAllExtensions(); |
371 | 360 |
372 // Called only by testing. | 361 // Called only by testing. |
373 void ReloadExtensions(); | 362 void ReloadExtensions(); |
374 | 363 |
375 // Scan the extension directory and clean up the cruft. | 364 // Scan the extension directory and clean up the cruft. |
376 void GarbageCollectExtensions(); | 365 void GarbageCollectExtensions(); |
377 | 366 |
| 367 // Notifies Sync (if needed) of a newly-installed extension or a change to |
| 368 // an existing extension. |
| 369 void SyncExtensionChangeIfNeeded(const Extension& extension); |
| 370 |
378 // The App that represents the web store. | 371 // The App that represents the web store. |
379 const Extension* GetWebStoreApp(); | 372 const Extension* GetWebStoreApp(); |
380 | 373 |
381 // Returns true if |url| should get extension api bindings and be permitted | 374 // Returns true if |url| should get extension api bindings and be permitted |
382 // to make api calls. Note that this is independent of what extension | 375 // to make api calls. Note that this is independent of what extension |
383 // permissions the given extension has been granted. | 376 // permissions the given extension has been granted. |
384 bool ExtensionBindingsAllowed(const GURL& url); | 377 bool ExtensionBindingsAllowed(const GURL& url); |
385 | 378 |
386 // Returns the icon to display in the omnibox for the given extension. | 379 // Returns the icon to display in the omnibox for the given extension. |
387 const SkBitmap& GetOmniboxIcon(const std::string& extension_id); | 380 const SkBitmap& GetOmniboxIcon(const std::string& extension_id); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 620 |
628 struct NaClModuleInfo { | 621 struct NaClModuleInfo { |
629 NaClModuleInfo(); | 622 NaClModuleInfo(); |
630 ~NaClModuleInfo(); | 623 ~NaClModuleInfo(); |
631 | 624 |
632 GURL url; | 625 GURL url; |
633 std::string mime_type; | 626 std::string mime_type; |
634 }; | 627 }; |
635 typedef std::list<NaClModuleInfo> NaClModuleInfoList; | 628 typedef std::list<NaClModuleInfo> NaClModuleInfoList; |
636 | 629 |
637 // Notifies Sync (if needed) of a newly-installed extension or a change to | |
638 // an existing extension. | |
639 void SyncExtensionChangeIfNeeded(const Extension& extension); | |
640 | |
641 // Get the appropriate SyncBundle, given some representation of Sync data. | 630 // Get the appropriate SyncBundle, given some representation of Sync data. |
642 SyncBundle* GetSyncBundleForExtension(const Extension& extension); | 631 SyncBundle* GetSyncBundleForExtension(const Extension& extension); |
643 SyncBundle* GetSyncBundleForExtensionSyncData( | 632 SyncBundle* GetSyncBundleForExtensionSyncData( |
644 const ExtensionSyncData& extension_sync_data); | 633 const ExtensionSyncData& extension_sync_data); |
645 SyncBundle* GetSyncBundleForModelType(syncable::ModelType type); | 634 SyncBundle* GetSyncBundleForModelType(syncable::ModelType type); |
646 const SyncBundle* GetSyncBundleForModelTypeConst(syncable::ModelType type) | 635 const SyncBundle* GetSyncBundleForModelTypeConst(syncable::ModelType type) |
647 const; | 636 const; |
648 | 637 |
649 // Gets the ExtensionSyncData for all extensions. | 638 // Gets the ExtensionSyncData for all extensions. |
650 std::vector<ExtensionSyncData> GetSyncDataList( | 639 std::vector<ExtensionSyncData> GetSyncDataList( |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 scoped_ptr<ExtensionGlobalError> extension_global_error_; | 839 scoped_ptr<ExtensionGlobalError> extension_global_error_; |
851 | 840 |
852 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 841 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
853 InstallAppsWithUnlimtedStorage); | 842 InstallAppsWithUnlimtedStorage); |
854 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 843 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
855 InstallAppsAndCheckStorageProtection); | 844 InstallAppsAndCheckStorageProtection); |
856 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 845 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
857 }; | 846 }; |
858 | 847 |
859 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 848 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |