| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 "ExtendedNewTabPage.TimeToClickMostVisited", delta); | 166 "ExtendedNewTabPage.TimeToClickMostVisited", delta); |
| 167 } else if (histogram_name == "ExtendedNewTabPage.TimeToClickRecentlyClosed") { | 167 } else if (histogram_name == "ExtendedNewTabPage.TimeToClickRecentlyClosed") { |
| 168 UMA_HISTOGRAM_LONG_TIMES( | 168 UMA_HISTOGRAM_LONG_TIMES( |
| 169 "ExtendedNewTabPage.TimeToClickRecentlyClosed", delta); | 169 "ExtendedNewTabPage.TimeToClickRecentlyClosed", delta); |
| 170 } else { | 170 } else { |
| 171 NOTREACHED(); | 171 NOTREACHED(); |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 // static | 175 // static |
| 176 void NewTabPageHandler::RegisterUserPrefs(PrefService* prefs) { | 176 void NewTabPageHandler::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
| 177 // TODO(estade): should be syncable. | 177 // TODO(estade): should be syncable. |
| 178 prefs->RegisterIntegerPref(prefs::kNtpShownPage, APPS_PAGE_ID, | 178 prefs->RegisterIntegerPref(prefs::kNtpShownPage, APPS_PAGE_ID, |
| 179 PrefService::UNSYNCABLE_PREF); | 179 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 180 } | 180 } |
| 181 | 181 |
| 182 // static | 182 // static |
| 183 void NewTabPageHandler::GetLocalizedValues(Profile* profile, | 183 void NewTabPageHandler::GetLocalizedValues(Profile* profile, |
| 184 DictionaryValue* values) { | 184 DictionaryValue* values) { |
| 185 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); | 185 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); |
| 186 values->SetInteger("apps_page_id", APPS_PAGE_ID); | 186 values->SetInteger("apps_page_id", APPS_PAGE_ID); |
| 187 values->SetInteger("suggestions_page_id", SUGGESTIONS_PAGE_ID); | 187 values->SetInteger("suggestions_page_id", SUGGESTIONS_PAGE_ID); |
| 188 // TODO(jeremycho): Add this to histograms.xml (see issue 144067). | 188 // TODO(jeremycho): Add this to histograms.xml (see issue 144067). |
| 189 values->SetInteger("recently_closed_page_id", RECENTLY_CLOSED_PAGE_ID); | 189 values->SetInteger("recently_closed_page_id", RECENTLY_CLOSED_PAGE_ID); |
| 190 // TODO(vadimt): Add this to histograms.xml (see issue 148871). | 190 // TODO(vadimt): Add this to histograms.xml (see issue 148871). |
| 191 values->SetInteger("other_devices_page_id", OTHER_DEVICES_PAGE_ID); | 191 values->SetInteger("other_devices_page_id", OTHER_DEVICES_PAGE_ID); |
| 192 | 192 |
| 193 PrefService* prefs = profile->GetPrefs(); | 193 PrefService* prefs = profile->GetPrefs(); |
| 194 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); | 194 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); |
| 195 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); | 195 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); |
| 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 } |
| OLD | NEW |