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

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

Issue 989813002: [Extensions] Make a chrome.developerPrivate.getExtensionsInfo function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/api/developer_private/inspectable_views_find er.h"
14 #include "chrome/browser/extensions/error_console/error_console.h" 15 #include "chrome/browser/extensions/error_console/error_console.h"
15 #include "chrome/browser/extensions/extension_install_prompt.h" 16 #include "chrome/browser/extensions/extension_install_prompt.h"
16 #include "chrome/browser/extensions/extension_management.h" 17 #include "chrome/browser/extensions/extension_management.h"
17 #include "chrome/common/extensions/webstore_install_result.h" 18 #include "chrome/common/extensions/webstore_install_result.h"
18 #include "content/public/browser/navigation_controller.h" 19 #include "content/public/browser/navigation_controller.h"
19 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
21 #include "content/public/browser/web_contents_observer.h" 22 #include "content/public/browser/web_contents_observer.h"
22 #include "content/public/browser/web_ui_message_handler.h" 23 #include "content/public/browser/web_ui_message_handler.h"
23 #include "extensions/browser/extension_prefs.h" 24 #include "extensions/browser/extension_prefs.h"
(...skipping 16 matching lines...) Expand all
40 41
41 namespace user_prefs { 42 namespace user_prefs {
42 class PrefRegistrySyncable; 43 class PrefRegistrySyncable;
43 } 44 }
44 45
45 namespace extensions { 46 namespace extensions {
46 class Extension; 47 class Extension;
47 class ExtensionRegistry; 48 class ExtensionRegistry;
48 class ManagementPolicy; 49 class ManagementPolicy;
49 50
50 // Information about a page running in an extension, for example a popup bubble,
51 // a background page, or a tab contents.
52 struct ExtensionPage {
53 ExtensionPage(const GURL& url,
54 int render_process_id,
55 int render_view_id,
56 bool incognito,
57 bool generated_background_page);
58 GURL url;
59 int render_process_id;
60 int render_view_id;
61 bool incognito;
62 bool generated_background_page;
63 };
64
65 // Extension Settings UI handler. 51 // Extension Settings UI handler.
66 class ExtensionSettingsHandler 52 class ExtensionSettingsHandler
67 : public content::WebUIMessageHandler, 53 : public content::WebUIMessageHandler,
68 public content::NotificationObserver, 54 public content::NotificationObserver,
69 public content::WebContentsObserver, 55 public content::WebContentsObserver,
70 public ErrorConsole::Observer, 56 public ErrorConsole::Observer,
71 public ExtensionInstallPrompt::Delegate, 57 public ExtensionInstallPrompt::Delegate,
72 public ExtensionManagement::Observer, 58 public ExtensionManagement::Observer,
73 public ExtensionPrefsObserver, 59 public ExtensionPrefsObserver,
74 public ExtensionRegistryObserver, 60 public ExtensionRegistryObserver,
75 public WarningService::Observer, 61 public WarningService::Observer,
76 public base::SupportsWeakPtr<ExtensionSettingsHandler> { 62 public base::SupportsWeakPtr<ExtensionSettingsHandler> {
77 public: 63 public:
78 ExtensionSettingsHandler(); 64 ExtensionSettingsHandler();
79 ~ExtensionSettingsHandler() override; 65 ~ExtensionSettingsHandler() override;
80 66
81 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 67 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
82 68
83 // Extension Detail JSON Struct for page. |pages| is injected for unit 69 // Extension Detail JSON Struct for page. |pages| is injected for unit
84 // testing. 70 // testing.
85 // Note: |warning_service| can be NULL in unit tests. 71 // Note: |warning_service| can be NULL in unit tests.
86 base::DictionaryValue* CreateExtensionDetailValue( 72 base::DictionaryValue* CreateExtensionDetailValue(
87 const Extension* extension, 73 const Extension* extension,
88 const std::vector<ExtensionPage>& pages, 74 const InspectableViewsFinder::ViewList& pages,
89 const WarningService* warning_service); 75 const WarningService* warning_service);
90 76
91 void GetLocalizedValues(content::WebUIDataSource* source); 77 void GetLocalizedValues(content::WebUIDataSource* source);
92 78
93 private: 79 private:
94 friend class ExtensionUITest; 80 friend class ExtensionUITest;
95 friend class BrokerDelegate; 81 friend class BrokerDelegate;
96 82
97 // content::WebContentsObserver implementation. 83 // content::WebContentsObserver implementation.
98 void RenderViewDeleted(content::RenderViewHost* render_view_host) override; 84 void RenderViewDeleted(content::RenderViewHost* render_view_host) override;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Utility for callbacks that get an extension ID as the sole argument. 179 // Utility for callbacks that get an extension ID as the sole argument.
194 // Returns NULL if the extension isn't active. 180 // Returns NULL if the extension isn't active.
195 const Extension* GetActiveExtension(const base::ListValue* args); 181 const Extension* GetActiveExtension(const base::ListValue* args);
196 182
197 // Forces a UI update if appropriate after a notification is received. 183 // Forces a UI update if appropriate after a notification is received.
198 void MaybeUpdateAfterNotification(); 184 void MaybeUpdateAfterNotification();
199 185
200 // Register for notifications that we need to reload the page. 186 // Register for notifications that we need to reload the page.
201 void MaybeRegisterForNotifications(); 187 void MaybeRegisterForNotifications();
202 188
203 // Helper that lists the current inspectable html pages for an extension.
204 std::vector<ExtensionPage> GetInspectablePagesForExtension(
205 const Extension* extension, bool extension_is_enabled);
206 void GetInspectablePagesForExtensionProcess(
207 const Extension* extension,
208 const std::set<content::RenderViewHost*>& views,
209 std::vector<ExtensionPage>* result);
210 void GetAppWindowPagesForExtensionProfile(const Extension* extension,
211 Profile* profile,
212 std::vector<ExtensionPage>* result);
213
214 // Called when the reinstallation is complete. 189 // Called when the reinstallation is complete.
215 void OnReinstallComplete(bool success, 190 void OnReinstallComplete(bool success,
216 const std::string& error, 191 const std::string& error,
217 webstore_install::Result result); 192 webstore_install::Result result);
218 193
219 // Handles the load retry notification sent from 194 // Handles the load retry notification sent from
220 // ExtensionService::ReportExtensionLoadError. Attempts to retry loading 195 // ExtensionService::ReportExtensionLoadError. Attempts to retry loading
221 // extension from |path| if retry is true, otherwise removes |path| from the 196 // extension from |path| if retry is true, otherwise removes |path| from the
222 // vector of currently loading extensions. 197 // vector of currently loading extensions.
223 // 198 //
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off 255 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off
281 // a verification check to try and rescue them. 256 // a verification check to try and rescue them.
282 bool should_do_verification_check_; 257 bool should_do_verification_check_;
283 258
284 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); 259 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler);
285 }; 260 };
286 261
287 } // namespace extensions 262 } // namespace extensions
288 263
289 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ 264 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698