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

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

Issue 10908119: Replace chrome::NOTIFICATION_EXTENSION_WARNING_CHANGED message with observer pattern Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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 "chrome/browser/api/prefs/pref_change_registrar.h" 13 #include "chrome/browser/api/prefs/pref_change_registrar.h"
14 #include "chrome/browser/extensions/extension_install_ui.h" 14 #include "chrome/browser/extensions/extension_install_ui.h"
15 #include "chrome/browser/extensions/extension_uninstall_dialog.h" 15 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
16 #include "chrome/browser/extensions/extension_warning_set.h"
16 #include "chrome/common/extensions/extension_resource.h" 17 #include "chrome/common/extensions/extension_resource.h"
17 #include "content/public/browser/navigation_controller.h" 18 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
20 #include "content/public/browser/render_view_host.h" 21 #include "content/public/browser/render_view_host.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 "googleurl/src/gurl.h" 24 #include "googleurl/src/gurl.h"
24 #include "ui/base/dialogs/select_file_dialog.h" 25 #include "ui/base/dialogs/select_file_dialog.h"
25 26
26 class ExtensionService; 27 class ExtensionService;
27 class FilePath; 28 class FilePath;
28 class PrefService; 29 class PrefService;
29 30
30 namespace base { 31 namespace base {
31 class DictionaryValue; 32 class DictionaryValue;
32 class ListValue; 33 class ListValue;
33 } 34 }
34 35
35 namespace extensions { 36 namespace extensions {
36 class Extension; 37 class Extension;
37 class ExtensionHost; 38 class ExtensionHost;
38 class ExtensionWarningService;
39 class ManagementPolicy; 39 class ManagementPolicy;
40 } 40 }
41 41
42 // Information about a page running in an extension, for example a popup bubble, 42 // Information about a page running in an extension, for example a popup bubble,
43 // a background page, or a tab contents. 43 // a background page, or a tab contents.
44 struct ExtensionPage { 44 struct ExtensionPage {
45 ExtensionPage(const GURL& url, int render_process_id, int render_view_id, 45 ExtensionPage(const GURL& url, int render_process_id, int render_view_id,
46 bool incognito) 46 bool incognito)
47 : url(url), 47 : url(url),
48 render_process_id(render_process_id), 48 render_process_id(render_process_id),
49 render_view_id(render_view_id), 49 render_view_id(render_view_id),
50 incognito(incognito) {} 50 incognito(incognito) {}
51 GURL url; 51 GURL url;
52 int render_process_id; 52 int render_process_id;
53 int render_view_id; 53 int render_view_id;
54 bool incognito; 54 bool incognito;
55 }; 55 };
56 56
57 // Extension Settings UI handler. 57 // Extension Settings UI handler.
58 class ExtensionSettingsHandler : public content::WebUIMessageHandler, 58 class ExtensionSettingsHandler
59 public content::NotificationObserver, 59 : public content::WebUIMessageHandler,
60 public content::WebContentsObserver, 60 public content::NotificationObserver,
61 public ui::SelectFileDialog::Listener, 61 public content::WebContentsObserver,
62 public ExtensionUninstallDialog::Delegate { 62 public ui::SelectFileDialog::Listener,
63 public ExtensionUninstallDialog::Delegate,
64 public extensions::ExtensionWarningService::Observer {
63 public: 65 public:
64 ExtensionSettingsHandler(); 66 ExtensionSettingsHandler();
65 virtual ~ExtensionSettingsHandler(); 67 virtual ~ExtensionSettingsHandler();
66 68
67 static void RegisterUserPrefs(PrefService* prefs); 69 static void RegisterUserPrefs(PrefService* prefs);
68 70
69 // Extension Detail JSON Struct for page. |pages| is injected for unit 71 // Extension Detail JSON Struct for page. |pages| is injected for unit
70 // testing. 72 // testing.
71 // Note: |warning_set| can be NULL in unit tests. 73 // Note: |warning_set| can be NULL in unit tests.
72 base::DictionaryValue* CreateExtensionDetailValue( 74 base::DictionaryValue* CreateExtensionDetailValue(
(...skipping 29 matching lines...) Expand all
102 // content::NotificationObserver implementation. 104 // content::NotificationObserver implementation.
103 virtual void Observe(int type, 105 virtual void Observe(int type,
104 const content::NotificationSource& source, 106 const content::NotificationSource& source,
105 const content::NotificationDetails& details) OVERRIDE; 107 const content::NotificationDetails& details) OVERRIDE;
106 108
107 // ExtensionUninstallDialog::Delegate implementation, used for receiving 109 // ExtensionUninstallDialog::Delegate implementation, used for receiving
108 // notification about uninstall confirmation dialog selections. 110 // notification about uninstall confirmation dialog selections.
109 virtual void ExtensionUninstallAccepted() OVERRIDE; 111 virtual void ExtensionUninstallAccepted() OVERRIDE;
110 virtual void ExtensionUninstallCanceled() OVERRIDE; 112 virtual void ExtensionUninstallCanceled() OVERRIDE;
111 113
114 // extensions::ExtensionWarningService::Observer implementation.
115 virtual void ExtensionWarningsChanged() OVERRIDE;
116
112 // Helper method that reloads all unpacked extensions. 117 // Helper method that reloads all unpacked extensions.
113 void ReloadUnpackedExtensions(); 118 void ReloadUnpackedExtensions();
114 119
115 // Callback for "requestExtensionsData" message. 120 // Callback for "requestExtensionsData" message.
116 void HandleRequestExtensionsData(const base::ListValue* args); 121 void HandleRequestExtensionsData(const base::ListValue* args);
117 122
118 // Callback for "toggleDeveloperMode" message. 123 // Callback for "toggleDeveloperMode" message.
119 void HandleToggleDeveloperMode(const base::ListValue* args); 124 void HandleToggleDeveloperMode(const base::ListValue* args);
120 125
121 // Callback for "inspect" message. 126 // Callback for "inspect" message.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 219
215 content::NotificationRegistrar registrar_; 220 content::NotificationRegistrar registrar_;
216 221
217 PrefChangeRegistrar pref_registrar_; 222 PrefChangeRegistrar pref_registrar_;
218 PrefChangeRegistrar local_state_pref_registrar_; 223 PrefChangeRegistrar local_state_pref_registrar_;
219 224
220 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); 225 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler);
221 }; 226 };
222 227
223 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ 228 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_warning_set.cc ('k') | chrome/browser/ui/webui/extensions/extension_settings_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698