Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_COMPONENT_MIGRATION_HELPER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_COMPONENT_MIGRATION_HELPER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_COMPONENT_MIGRATION_HELPER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_COMPONENT_MIGRATION_HELPER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 // extension loading. | 100 // extension loading. |
| 101 void OnFeatureDisabled(const std::string& component_action_id); | 101 void OnFeatureDisabled(const std::string& component_action_id); |
| 102 | 102 |
| 103 // Call when the user manually removes the component action from the toolbar. | 103 // Call when the user manually removes the component action from the toolbar. |
| 104 void OnActionRemoved(const std::string& component_action_id); | 104 void OnActionRemoved(const std::string& component_action_id); |
| 105 | 105 |
| 106 // extensions::ExtensionRegistryObserver: | 106 // extensions::ExtensionRegistryObserver: |
| 107 void OnExtensionReady(content::BrowserContext* browser_context, | 107 void OnExtensionReady(content::BrowserContext* browser_context, |
| 108 const Extension* extension) override; | 108 const Extension* extension) override; |
| 109 | 109 |
| 110 protected: | 110 // Gets and sets the preference for whether to put the component action with |
| 111 // Protected for unit testing. | 111 // the given ID on the toolbar (or in the overflow menu). |
| 112 bool GetComponentActionPref(const std::string& component_action_id) const; | |
| 112 void SetComponentActionPref(const std::string& component_action_id, | 113 void SetComponentActionPref(const std::string& component_action_id, |
|
imcheng
2016/09/13 23:13:09
Why is SetComponentActionPref public? I don't see
takumif
2016/09/14 04:00:51
It's for MRAction to call, which is in the other p
| |
| 113 bool enabled); | 114 bool enabled); |
| 114 | 115 |
| 116 protected: | |
| 115 // A set of component action ids whose features are currently enabled. | 117 // A set of component action ids whose features are currently enabled. |
| 116 // Protected for unit testing. | 118 // Protected for unit testing. |
| 117 std::set<std::string> enabled_actions_; | 119 std::set<std::string> enabled_actions_; |
| 118 | 120 |
| 119 private: | 121 private: |
| 120 bool IsExtensionInstalledAndEnabled(const ExtensionId& extension_id) const; | 122 bool IsExtensionInstalledAndEnabled(const ExtensionId& extension_id) const; |
| 121 void UnloadExtension(const ExtensionId& extension_id); | 123 void UnloadExtension(const ExtensionId& extension_id); |
| 122 void RemoveComponentActionPref(const std::string& component_action_id); | 124 void RemoveComponentActionPref(const std::string& component_action_id); |
| 123 std::vector<std::string> GetExtensionIdsForActionId( | 125 std::vector<std::string> GetExtensionIdsForActionId( |
| 124 const std::string& component_action_id) const; | 126 const std::string& component_action_id) const; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 136 | 138 |
| 137 // A list of pairs of component action ids and extension ids. | 139 // A list of pairs of component action ids and extension ids. |
| 138 std::vector<std::pair<std::string, ExtensionId>> migrated_actions_; | 140 std::vector<std::pair<std::string, ExtensionId>> migrated_actions_; |
| 139 | 141 |
| 140 DISALLOW_COPY_AND_ASSIGN(ComponentMigrationHelper); | 142 DISALLOW_COPY_AND_ASSIGN(ComponentMigrationHelper); |
| 141 }; | 143 }; |
| 142 | 144 |
| 143 } // namespace extensions | 145 } // namespace extensions |
| 144 | 146 |
| 145 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_MIGRATION_HELPER_H_ | 147 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_MIGRATION_HELPER_H_ |
| OLD | NEW |