Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.h

Issue 948413005: [Extensions] Make chrome://extensions use management.uninstall (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/scoped_observer.h" 13 #include "base/scoped_observer.h"
14 #include "chrome/browser/extensions/error_console/error_console.h" 14 #include "chrome/browser/extensions/error_console/error_console.h"
15 #include "chrome/browser/extensions/extension_install_prompt.h" 15 #include "chrome/browser/extensions/extension_install_prompt.h"
16 #include "chrome/browser/extensions/extension_management.h" 16 #include "chrome/browser/extensions/extension_management.h"
17 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
18 #include "chrome/common/extensions/webstore_install_result.h" 17 #include "chrome/common/extensions/webstore_install_result.h"
19 #include "content/public/browser/navigation_controller.h" 18 #include "content/public/browser/navigation_controller.h"
20 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
22 #include "content/public/browser/web_contents_observer.h" 21 #include "content/public/browser/web_contents_observer.h"
23 #include "content/public/browser/web_ui_message_handler.h" 22 #include "content/public/browser/web_ui_message_handler.h"
24 #include "extensions/browser/extension_prefs.h" 23 #include "extensions/browser/extension_prefs.h"
25 #include "extensions/browser/extension_prefs_observer.h" 24 #include "extensions/browser/extension_prefs_observer.h"
26 #include "extensions/browser/extension_registry_observer.h" 25 #include "extensions/browser/extension_registry_observer.h"
27 #include "extensions/browser/warning_service.h" 26 #include "extensions/browser/warning_service.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Extension Settings UI handler. 65 // Extension Settings UI handler.
67 class ExtensionSettingsHandler 66 class ExtensionSettingsHandler
68 : public content::WebUIMessageHandler, 67 : public content::WebUIMessageHandler,
69 public content::NotificationObserver, 68 public content::NotificationObserver,
70 public content::WebContentsObserver, 69 public content::WebContentsObserver,
71 public ErrorConsole::Observer, 70 public ErrorConsole::Observer,
72 public ExtensionInstallPrompt::Delegate, 71 public ExtensionInstallPrompt::Delegate,
73 public ExtensionManagement::Observer, 72 public ExtensionManagement::Observer,
74 public ExtensionPrefsObserver, 73 public ExtensionPrefsObserver,
75 public ExtensionRegistryObserver, 74 public ExtensionRegistryObserver,
76 public ExtensionUninstallDialog::Delegate,
77 public WarningService::Observer, 75 public WarningService::Observer,
78 public base::SupportsWeakPtr<ExtensionSettingsHandler> { 76 public base::SupportsWeakPtr<ExtensionSettingsHandler> {
79 public: 77 public:
80 ExtensionSettingsHandler(); 78 ExtensionSettingsHandler();
81 ~ExtensionSettingsHandler() override; 79 ~ExtensionSettingsHandler() override;
82 80
83 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 81 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
84 82
85 // Extension Detail JSON Struct for page. |pages| is injected for unit 83 // Extension Detail JSON Struct for page. |pages| is injected for unit
86 // testing. 84 // testing.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const Extension* extension, 125 const Extension* extension,
128 extensions::UninstallReason reason) override; 126 extensions::UninstallReason reason) override;
129 127
130 // ExtensionPrefsObserver implementation. 128 // ExtensionPrefsObserver implementation.
131 void OnExtensionDisableReasonsChanged(const std::string& extension_id, 129 void OnExtensionDisableReasonsChanged(const std::string& extension_id,
132 int disable_reasons) override; 130 int disable_reasons) override;
133 131
134 // ExtensionManagement::Observer implementation. 132 // ExtensionManagement::Observer implementation.
135 void OnExtensionManagementSettingsChanged() override; 133 void OnExtensionManagementSettingsChanged() override;
136 134
137 // ExtensionUninstallDialog::Delegate implementation, used for receiving
138 // notification about uninstall confirmation dialog selections.
139 void ExtensionUninstallAccepted() override;
140 void ExtensionUninstallCanceled() override;
141
142 // WarningService::Observer implementation. 135 // WarningService::Observer implementation.
143 void ExtensionWarningsChanged() override; 136 void ExtensionWarningsChanged() override;
144 137
145 // ExtensionInstallPrompt::Delegate implementation. 138 // ExtensionInstallPrompt::Delegate implementation.
146 void InstallUIProceed() override; 139 void InstallUIProceed() override;
147 void InstallUIAbort(bool user_initiated) override; 140 void InstallUIAbort(bool user_initiated) override;
148 141
149 // Called after the App Info Dialog has closed. 142 // Called after the App Info Dialog has closed.
150 virtual void AppInfoDialogClosed(); 143 virtual void AppInfoDialogClosed();
151 144
(...skipping 23 matching lines...) Expand all
175 168
176 // Callback for "enableErrorCollection" message. 169 // Callback for "enableErrorCollection" message.
177 void HandleEnableErrorCollectionMessage(const base::ListValue* args); 170 void HandleEnableErrorCollectionMessage(const base::ListValue* args);
178 171
179 // Callback for "allowFileAcces" message. 172 // Callback for "allowFileAcces" message.
180 void HandleAllowFileAccessMessage(const base::ListValue* args); 173 void HandleAllowFileAccessMessage(const base::ListValue* args);
181 174
182 // Callback for "allowOnAllUrls" message. 175 // Callback for "allowOnAllUrls" message.
183 void HandleAllowOnAllUrlsMessage(const base::ListValue* args); 176 void HandleAllowOnAllUrlsMessage(const base::ListValue* args);
184 177
185 // Callback for "uninstall" message.
186 void HandleUninstallMessage(const base::ListValue* args);
187
188 // Callback for "options" message. 178 // Callback for "options" message.
189 void HandleOptionsMessage(const base::ListValue* args); 179 void HandleOptionsMessage(const base::ListValue* args);
190 180
191 // Callback for "permissions" message. 181 // Callback for "permissions" message.
192 void HandlePermissionsMessage(const base::ListValue* args); 182 void HandlePermissionsMessage(const base::ListValue* args);
193 183
194 // Callback for "showButton" message. 184 // Callback for "showButton" message.
195 void HandleShowButtonMessage(const base::ListValue* args); 185 void HandleShowButtonMessage(const base::ListValue* args);
196 186
197 // Callback for "autoupdate" message. 187 // Callback for "autoupdate" message.
(...skipping 22 matching lines...) Expand all
220 std::vector<ExtensionPage> GetInspectablePagesForExtension( 210 std::vector<ExtensionPage> GetInspectablePagesForExtension(
221 const Extension* extension, bool extension_is_enabled); 211 const Extension* extension, bool extension_is_enabled);
222 void GetInspectablePagesForExtensionProcess( 212 void GetInspectablePagesForExtensionProcess(
223 const Extension* extension, 213 const Extension* extension,
224 const std::set<content::RenderViewHost*>& views, 214 const std::set<content::RenderViewHost*>& views,
225 std::vector<ExtensionPage>* result); 215 std::vector<ExtensionPage>* result);
226 void GetAppWindowPagesForExtensionProfile(const Extension* extension, 216 void GetAppWindowPagesForExtensionProfile(const Extension* extension,
227 Profile* profile, 217 Profile* profile,
228 std::vector<ExtensionPage>* result); 218 std::vector<ExtensionPage>* result);
229 219
230 // Returns the ExtensionUninstallDialog object for this class, creating it if
231 // needed.
232 ExtensionUninstallDialog* GetExtensionUninstallDialog();
233
234 // Called when the reinstallation is complete. 220 // Called when the reinstallation is complete.
235 void OnReinstallComplete(bool success, 221 void OnReinstallComplete(bool success,
236 const std::string& error, 222 const std::string& error,
237 webstore_install::Result result); 223 webstore_install::Result result);
238 224
239 // Handles the load retry notification sent from 225 // Handles the load retry notification sent from
240 // ExtensionService::ReportExtensionLoadError. Attempts to retry loading 226 // ExtensionService::ReportExtensionLoadError. Attempts to retry loading
241 // extension from |path| if retry is true, otherwise removes |path| from the 227 // extension from |path| if retry is true, otherwise removes |path| from the
242 // vector of currently loading extensions. 228 // vector of currently loading extensions.
243 // 229 //
244 // Does nothing if |path| is not a currently loading extension this object is 230 // Does nothing if |path| is not a currently loading extension this object is
245 // tracking. 231 // tracking.
246 void HandleLoadRetryMessage(bool retry, const base::FilePath& path); 232 void HandleLoadRetryMessage(bool retry, const base::FilePath& path);
247 233
248 // Our model. Outlives us since it's owned by our containing profile. 234 // Our model. Outlives us since it's owned by our containing profile.
249 ExtensionService* extension_service_; 235 ExtensionService* extension_service_;
250 236
251 // A convenience member, filled once the extension_service_ is known. 237 // A convenience member, filled once the extension_service_ is known.
252 ManagementPolicy* management_policy_; 238 ManagementPolicy* management_policy_;
253 239
254 // Used to show confirmation UI for uninstalling extensions in incognito mode.
255 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_;
256
257 // The id of the extension we are prompting the user about. 240 // The id of the extension we are prompting the user about.
258 std::string extension_id_prompting_; 241 std::string extension_id_prompting_;
259 242
260 // If true, we will ignore notifications in ::Observe(). This is needed 243 // If true, we will ignore notifications in ::Observe(). This is needed
261 // to prevent reloading the page when we were the cause of the 244 // to prevent reloading the page when we were the cause of the
262 // notification. 245 // notification.
263 bool ignore_notifications_; 246 bool ignore_notifications_;
264 247
265 // The page may be refreshed in response to a RenderViewHost being destroyed, 248 // The page may be refreshed in response to a RenderViewHost being destroyed,
266 // but the iteration over RenderViewHosts will include the host because the 249 // but the iteration over RenderViewHosts will include the host because the
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off 286 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off
304 // a verification check to try and rescue them. 287 // a verification check to try and rescue them.
305 bool should_do_verification_check_; 288 bool should_do_verification_check_;
306 289
307 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); 290 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler);
308 }; 291 };
309 292
310 } // namespace extensions 293 } // namespace extensions
311 294
312 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ 295 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698