| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // Sets the set of known disabled extension IDs. | 183 // Sets the set of known disabled extension IDs. |
| 184 void SetKnownDisabled(const ExtensionIdSet& extension_ids); | 184 void SetKnownDisabled(const ExtensionIdSet& extension_ids); |
| 185 | 185 |
| 186 // Called when an extension is installed, so that prefs get created. | 186 // Called when an extension is installed, so that prefs get created. |
| 187 // |blacklisted_for_malware| should be set if the extension was included in a | 187 // |blacklisted_for_malware| should be set if the extension was included in a |
| 188 // blacklist due to being malware. If |page_ordinal| is an invalid ordinal, | 188 // blacklist due to being malware. If |page_ordinal| is an invalid ordinal, |
| 189 // then a page will be found for the App. | 189 // then a page will be found for the App. |
| 190 void OnExtensionInstalled(const Extension* extension, | 190 void OnExtensionInstalled(const Extension* extension, |
| 191 Extension::State initial_state, | 191 Extension::State initial_state, |
| 192 bool blacklisted_for_malware, | 192 bool blacklisted_for_malware, |
| 193 bool is_ephemeral, |
| 193 const syncer::StringOrdinal& page_ordinal, | 194 const syncer::StringOrdinal& page_ordinal, |
| 194 const std::string& install_parameter); | 195 const std::string& install_parameter); |
| 195 | 196 |
| 196 // Called when an extension is uninstalled, so that prefs get cleaned up. | 197 // Called when an extension is uninstalled, so that prefs get cleaned up. |
| 197 void OnExtensionUninstalled(const std::string& extension_id, | 198 void OnExtensionUninstalled(const std::string& extension_id, |
| 198 const Manifest::Location& location, | 199 const Manifest::Location& location, |
| 199 bool external_uninstall); | 200 bool external_uninstall); |
| 200 | 201 |
| 201 // Called to change the extension's state when it is enabled/disabled. | 202 // Called to change the extension's state when it is enabled/disabled. |
| 202 void SetExtensionState(const std::string& extension_id, Extension::State); | 203 void SetExtensionState(const std::string& extension_id, Extension::State); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 // Returns the ExtensionInfo from the prefs for the given extension. If the | 436 // Returns the ExtensionInfo from the prefs for the given extension. If the |
| 436 // extension is not present, NULL is returned. | 437 // extension is not present, NULL is returned. |
| 437 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( | 438 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( |
| 438 const std::string& extension_id) const; | 439 const std::string& extension_id) const; |
| 439 | 440 |
| 440 // We've downloaded an updated .crx file for the extension, but are waiting | 441 // We've downloaded an updated .crx file for the extension, but are waiting |
| 441 // to install it. | 442 // to install it. |
| 442 void SetDelayedInstallInfo(const Extension* extension, | 443 void SetDelayedInstallInfo(const Extension* extension, |
| 443 Extension::State initial_state, | 444 Extension::State initial_state, |
| 444 bool blacklisted_for_malware, | 445 bool blacklisted_for_malware, |
| 446 bool is_ephemeral, |
| 445 DelayReason delay_reason, | 447 DelayReason delay_reason, |
| 446 const syncer::StringOrdinal& page_ordinal, | 448 const syncer::StringOrdinal& page_ordinal, |
| 447 const std::string& install_parameter); | 449 const std::string& install_parameter); |
| 448 | 450 |
| 449 // Removes any delayed install information we have for the given | 451 // Removes any delayed install information we have for the given |
| 450 // |extension_id|. Returns true if there was info to remove; false otherwise. | 452 // |extension_id|. Returns true if there was info to remove; false otherwise. |
| 451 bool RemoveDelayedInstallInfo(const std::string& extension_id); | 453 bool RemoveDelayedInstallInfo(const std::string& extension_id); |
| 452 | 454 |
| 453 // Update the prefs to finish the update for an extension. | 455 // Update the prefs to finish the update for an extension. |
| 454 bool FinishDelayedInstallInfo(const std::string& extension_id); | 456 bool FinishDelayedInstallInfo(const std::string& extension_id); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 468 scoped_ptr<ExtensionsInfo> GetEvictedEphemeralAppsInfo() const; | 470 scoped_ptr<ExtensionsInfo> GetEvictedEphemeralAppsInfo() const; |
| 469 | 471 |
| 470 // Return information about a specific evicted ephemeral app. Can return NULL | 472 // Return information about a specific evicted ephemeral app. Can return NULL |
| 471 // if no such evicted app exists or is currently installed. | 473 // if no such evicted app exists or is currently installed. |
| 472 scoped_ptr<ExtensionInfo> GetEvictedEphemeralAppInfo( | 474 scoped_ptr<ExtensionInfo> GetEvictedEphemeralAppInfo( |
| 473 const std::string& extension_id) const; | 475 const std::string& extension_id) const; |
| 474 | 476 |
| 475 // Permanently remove the preferences for an evicted ephemeral app. | 477 // Permanently remove the preferences for an evicted ephemeral app. |
| 476 void RemoveEvictedEphemeralApp(const std::string& extension_id); | 478 void RemoveEvictedEphemeralApp(const std::string& extension_id); |
| 477 | 479 |
| 480 // Returns true if the extension is an ephemeral app. |
| 481 bool IsEphemeralApp(const std::string& extension_id) const; |
| 482 |
| 478 // Returns true if the user repositioned the app on the app launcher via drag | 483 // Returns true if the user repositioned the app on the app launcher via drag |
| 479 // and drop. | 484 // and drop. |
| 480 bool WasAppDraggedByUser(const std::string& extension_id); | 485 bool WasAppDraggedByUser(const std::string& extension_id); |
| 481 | 486 |
| 482 // Sets a flag indicating that the user repositioned the app on the app | 487 // Sets a flag indicating that the user repositioned the app on the app |
| 483 // launcher by drag and dropping it. | 488 // launcher by drag and dropping it. |
| 484 void SetAppDraggedByUser(const std::string& extension_id); | 489 void SetAppDraggedByUser(const std::string& extension_id); |
| 485 | 490 |
| 486 // Returns true if there is an extension which controls the preference value | 491 // Returns true if there is an extension which controls the preference value |
| 487 // for |pref_key| *and* it is specific to incognito mode. | 492 // for |pref_key| *and* it is specific to incognito mode. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 const ExtensionIdContainer& strings); | 679 const ExtensionIdContainer& strings); |
| 675 | 680 |
| 676 // Helper function to populate |extension_dict| with the values needed | 681 // Helper function to populate |extension_dict| with the values needed |
| 677 // by a newly installed extension. Work is broken up between this | 682 // by a newly installed extension. Work is broken up between this |
| 678 // function and FinishExtensionInfoPrefs() to accomodate delayed | 683 // function and FinishExtensionInfoPrefs() to accomodate delayed |
| 679 // installations. | 684 // installations. |
| 680 void PopulateExtensionInfoPrefs(const Extension* extension, | 685 void PopulateExtensionInfoPrefs(const Extension* extension, |
| 681 const base::Time install_time, | 686 const base::Time install_time, |
| 682 Extension::State initial_state, | 687 Extension::State initial_state, |
| 683 bool blacklisted_for_malware, | 688 bool blacklisted_for_malware, |
| 689 bool is_ephemeral, |
| 684 const std::string& install_parameter, | 690 const std::string& install_parameter, |
| 685 base::DictionaryValue* extension_dict); | 691 base::DictionaryValue* extension_dict); |
| 686 | 692 |
| 687 void InitExtensionControlledPrefs(ExtensionPrefValueMap* value_map); | 693 void InitExtensionControlledPrefs(ExtensionPrefValueMap* value_map); |
| 688 | 694 |
| 689 // Helper function to complete initialization of the values in | 695 // Helper function to complete initialization of the values in |
| 690 // |extension_dict| for an extension install. Also see | 696 // |extension_dict| for an extension install. Also see |
| 691 // PopulateExtensionInfoPrefs(). | 697 // PopulateExtensionInfoPrefs(). |
| 692 void FinishExtensionInfoPrefs( | 698 void FinishExtensionInfoPrefs( |
| 693 const std::string& extension_id, | 699 const std::string& extension_id, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 715 bool extensions_disabled_; | 721 bool extensions_disabled_; |
| 716 | 722 |
| 717 ObserverList<ExtensionPrefsObserver> observer_list_; | 723 ObserverList<ExtensionPrefsObserver> observer_list_; |
| 718 | 724 |
| 719 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 725 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
| 720 }; | 726 }; |
| 721 | 727 |
| 722 } // namespace extensions | 728 } // namespace extensions |
| 723 | 729 |
| 724 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 730 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
| OLD | NEW |