Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/values.h" | 8 #include "base/values.h" |
| 9 #include "content/browser/webui/web_ui.h" | 9 #include "content/browser/webui/web_ui.h" |
| 10 | 10 |
| 11 class PrefService; | 11 class PrefService; |
| 12 class Profile; | 12 class Profile; |
| 13 | 13 |
| 14 // Handler for general New Tab Page functionality that does not belong in a | 14 // Handler for general New Tab Page functionality that does not belong in a |
| 15 // more specialized handler. | 15 // more specialized handler. |
| 16 class NewTabPageHandler : public WebUIMessageHandler { | 16 class NewTabPageHandler : public WebUIMessageHandler { |
| 17 public: | 17 public: |
| 18 NewTabPageHandler() {} | 18 NewTabPageHandler() {} |
| 19 virtual ~NewTabPageHandler() {} | 19 virtual ~NewTabPageHandler() {} |
| 20 | 20 |
| 21 // WebUIMessageHandler implementation. | 21 // WebUIMessageHandler implementation. |
| 22 virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE; | |
| 22 virtual void RegisterMessages() OVERRIDE; | 23 virtual void RegisterMessages() OVERRIDE; |
| 23 | 24 |
| 24 // Callback for "closeNotificationPromo". | 25 // Callback for "closeNotificationPromo". |
| 25 void HandleCloseNotificationPromo(const ListValue* args); | 26 void HandleCloseNotificationPromo(const ListValue* args); |
| 26 | 27 |
| 27 // Callback for "notificationPromoViewed". | 28 // Callback for "notificationPromoViewed". |
| 28 void HandleNotificationPromoViewed(const ListValue* args); | 29 void HandleNotificationPromoViewed(const ListValue* args); |
| 29 | 30 |
| 30 // Callback for "pageSelected". | 31 // Callback for "pageSelected". |
| 31 void HandlePageSelected(const ListValue* args); | 32 void HandlePageSelected(const ListValue* args); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 46 | 47 |
| 47 // Permanently dismiss the ntp4 bubble for new users. | 48 // Permanently dismiss the ntp4 bubble for new users. |
| 48 static void DismissIntroMessage(PrefService* prefs); | 49 static void DismissIntroMessage(PrefService* prefs); |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 // The purpose of this enum is to track which page on the NTP is showing. | 52 // The purpose of this enum is to track which page on the NTP is showing. |
| 52 // The lower 10 bits of kNTPShownPage are used for the index within the page | 53 // The lower 10 bits of kNTPShownPage are used for the index within the page |
| 53 // group, and the rest of the bits are used for the page group ID (defined | 54 // group, and the rest of the bits are used for the page group ID (defined |
| 54 // here). | 55 // here). |
| 55 enum { | 56 enum { |
| 56 INDEX_MASK = (1 << 10) - 1, | 57 PAGE_ID_OFFSET = 10, |
|
Evan Stade
2011/10/13 00:07:51
do not add this as an enum value, it doesn't make
Roger Tawa OOO till Jul 10th
2011/10/13 00:39:43
Done.
| |
| 57 MOST_VISITED_PAGE_ID = 1 << 10, | 58 INDEX_MASK = (1 << PAGE_ID_OFFSET) - 1, |
| 58 APPS_PAGE_ID = 2 << 10, | 59 MOST_VISITED_PAGE_ID = 1 << PAGE_ID_OFFSET, |
| 59 BOOKMARKS_PAGE_ID = 3 << 10, | 60 APPS_PAGE_ID = 2 << PAGE_ID_OFFSET, |
| 61 BOOKMARKS_PAGE_ID = 3 << PAGE_ID_OFFSET, | |
|
Evan Stade
2011/10/13 00:07:51
LAST_PAGE_ID = BOOKMARKS_PAGE_ID
Roger Tawa OOO till Jul 10th
2011/10/13 00:39:43
Done.
jar (doing other things)
2011/10/13 22:16:53
This looks like you're going for a histogram with
jar (doing other things)
2011/10/13 22:22:07
I retract my comment. Sorry about that.... the hi
| |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 // Helper to send out promo resource change notification. | 64 // Helper to send out promo resource change notification. |
| 63 void NotifyPromoResourceChanged(); | 65 void NotifyPromoResourceChanged(); |
| 64 | 66 |
| 65 DISALLOW_COPY_AND_ASSIGN(NewTabPageHandler); | 67 DISALLOW_COPY_AND_ASSIGN(NewTabPageHandler); |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ | 70 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ |
| OLD | NEW |