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 #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/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 static bool default_apps_trial_exists = | 51 static bool default_apps_trial_exists = |
52 base::FieldTrialList::TrialExists(kDefaultAppsTrialName); | 52 base::FieldTrialList::TrialExists(kDefaultAppsTrialName); |
53 if (default_apps_trial_exists) { | 53 if (default_apps_trial_exists) { |
54 UMA_HISTOGRAM_ENUMERATION( | 54 UMA_HISTOGRAM_ENUMERATION( |
55 base::FieldTrial::MakeName(kDefaultPageTypeHistogram, | 55 base::FieldTrial::MakeName(kDefaultPageTypeHistogram, |
56 kDefaultAppsTrialName), | 56 kDefaultAppsTrialName), |
57 shown_page_type, kHistogramEnumerationMax); | 57 shown_page_type, kHistogramEnumerationMax); |
58 } | 58 } |
59 | 59 |
60 static const bool webstore_link_experiment_exists = | |
61 base::FieldTrialList::TrialExists(kWebStoreLinkExperiment); | |
62 if (webstore_link_experiment_exists) { | |
63 UMA_HISTOGRAM_ENUMERATION( | |
64 base::FieldTrial::MakeName(kDefaultPageTypeHistogram, | |
65 kWebStoreLinkExperiment), | |
66 shown_page_type, kHistogramEnumerationMax); | |
67 } | |
68 | |
69 web_ui()->RegisterMessageCallback("closeNotificationPromo", | 60 web_ui()->RegisterMessageCallback("closeNotificationPromo", |
70 base::Bind(&NewTabPageHandler::HandleCloseNotificationPromo, | 61 base::Bind(&NewTabPageHandler::HandleCloseNotificationPromo, |
71 base::Unretained(this))); | 62 base::Unretained(this))); |
72 web_ui()->RegisterMessageCallback("notificationPromoViewed", | 63 web_ui()->RegisterMessageCallback("notificationPromoViewed", |
73 base::Bind(&NewTabPageHandler::HandleNotificationPromoViewed, | 64 base::Bind(&NewTabPageHandler::HandleNotificationPromoViewed, |
74 base::Unretained(this))); | 65 base::Unretained(this))); |
75 web_ui()->RegisterMessageCallback("pageSelected", | 66 web_ui()->RegisterMessageCallback("pageSelected", |
76 base::Bind(&NewTabPageHandler::HandlePageSelected, | 67 base::Bind(&NewTabPageHandler::HandlePageSelected, |
77 base::Unretained(this))); | 68 base::Unretained(this))); |
78 web_ui()->RegisterMessageCallback("introMessageDismissed", | 69 web_ui()->RegisterMessageCallback("introMessageDismissed", |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // is only called during startup before the ntp resource cache is constructed. | 188 // is only called during startup before the ntp resource cache is constructed. |
198 } | 189 } |
199 | 190 |
200 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { | 191 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { |
201 content::NotificationService* service = | 192 content::NotificationService* service = |
202 content::NotificationService::current(); | 193 content::NotificationService::current(); |
203 service->Notify(notification_type, | 194 service->Notify(notification_type, |
204 content::Source<NewTabPageHandler>(this), | 195 content::Source<NewTabPageHandler>(this), |
205 content::NotificationService::NoDetails()); | 196 content::NotificationService::NoDetails()); |
206 } | 197 } |
OLD | NEW |