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