| 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/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 PROMO_LINK_CLICKED, | 28 PROMO_LINK_CLICKED, |
| 29 PROMO_ACTION_MAX, | 29 PROMO_ACTION_MAX, |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 NewTabPageHandler::NewTabPageHandler() : page_switch_count_(0) { | 34 NewTabPageHandler::NewTabPageHandler() : page_switch_count_(0) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 NewTabPageHandler::~NewTabPageHandler() { | 37 NewTabPageHandler::~NewTabPageHandler() { |
| 38 HISTOGRAM_COUNTS_100("NewTabPage.SingleSessionPageSwitches", | 38 LOCAL_HISTOGRAM_COUNTS_100("NewTabPage.SingleSessionPageSwitches", |
| 39 page_switch_count_); | 39 page_switch_count_); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void NewTabPageHandler::RegisterMessages() { | 42 void NewTabPageHandler::RegisterMessages() { |
| 43 // Record an open of the NTP with its default page type. | 43 // Record an open of the NTP with its default page type. |
| 44 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 44 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 45 int shown_page_type = prefs->GetInteger(prefs::kNtpShownPage) >> | 45 int shown_page_type = prefs->GetInteger(prefs::kNtpShownPage) >> |
| 46 kPageIdOffset; | 46 kPageIdOffset; |
| 47 UMA_HISTOGRAM_ENUMERATION(kDefaultPageTypeHistogram, | 47 UMA_HISTOGRAM_ENUMERATION(kDefaultPageTypeHistogram, |
| 48 shown_page_type, kHistogramEnumerationMax); | 48 shown_page_type, kHistogramEnumerationMax); |
| 49 | 49 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); | 191 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { | 194 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { |
| 195 content::NotificationService* service = | 195 content::NotificationService* service = |
| 196 content::NotificationService::current(); | 196 content::NotificationService::current(); |
| 197 service->Notify(notification_type, | 197 service->Notify(notification_type, |
| 198 content::Source<NewTabPageHandler>(this), | 198 content::Source<NewTabPageHandler>(this), |
| 199 content::NotificationService::NoDetails()); | 199 content::NotificationService::NoDetails()); |
| 200 } | 200 } |
| OLD | NEW |