| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 public extensions::ExternalProviderInterface::VisitorInterface, | 137 public extensions::ExternalProviderInterface::VisitorInterface, |
| 138 public content::NotificationObserver, | 138 public content::NotificationObserver, |
| 139 public extensions::Blacklist::Observer { | 139 public extensions::Blacklist::Observer { |
| 140 public: | 140 public: |
| 141 // Returns the Extension of hosted or packaged apps, NULL otherwise. | 141 // Returns the Extension of hosted or packaged apps, NULL otherwise. |
| 142 const extensions::Extension* GetInstalledApp(const GURL& url) const; | 142 const extensions::Extension* GetInstalledApp(const GURL& url) const; |
| 143 | 143 |
| 144 // Returns whether the URL is from either a hosted or packaged app. | 144 // Returns whether the URL is from either a hosted or packaged app. |
| 145 bool IsInstalledApp(const GURL& url) const; | 145 bool IsInstalledApp(const GURL& url) const; |
| 146 | 146 |
| 147 // If the renderer is hosting an installed app with isolated storage, | |
| 148 // returns it, otherwise returns NULL. | |
| 149 const extensions::Extension* GetIsolatedAppForRenderer( | |
| 150 int renderer_child_id) const; | |
| 151 | |
| 152 // Attempts to uninstall an extension from a given ExtensionService. Returns | 147 // Attempts to uninstall an extension from a given ExtensionService. Returns |
| 153 // true iff the target extension exists. | 148 // true iff the target extension exists. |
| 154 static bool UninstallExtensionHelper(ExtensionService* extensions_service, | 149 static bool UninstallExtensionHelper(ExtensionService* extensions_service, |
| 155 const std::string& extension_id); | 150 const std::string& extension_id); |
| 156 | 151 |
| 157 // Constructor stores pointers to |profile| and |extension_prefs| but | 152 // Constructor stores pointers to |profile| and |extension_prefs| but |
| 158 // ownership remains at caller. | 153 // ownership remains at caller. |
| 159 ExtensionService(Profile* profile, | 154 ExtensionService(Profile* profile, |
| 160 const CommandLine* command_line, | 155 const CommandLine* command_line, |
| 161 const base::FilePath& install_directory, | 156 const base::FilePath& install_directory, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 179 scoped_ptr<const ExtensionSet> GenerateInstalledExtensionsSet() const; | 174 scoped_ptr<const ExtensionSet> GenerateInstalledExtensionsSet() const; |
| 180 | 175 |
| 181 // Gets the object managing the set of pending extensions. | 176 // Gets the object managing the set of pending extensions. |
| 182 virtual extensions::PendingExtensionManager* | 177 virtual extensions::PendingExtensionManager* |
| 183 pending_extension_manager() OVERRIDE; | 178 pending_extension_manager() OVERRIDE; |
| 184 | 179 |
| 185 const base::FilePath& install_directory() const { return install_directory_; } | 180 const base::FilePath& install_directory() const { return install_directory_; } |
| 186 | 181 |
| 187 extensions::ProcessMap* process_map() { return &process_map_; } | 182 extensions::ProcessMap* process_map() { return &process_map_; } |
| 188 | 183 |
| 189 // Whether this extension can run in an incognito window. | |
| 190 virtual bool IsIncognitoEnabled(const std::string& extension_id) const; | |
| 191 virtual void SetIsIncognitoEnabled(const std::string& extension_id, | |
| 192 bool enabled); | |
| 193 | |
| 194 // Updates the app launcher value for the moved extension so that it is now | 184 // Updates the app launcher value for the moved extension so that it is now |
| 195 // located after the given predecessor and before the successor. This will | 185 // located after the given predecessor and before the successor. This will |
| 196 // trigger a sync if needed. Empty strings are used to indicate no successor | 186 // trigger a sync if needed. Empty strings are used to indicate no successor |
| 197 // or predecessor. | 187 // or predecessor. |
| 198 void OnExtensionMoved(const std::string& moved_extension_id, | 188 void OnExtensionMoved(const std::string& moved_extension_id, |
| 199 const std::string& predecessor_extension_id, | 189 const std::string& predecessor_extension_id, |
| 200 const std::string& successor_extension_id); | 190 const std::string& successor_extension_id); |
| 201 | 191 |
| 202 // Returns true if the given extension can see events and data from another | |
| 203 // sub-profile (incognito to original profile, or vice versa). | |
| 204 bool CanCrossIncognito(const extensions::Extension* extension) const; | |
| 205 | |
| 206 // Returns true if the given extension can be loaded in incognito. | |
| 207 bool CanLoadInIncognito(const extensions::Extension* extension) const; | |
| 208 | |
| 209 // Whether this extension can inject scripts into pages with file URLs. | |
| 210 bool AllowFileAccess(const extensions::Extension* extension) const; | |
| 211 // Will reload the extension since this permission is applied at loading time | |
| 212 // only. | |
| 213 void SetAllowFileAccess(const extensions::Extension* extension, bool allow); | |
| 214 | |
| 215 // Whether the persistent background page, if any, is ready. We don't load | 192 // Whether the persistent background page, if any, is ready. We don't load |
| 216 // other components until then. If there is no background page, or if it is | 193 // other components until then. If there is no background page, or if it is |
| 217 // non-persistent (lazy), we consider it to be ready. | 194 // non-persistent (lazy), we consider it to be ready. |
| 218 bool IsBackgroundPageReady(const extensions::Extension* extension) const; | 195 bool IsBackgroundPageReady(const extensions::Extension* extension) const; |
| 219 void SetBackgroundPageReady(const extensions::Extension* extension); | 196 void SetBackgroundPageReady(const extensions::Extension* extension); |
| 220 | 197 |
| 221 // Getter and setter for the flag that specifies whether the extension is | 198 // Getter and setter for the flag that specifies whether the extension is |
| 222 // being upgraded. | 199 // being upgraded. |
| 223 bool IsBeingUpgraded(const extensions::Extension* extension) const; | 200 bool IsBeingUpgraded(const extensions::Extension* extension) const; |
| 224 void SetBeingUpgraded(const extensions::Extension* extension, bool value); | 201 void SetBeingUpgraded(const extensions::Extension* extension, bool value); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 | 473 |
| 497 bool show_extensions_prompts() { | 474 bool show_extensions_prompts() { |
| 498 return show_extensions_prompts_; | 475 return show_extensions_prompts_; |
| 499 } | 476 } |
| 500 | 477 |
| 501 Profile* profile(); | 478 Profile* profile(); |
| 502 | 479 |
| 503 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const, | 480 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const, |
| 504 // ExtensionPrefs* mutable_extension_prefs(). | 481 // ExtensionPrefs* mutable_extension_prefs(). |
| 505 extensions::ExtensionPrefs* extension_prefs(); | 482 extensions::ExtensionPrefs* extension_prefs(); |
| 483 const extensions::ExtensionPrefs* extension_prefs() const; |
| 506 | 484 |
| 507 extensions::SettingsFrontend* settings_frontend(); | 485 extensions::SettingsFrontend* settings_frontend(); |
| 508 | 486 |
| 509 extensions::ContentSettingsStore* GetContentSettingsStore(); | 487 extensions::ContentSettingsStore* GetContentSettingsStore(); |
| 510 | 488 |
| 511 // Whether the extension service is ready. | 489 // Whether the extension service is ready. |
| 512 virtual bool is_ready() OVERRIDE; | 490 virtual bool is_ready() OVERRIDE; |
| 513 | 491 |
| 514 virtual base::SequencedTaskRunner* GetFileTaskRunner() OVERRIDE; | 492 virtual base::SequencedTaskRunner* GetFileTaskRunner() OVERRIDE; |
| 515 | 493 |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 #endif | 926 #endif |
| 949 | 927 |
| 950 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 928 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 951 InstallAppsWithUnlimtedStorage); | 929 InstallAppsWithUnlimtedStorage); |
| 952 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 930 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 953 InstallAppsAndCheckStorageProtection); | 931 InstallAppsAndCheckStorageProtection); |
| 954 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 932 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 955 }; | 933 }; |
| 956 | 934 |
| 957 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 935 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |