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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 // Returns the ExtensionInfo from the prefs for the given extension. If the | 434 // Returns the ExtensionInfo from the prefs for the given extension. If the |
434 // extension is not present, NULL is returned. | 435 // extension is not present, NULL is returned. |
435 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( | 436 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( |
436 const std::string& extension_id) const; | 437 const std::string& extension_id) const; |
437 | 438 |
438 // We've downloaded an updated .crx file for the extension, but are waiting | 439 // We've downloaded an updated .crx file for the extension, but are waiting |
439 // to install it. | 440 // to install it. |
440 void SetDelayedInstallInfo(const Extension* extension, | 441 void SetDelayedInstallInfo(const Extension* extension, |
441 Extension::State initial_state, | 442 Extension::State initial_state, |
442 bool blacklisted_for_malware, | 443 bool blacklisted_for_malware, |
| 444 bool is_ephemeral, |
443 DelayReason delay_reason, | 445 DelayReason delay_reason, |
444 const syncer::StringOrdinal& page_ordinal, | 446 const syncer::StringOrdinal& page_ordinal, |
445 const std::string& install_parameter); | 447 const std::string& install_parameter); |
446 | 448 |
447 // Removes any delayed install information we have for the given | 449 // Removes any delayed install information we have for the given |
448 // |extension_id|. Returns true if there was info to remove; false otherwise. | 450 // |extension_id|. Returns true if there was info to remove; false otherwise. |
449 bool RemoveDelayedInstallInfo(const std::string& extension_id); | 451 bool RemoveDelayedInstallInfo(const std::string& extension_id); |
450 | 452 |
451 // Update the prefs to finish the update for an extension. | 453 // Update the prefs to finish the update for an extension. |
452 bool FinishDelayedInstallInfo(const std::string& extension_id); | 454 bool FinishDelayedInstallInfo(const std::string& extension_id); |
(...skipping 13 matching lines...) Expand all Loading... |
466 scoped_ptr<ExtensionsInfo> GetEvictedEphemeralAppsInfo() const; | 468 scoped_ptr<ExtensionsInfo> GetEvictedEphemeralAppsInfo() const; |
467 | 469 |
468 // Return information about a specific evicted ephemeral app. Can return NULL | 470 // Return information about a specific evicted ephemeral app. Can return NULL |
469 // if no such evicted app exists or is currently installed. | 471 // if no such evicted app exists or is currently installed. |
470 scoped_ptr<ExtensionInfo> GetEvictedEphemeralAppInfo( | 472 scoped_ptr<ExtensionInfo> GetEvictedEphemeralAppInfo( |
471 const std::string& extension_id) const; | 473 const std::string& extension_id) const; |
472 | 474 |
473 // Permanently remove the preferences for an evicted ephemeral app. | 475 // Permanently remove the preferences for an evicted ephemeral app. |
474 void RemoveEvictedEphemeralApp(const std::string& extension_id); | 476 void RemoveEvictedEphemeralApp(const std::string& extension_id); |
475 | 477 |
| 478 // Returns true if the extension is an ephemeral app. |
| 479 bool IsEphemeralApp(const std::string& extension_id) const; |
| 480 |
476 // Returns true if the user repositioned the app on the app launcher via drag | 481 // Returns true if the user repositioned the app on the app launcher via drag |
477 // and drop. | 482 // and drop. |
478 bool WasAppDraggedByUser(const std::string& extension_id); | 483 bool WasAppDraggedByUser(const std::string& extension_id); |
479 | 484 |
480 // Sets a flag indicating that the user repositioned the app on the app | 485 // Sets a flag indicating that the user repositioned the app on the app |
481 // launcher by drag and dropping it. | 486 // launcher by drag and dropping it. |
482 void SetAppDraggedByUser(const std::string& extension_id); | 487 void SetAppDraggedByUser(const std::string& extension_id); |
483 | 488 |
484 // Returns true if there is an extension which controls the preference value | 489 // Returns true if there is an extension which controls the preference value |
485 // for |pref_key| *and* it is specific to incognito mode. | 490 // for |pref_key| *and* it is specific to incognito mode. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 const ExtensionIdContainer& strings); | 677 const ExtensionIdContainer& strings); |
673 | 678 |
674 // Helper function to populate |extension_dict| with the values needed | 679 // Helper function to populate |extension_dict| with the values needed |
675 // by a newly installed extension. Work is broken up between this | 680 // by a newly installed extension. Work is broken up between this |
676 // function and FinishExtensionInfoPrefs() to accomodate delayed | 681 // function and FinishExtensionInfoPrefs() to accomodate delayed |
677 // installations. | 682 // installations. |
678 void PopulateExtensionInfoPrefs(const Extension* extension, | 683 void PopulateExtensionInfoPrefs(const Extension* extension, |
679 const base::Time install_time, | 684 const base::Time install_time, |
680 Extension::State initial_state, | 685 Extension::State initial_state, |
681 bool blacklisted_for_malware, | 686 bool blacklisted_for_malware, |
| 687 bool is_ephemeral, |
682 const std::string& install_parameter, | 688 const std::string& install_parameter, |
683 base::DictionaryValue* extension_dict); | 689 base::DictionaryValue* extension_dict); |
684 | 690 |
685 void InitExtensionControlledPrefs(ExtensionPrefValueMap* value_map); | 691 void InitExtensionControlledPrefs(ExtensionPrefValueMap* value_map); |
686 | 692 |
687 // Helper function to complete initialization of the values in | 693 // Helper function to complete initialization of the values in |
688 // |extension_dict| for an extension install. Also see | 694 // |extension_dict| for an extension install. Also see |
689 // PopulateExtensionInfoPrefs(). | 695 // PopulateExtensionInfoPrefs(). |
690 void FinishExtensionInfoPrefs( | 696 void FinishExtensionInfoPrefs( |
691 const std::string& extension_id, | 697 const std::string& extension_id, |
(...skipping 21 matching lines...) Expand all Loading... |
713 bool extensions_disabled_; | 719 bool extensions_disabled_; |
714 | 720 |
715 ObserverList<ExtensionPrefsObserver> observer_list_; | 721 ObserverList<ExtensionPrefsObserver> observer_list_; |
716 | 722 |
717 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 723 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
718 }; | 724 }; |
719 | 725 |
720 } // namespace extensions | 726 } // namespace extensions |
721 | 727 |
722 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 728 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
OLD | NEW |