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_NEW_TAB_PAGE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
11 #include "content/public/browser/web_ui_message_handler.h" | 11 #include "content/public/browser/web_ui_message_handler.h" |
12 | 12 |
13 class PrefRegistrySimple; | 13 class PrefRegistrySimple; |
| 14 class Profile; |
| 15 |
| 16 namespace user_prefs { |
14 class PrefRegistrySyncable; | 17 class PrefRegistrySyncable; |
15 class Profile; | 18 } |
16 | 19 |
17 // Handler for general New Tab Page functionality that does not belong in a | 20 // Handler for general New Tab Page functionality that does not belong in a |
18 // more specialized handler. | 21 // more specialized handler. |
19 class NewTabPageHandler : public content::WebUIMessageHandler, | 22 class NewTabPageHandler : public content::WebUIMessageHandler, |
20 public base::SupportsWeakPtr<NewTabPageHandler> { | 23 public base::SupportsWeakPtr<NewTabPageHandler> { |
21 public: | 24 public: |
22 NewTabPageHandler(); | 25 NewTabPageHandler(); |
23 | 26 |
24 // Register NTP per-profile preferences. | 27 // Register NTP per-profile preferences. |
25 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 28 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
26 | 29 |
27 // Registers values (strings etc.) for the page. | 30 // Registers values (strings etc.) for the page. |
28 static void GetLocalizedValues(Profile* profile, DictionaryValue* values); | 31 static void GetLocalizedValues(Profile* profile, DictionaryValue* values); |
29 | 32 |
30 private: | 33 private: |
31 virtual ~NewTabPageHandler(); | 34 virtual ~NewTabPageHandler(); |
32 | 35 |
33 // WebUIMessageHandler implementation. | 36 // WebUIMessageHandler implementation. |
34 virtual void RegisterMessages() OVERRIDE; | 37 virtual void RegisterMessages() OVERRIDE; |
35 | 38 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 static const int kHistogramEnumerationMax = | 79 static const int kHistogramEnumerationMax = |
77 (LAST_PAGE_ID >> kPageIdOffset) + 1; | 80 (LAST_PAGE_ID >> kPageIdOffset) + 1; |
78 | 81 |
79 // Helper to send out promo resource change notification. | 82 // Helper to send out promo resource change notification. |
80 void Notify(chrome::NotificationType notification_type); | 83 void Notify(chrome::NotificationType notification_type); |
81 | 84 |
82 DISALLOW_COPY_AND_ASSIGN(NewTabPageHandler); | 85 DISALLOW_COPY_AND_ASSIGN(NewTabPageHandler); |
83 }; | 86 }; |
84 | 87 |
85 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ | 88 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ |
OLD | NEW |