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