| 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/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 // Callback for "bubblePromoViewed". No arguments. | 52 // Callback for "bubblePromoViewed". No arguments. |
| 53 void HandleBubblePromoViewed(const base::ListValue* args); | 53 void HandleBubblePromoViewed(const base::ListValue* args); |
| 54 | 54 |
| 55 // Callback for "bubblePromoLinkClicked". No arguments. | 55 // Callback for "bubblePromoLinkClicked". No arguments. |
| 56 void HandleBubblePromoLinkClicked(const base::ListValue* args); | 56 void HandleBubblePromoLinkClicked(const base::ListValue* args); |
| 57 | 57 |
| 58 // Callback for "pageSelected". | 58 // Callback for "pageSelected". |
| 59 void HandlePageSelected(const base::ListValue* args); | 59 void HandlePageSelected(const base::ListValue* args); |
| 60 | 60 |
| 61 // Callback for "logTimeToClick". | |
| 62 void HandleLogTimeToClick(const base::ListValue* args); | |
| 63 | |
| 64 // Tracks the number of times the user has switches pages (for UMA). | 61 // Tracks the number of times the user has switches pages (for UMA). |
| 65 size_t page_switch_count_; | 62 size_t page_switch_count_; |
| 66 | 63 |
| 67 // The purpose of this enum is to track which page on the NTP is showing. | 64 // The purpose of this enum is to track which page on the NTP is showing. |
| 68 // The lower 10 bits of kNtpShownPage are used for the index within the page | 65 // The lower 10 bits of kNtpShownPage are used for the index within the page |
| 69 // group, and the rest of the bits are used for the page group ID (defined | 66 // group, and the rest of the bits are used for the page group ID (defined |
| 70 // here). | 67 // here). |
| 71 static const int kPageIdOffset = 10; | 68 static const int kPageIdOffset = 10; |
| 72 enum { | 69 enum { |
| 73 INDEX_MASK = (1 << kPageIdOffset) - 1, | 70 INDEX_MASK = (1 << kPageIdOffset) - 1, |
| 74 MOST_VISITED_PAGE_ID = 1 << kPageIdOffset, | |
| 75 APPS_PAGE_ID = 2 << kPageIdOffset, | 71 APPS_PAGE_ID = 2 << kPageIdOffset, |
| 76 LAST_PAGE_ID = APPS_PAGE_ID, | 72 LAST_PAGE_ID = APPS_PAGE_ID, |
| 77 }; | 73 }; |
| 78 static const int kHistogramEnumerationMax = | 74 static const int kHistogramEnumerationMax = |
| 79 (LAST_PAGE_ID >> kPageIdOffset) + 1; | 75 (LAST_PAGE_ID >> kPageIdOffset) + 1; |
| 80 | 76 |
| 81 // Helper to send out promo resource change notification. | 77 // Helper to send out promo resource change notification. |
| 82 void Notify(chrome::NotificationType notification_type); | 78 void Notify(chrome::NotificationType notification_type); |
| 83 | 79 |
| 84 DISALLOW_COPY_AND_ASSIGN(NewTabPageHandler); | 80 DISALLOW_COPY_AND_ASSIGN(NewTabPageHandler); |
| 85 }; | 81 }; |
| 86 | 82 |
| 87 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ | 83 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ |
| OLD | NEW |