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