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_NTP_ANDROID_PROMO_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_PROMO_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_PROMO_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_PROMO_HANDLER_H_ |
7 | 7 |
8 #include "content/public/browser/notification_observer.h" | 8 #include "content/public/browser/notification_observer.h" |
9 #include "content/public/browser/notification_registrar.h" | 9 #include "content/public/browser/notification_registrar.h" |
10 #include "content/public/browser/web_ui_message_handler.h" | 10 #include "content/public/browser/web_ui_message_handler.h" |
11 | 11 |
12 class PrefService; | 12 class PrefServiceSyncable; |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class DictionaryValue; | 15 class DictionaryValue; |
16 class ListValue; | 16 class ListValue; |
17 } | 17 } |
18 | 18 |
19 // The handler for JavaScript messages related to the Android NTP promo. | 19 // The handler for JavaScript messages related to the Android NTP promo. |
20 class PromoHandler : public content::WebUIMessageHandler, | 20 class PromoHandler : public content::WebUIMessageHandler, |
21 public content::NotificationObserver { | 21 public content::NotificationObserver { |
22 public: | 22 public: |
23 PromoHandler(); | 23 PromoHandler(); |
24 virtual ~PromoHandler(); | 24 virtual ~PromoHandler(); |
25 | 25 |
26 // WebUIMessageHandler implementation. | 26 // WebUIMessageHandler implementation. |
27 virtual void RegisterMessages() OVERRIDE; | 27 virtual void RegisterMessages() OVERRIDE; |
28 | 28 |
29 // Register preferences. | 29 // Register preferences. |
30 static void RegisterUserPrefs(PrefService* prefs); | 30 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
31 | 31 |
32 private: | 32 private: |
33 // NotificationObserver override and implementation. | 33 // NotificationObserver override and implementation. |
34 virtual void Observe(int type, | 34 virtual void Observe(int type, |
35 const content::NotificationSource& source, | 35 const content::NotificationSource& source, |
36 const content::NotificationDetails& details) OVERRIDE; | 36 const content::NotificationDetails& details) OVERRIDE; |
37 | 37 |
38 // Callback for the "promoSendEmail" message. | 38 // Callback for the "promoSendEmail" message. |
39 // |args| is a list [ subject, body, app-chooser-message ]. | 39 // |args| is a list [ subject, body, app-chooser-message ]. |
40 void HandlePromoSendEmail(const base::ListValue* args); | 40 void HandlePromoSendEmail(const base::ListValue* args); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Updates the profile preference if any desktop session was discovered. | 73 // Updates the profile preference if any desktop session was discovered. |
74 void CheckDesktopSessions(); | 74 void CheckDesktopSessions(); |
75 | 75 |
76 // Registrar to receive notification on promo changes. | 76 // Registrar to receive notification on promo changes. |
77 content::NotificationRegistrar registrar_; | 77 content::NotificationRegistrar registrar_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(PromoHandler); | 79 DISALLOW_COPY_AND_ASSIGN(PromoHandler); |
80 }; | 80 }; |
81 | 81 |
82 #endif // CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_PROMO_HANDLER_H_ | 82 #endif // CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_PROMO_HANDLER_H_ |
OLD | NEW |