| 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_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 // ExtensionManagement::Observer implementation. | 78 // ExtensionManagement::Observer implementation. |
| 79 void OnExtensionManagementSettingsChanged() override; | 79 void OnExtensionManagementSettingsChanged() override; |
| 80 | 80 |
| 81 // WarningService::Observer implementation. | 81 // WarningService::Observer implementation. |
| 82 void ExtensionWarningsChanged() override; | 82 void ExtensionWarningsChanged() override; |
| 83 | 83 |
| 84 // Helper method that reloads all unpacked extensions. | 84 // Helper method that reloads all unpacked extensions. |
| 85 void ReloadUnpackedExtensions(); | 85 void ReloadUnpackedExtensions(); |
| 86 | 86 |
| 87 // Callback for "requestExtensionsData" message. | 87 // Callback for "extensionSettingsLaunch" message. |
| 88 void HandleRequestExtensionsData(const base::ListValue* args); | |
| 89 | |
| 90 // Callback for "toggleDeveloperMode" message. | |
| 91 void HandleToggleDeveloperMode(const base::ListValue* args); | |
| 92 | |
| 93 // Callback for "launch" message. | |
| 94 void HandleLaunchMessage(const base::ListValue* args); | 88 void HandleLaunchMessage(const base::ListValue* args); |
| 95 | 89 |
| 96 // Callback for "repair" message. | 90 // Callback for "extensionSettingsRepair" message. |
| 97 void HandleRepairMessage(const base::ListValue* args); | 91 void HandleRepairMessage(const base::ListValue* args); |
| 98 | 92 |
| 99 // Callback for "options" message. | 93 // Callback for "extensionSettingsOptions" message. |
| 100 void HandleOptionsMessage(const base::ListValue* args); | 94 void HandleOptionsMessage(const base::ListValue* args); |
| 101 | 95 |
| 102 // Callback for "autoupdate" message. | 96 // Callback for "extensionSettingsAutoupdate" message. |
| 103 void HandleAutoUpdateMessage(const base::ListValue* args); | 97 void HandleAutoUpdateMessage(const base::ListValue* args); |
| 104 | 98 |
| 105 // Callback for the "showPath" message. | 99 // Callback for the "extensionSettingsShowPath" message. |
| 106 void HandleShowPath(const base::ListValue* args); | 100 void HandleShowPath(const base::ListValue* args); |
| 107 | 101 |
| 102 // Callback for the "extensionSettingsRegister" message. |
| 103 void HandleRegisterMessage(const base::ListValue* args); |
| 104 |
| 108 // Utility for callbacks that get an extension ID as the sole argument. | 105 // Utility for callbacks that get an extension ID as the sole argument. |
| 109 // Returns NULL if the extension isn't active. | 106 // Returns NULL if the extension isn't active. |
| 110 const Extension* GetActiveExtension(const base::ListValue* args); | 107 const Extension* GetActiveExtension(const base::ListValue* args); |
| 111 | 108 |
| 112 // Forces a UI update if appropriate after a notification is received. | 109 // Forces a UI update if appropriate after a notification is received. |
| 113 void MaybeUpdateAfterNotification(); | 110 void MaybeUpdateAfterNotification(); |
| 114 | 111 |
| 115 // Register for notifications that we need to reload the page. | |
| 116 void MaybeRegisterForNotifications(); | |
| 117 | |
| 118 // Called when the reinstallation is complete. | 112 // Called when the reinstallation is complete. |
| 119 void OnReinstallComplete(bool success, | 113 void OnReinstallComplete(bool success, |
| 120 const std::string& error, | 114 const std::string& error, |
| 121 webstore_install::Result result); | 115 webstore_install::Result result); |
| 122 | 116 |
| 123 // Our model. Outlives us since it's owned by our containing profile. | 117 // Our model. Outlives us since it's owned by our containing profile. |
| 124 ExtensionService* extension_service_; | 118 ExtensionService* extension_service_; |
| 125 | 119 |
| 126 // If true, we will ignore notifications in ::Observe(). This is needed | 120 // If true, we will ignore notifications in ::Observe(). This is needed |
| 127 // to prevent reloading the page when we were the cause of the | 121 // to prevent reloading the page when we were the cause of the |
| 128 // notification. | 122 // notification. |
| 129 bool ignore_notifications_; | 123 bool ignore_notifications_; |
| 130 | 124 |
| 131 // The page may be refreshed in response to a RenderViewHost being destroyed, | 125 // The page may be refreshed in response to a RenderViewHost being destroyed, |
| 132 // but the iteration over RenderViewHosts will include the host because the | 126 // but the iteration over RenderViewHosts will include the host because the |
| 133 // notification is sent when it is in the process of being deleted (and before | 127 // notification is sent when it is in the process of being deleted (and before |
| 134 // it is removed from the process). Keep a pointer to it so we can exclude | 128 // it is removed from the process). Keep a pointer to it so we can exclude |
| 135 // it from the active views. | 129 // it from the active views. |
| 136 content::RenderViewHost* deleting_rvh_; | 130 content::RenderViewHost* deleting_rvh_; |
| 137 // Do the same for a deleting RenderWidgetHost ID and RenderProcessHost ID. | 131 // Do the same for a deleting RenderWidgetHost ID and RenderProcessHost ID. |
| 138 int deleting_rwh_id_; | 132 int deleting_rwh_id_; |
| 139 int deleting_rph_id_; | 133 int deleting_rph_id_; |
| 140 | 134 |
| 141 // We want to register for notifications only after we've responded at least | |
| 142 // once to the page, otherwise we'd be calling JavaScript functions on objects | |
| 143 // that don't exist yet when notifications come in. This variable makes sure | |
| 144 // we do so only once. | |
| 145 bool registered_for_notifications_; | |
| 146 | |
| 147 content::NotificationRegistrar registrar_; | 135 content::NotificationRegistrar registrar_; |
| 148 | 136 |
| 149 ScopedObserver<WarningService, WarningService::Observer> | 137 ScopedObserver<WarningService, WarningService::Observer> |
| 150 warning_service_observer_; | 138 warning_service_observer_; |
| 151 | 139 |
| 152 // An observer to listen for notable changes in the ExtensionPrefs, like | 140 // An observer to listen for notable changes in the ExtensionPrefs, like |
| 153 // a change in Disable Reasons. | 141 // a change in Disable Reasons. |
| 154 ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver> | 142 ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver> |
| 155 extension_prefs_observer_; | 143 extension_prefs_observer_; |
| 156 | 144 |
| 157 ScopedObserver<ExtensionManagement, ExtensionManagement::Observer> | 145 ScopedObserver<ExtensionManagement, ExtensionManagement::Observer> |
| 158 extension_management_observer_; | 146 extension_management_observer_; |
| 159 | 147 |
| 160 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 148 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
| 161 }; | 149 }; |
| 162 | 150 |
| 163 } // namespace extensions | 151 } // namespace extensions |
| 164 | 152 |
| 165 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 153 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| OLD | NEW |