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

Side by Side Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.h

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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_NTP_APP_LAUNCHER_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_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"
11 #include "base/prefs/public/pref_change_registrar.h" 11 #include "base/prefs/public/pref_change_registrar.h"
12 #include "base/prefs/public/pref_observer.h"
12 #include "chrome/browser/common/cancelable_request.h" 13 #include "chrome/browser/common/cancelable_request.h"
13 #include "chrome/browser/extensions/extension_install_prompt.h" 14 #include "chrome/browser/extensions/extension_install_prompt.h"
14 #include "chrome/browser/extensions/extension_uninstall_dialog.h" 15 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
15 #include "chrome/browser/favicon/favicon_service.h" 16 #include "chrome/browser/favicon/favicon_service.h"
16 #include "chrome/common/extensions/extension.h" 17 #include "chrome/common/extensions/extension.h"
17 #include "chrome/common/extensions/extension_constants.h" 18 #include "chrome/common/extensions/extension_constants.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/web_ui_message_handler.h" 21 #include "content/public/browser/web_ui_message_handler.h"
21 #include "sync/api/string_ordinal.h" 22 #include "sync/api/string_ordinal.h"
22 23
23 class ExtensionService; 24 class ExtensionService;
24 class PrefChangeRegistrar; 25 class PrefChangeRegistrar;
25 class Profile; 26 class Profile;
26 27
27 namespace extensions { 28 namespace extensions {
28 class AppNotification; 29 class AppNotification;
29 } 30 }
30 31
31 // The handler for Javascript messages related to the "apps" view. 32 // The handler for Javascript messages related to the "apps" view.
32 class AppLauncherHandler : public content::WebUIMessageHandler, 33 class AppLauncherHandler : public content::WebUIMessageHandler,
33 public ExtensionUninstallDialog::Delegate, 34 public ExtensionUninstallDialog::Delegate,
34 public ExtensionInstallPrompt::Delegate, 35 public ExtensionInstallPrompt::Delegate,
35 public content::NotificationObserver { 36 public content::NotificationObserver,
37 public PrefObserver {
36 public: 38 public:
37 explicit AppLauncherHandler(ExtensionService* extension_service); 39 explicit AppLauncherHandler(ExtensionService* extension_service);
38 virtual ~AppLauncherHandler(); 40 virtual ~AppLauncherHandler();
39 41
40 // Populate a dictionary with the information from an extension. 42 // Populate a dictionary with the information from an extension.
41 static void CreateAppInfo( 43 static void CreateAppInfo(
42 const extensions::Extension* extension, 44 const extensions::Extension* extension,
43 const extensions::AppNotification* notification, 45 const extensions::AppNotification* notification,
44 ExtensionService* service, 46 ExtensionService* service,
45 base::DictionaryValue* value); 47 base::DictionaryValue* value);
46 48
47 // WebUIMessageHandler implementation. 49 // WebUIMessageHandler implementation.
48 virtual void RegisterMessages() OVERRIDE; 50 virtual void RegisterMessages() OVERRIDE;
49 51
50 // content::NotificationObserver 52 // content::NotificationObserver
51 virtual void Observe(int type, 53 virtual void Observe(int type,
52 const content::NotificationSource& source, 54 const content::NotificationSource& source,
53 const content::NotificationDetails& details) OVERRIDE; 55 const content::NotificationDetails& details) OVERRIDE;
54 56
57 // PrefObserver
58 virtual void OnPreferenceChanged(PrefServiceBase* service,
59 const std::string& pref_name) OVERRIDE;
60
55 // Populate the given dictionary with all installed app info. 61 // Populate the given dictionary with all installed app info.
56 void FillAppDictionary(base::DictionaryValue* value); 62 void FillAppDictionary(base::DictionaryValue* value);
57 63
58 // Create a dictionary value for the given extension. May return NULL, e.g. if 64 // Create a dictionary value for the given extension. May return NULL, e.g. if
59 // the given extension is not an app. If non-NULL, the caller assumes 65 // the given extension is not an app. If non-NULL, the caller assumes
60 // ownership of the pointer. 66 // ownership of the pointer.
61 base::DictionaryValue* GetAppInfo(const extensions::Extension* extension); 67 base::DictionaryValue* GetAppInfo(const extensions::Extension* extension);
62 68
63 // Populate the given dictionary with the web store promo content. 69 // Populate the given dictionary with the web store promo content.
64 void FillPromoDictionary(base::DictionaryValue* value); 70 void FillPromoDictionary(base::DictionaryValue* value);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // when the app is added to the page (via getAppsCallback or appAdded). 205 // when the app is added to the page (via getAppsCallback or appAdded).
200 std::string highlight_app_id_; 206 std::string highlight_app_id_;
201 207
202 // Hold state for favicon requests. 208 // Hold state for favicon requests.
203 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_; 209 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_;
204 210
205 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); 211 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler);
206 }; 212 };
207 213
208 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ 214 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/extensions/extension_settings_handler.cc ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698