Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_page_handler.cc

Issue 11689004: Move PromoResourceService from Profile to BrowserProcessImpl/local_state(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android x 4 Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" 5 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 base::Bind(&NewTabPageHandler::HandlePageSelected, 72 base::Bind(&NewTabPageHandler::HandlePageSelected,
73 base::Unretained(this))); 73 base::Unretained(this)));
74 web_ui()->RegisterMessageCallback("logTimeToClick", 74 web_ui()->RegisterMessageCallback("logTimeToClick",
75 base::Bind(&NewTabPageHandler::HandleLogTimeToClick, 75 base::Bind(&NewTabPageHandler::HandleLogTimeToClick,
76 base::Unretained(this))); 76 base::Unretained(this)));
77 } 77 }
78 78
79 void NewTabPageHandler::HandleNotificationPromoClosed(const ListValue* args) { 79 void NewTabPageHandler::HandleNotificationPromoClosed(const ListValue* args) {
80 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Notification", 80 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Notification",
81 PROMO_CLOSED, PROMO_ACTION_MAX); 81 PROMO_CLOSED, PROMO_ACTION_MAX);
82 NotificationPromo::HandleClosed(Profile::FromWebUI(web_ui()), 82 NotificationPromo::HandleClosed(g_browser_process->local_state(),
83 NotificationPromo::NTP_NOTIFICATION_PROMO); 83 NotificationPromo::NTP_NOTIFICATION_PROMO);
84 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED); 84 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED);
85 } 85 }
86 86
87 void NewTabPageHandler::HandleNotificationPromoViewed(const ListValue* args) { 87 void NewTabPageHandler::HandleNotificationPromoViewed(const ListValue* args) {
88 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Notification", 88 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Notification",
89 PROMO_VIEWED, PROMO_ACTION_MAX); 89 PROMO_VIEWED, PROMO_ACTION_MAX);
90 if (NotificationPromo::HandleViewed(Profile::FromWebUI(web_ui()), 90 if (NotificationPromo::HandleViewed(g_browser_process->local_state(),
91 NotificationPromo::NTP_NOTIFICATION_PROMO)) { 91 NotificationPromo::NTP_NOTIFICATION_PROMO)) {
92 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED); 92 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED);
93 } 93 }
94 } 94 }
95 95
96 void NewTabPageHandler::HandleNotificationPromoLinkClicked( 96 void NewTabPageHandler::HandleNotificationPromoLinkClicked(
97 const ListValue* args) { 97 const ListValue* args) {
98 DVLOG(1) << "HandleNotificationPromoLinkClicked"; 98 DVLOG(1) << "HandleNotificationPromoLinkClicked";
99 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Notification", 99 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Notification",
100 PROMO_LINK_CLICKED, PROMO_ACTION_MAX); 100 PROMO_LINK_CLICKED, PROMO_ACTION_MAX);
101 } 101 }
102 102
103 void NewTabPageHandler::HandleBubblePromoClosed(const ListValue* args) { 103 void NewTabPageHandler::HandleBubblePromoClosed(const ListValue* args) {
104 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Bubble", 104 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Bubble",
105 PROMO_CLOSED, PROMO_ACTION_MAX); 105 PROMO_CLOSED, PROMO_ACTION_MAX);
106 NotificationPromo::HandleClosed(Profile::FromWebUI(web_ui()), 106 NotificationPromo::HandleClosed(g_browser_process->local_state(),
107 NotificationPromo::NTP_BUBBLE_PROMO); 107 NotificationPromo::NTP_BUBBLE_PROMO);
108 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED); 108 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED);
109 } 109 }
110 110
111 void NewTabPageHandler::HandleBubblePromoViewed(const ListValue* args) { 111 void NewTabPageHandler::HandleBubblePromoViewed(const ListValue* args) {
112 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Bubble", 112 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Bubble",
113 PROMO_VIEWED, PROMO_ACTION_MAX); 113 PROMO_VIEWED, PROMO_ACTION_MAX);
114 if (NotificationPromo::HandleViewed(Profile::FromWebUI(web_ui()), 114 if (NotificationPromo::HandleViewed(g_browser_process->local_state(),
115 NotificationPromo::NTP_BUBBLE_PROMO)) { 115 NotificationPromo::NTP_BUBBLE_PROMO)) {
116 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED); 116 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED);
117 } 117 }
118 } 118 }
119 119
120 void NewTabPageHandler::HandleBubblePromoLinkClicked(const ListValue* args) { 120 void NewTabPageHandler::HandleBubblePromoLinkClicked(const ListValue* args) {
121 DVLOG(1) << "HandleBubblePromoLinkClicked"; 121 DVLOG(1) << "HandleBubblePromoLinkClicked";
122 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Bubble", 122 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Promo.Bubble",
123 PROMO_LINK_CLICKED, PROMO_ACTION_MAX); 123 PROMO_LINK_CLICKED, PROMO_ACTION_MAX);
124 } 124 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); 196 values->SetInteger("shown_page_index", shown_page & INDEX_MASK);
197 } 197 }
198 198
199 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { 199 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) {
200 content::NotificationService* service = 200 content::NotificationService* service =
201 content::NotificationService::current(); 201 content::NotificationService::current();
202 service->Notify(notification_type, 202 service->Notify(notification_type,
203 content::Source<NewTabPageHandler>(this), 203 content::Source<NewTabPageHandler>(this),
204 content::NotificationService::NoDetails()); 204 content::NotificationService::NoDetails());
205 } 205 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698