| 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; | 14 class Profile; |
| 15 | 15 |
| 16 namespace user_prefs { | 16 namespace user_prefs { |
| 17 class PrefRegistrySyncable; | 17 class PrefRegistrySyncable; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // 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 |
| 21 // more specialized handler. | 21 // more specialized handler. |
| 22 class NewTabPageHandler : public content::WebUIMessageHandler, | 22 class NewTabPageHandler : public content::WebUIMessageHandler, |
| 23 public base::SupportsWeakPtr<NewTabPageHandler> { | 23 public base::SupportsWeakPtr<NewTabPageHandler> { |
| 24 public: | 24 public: |
| 25 NewTabPageHandler(); | 25 NewTabPageHandler(); |
| 26 | 26 |
| 27 // Register NTP per-profile preferences. | 27 // Register NTP per-profile preferences. |
| 28 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); | 28 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 29 | 29 |
| 30 // Registers values (strings etc.) for the page. | 30 // Registers values (strings etc.) for the page. |
| 31 static void GetLocalizedValues(Profile* profile, DictionaryValue* values); | 31 static void GetLocalizedValues(Profile* profile, DictionaryValue* values); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 virtual ~NewTabPageHandler(); | 34 virtual ~NewTabPageHandler(); |
| 35 | 35 |
| 36 // WebUIMessageHandler implementation. | 36 // WebUIMessageHandler implementation. |
| 37 virtual void RegisterMessages() OVERRIDE; | 37 virtual void RegisterMessages() OVERRIDE; |
| 38 | 38 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 static const int kHistogramEnumerationMax = | 79 static const int kHistogramEnumerationMax = |
| 80 (LAST_PAGE_ID >> kPageIdOffset) + 1; | 80 (LAST_PAGE_ID >> kPageIdOffset) + 1; |
| 81 | 81 |
| 82 // Helper to send out promo resource change notification. | 82 // Helper to send out promo resource change notification. |
| 83 void Notify(chrome::NotificationType notification_type); | 83 void Notify(chrome::NotificationType notification_type); |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(NewTabPageHandler); | 85 DISALLOW_COPY_AND_ASSIGN(NewTabPageHandler); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 #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 |