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 "apps/app_launcher.h" | 7 #include "apps/app_launcher.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 "ExtendedNewTabPage.TimeToClickMostVisited", delta); | 163 "ExtendedNewTabPage.TimeToClickMostVisited", delta); |
164 } else if (histogram_name == "ExtendedNewTabPage.TimeToClickRecentlyClosed") { | 164 } else if (histogram_name == "ExtendedNewTabPage.TimeToClickRecentlyClosed") { |
165 UMA_HISTOGRAM_LONG_TIMES( | 165 UMA_HISTOGRAM_LONG_TIMES( |
166 "ExtendedNewTabPage.TimeToClickRecentlyClosed", delta); | 166 "ExtendedNewTabPage.TimeToClickRecentlyClosed", delta); |
167 } else { | 167 } else { |
168 NOTREACHED(); | 168 NOTREACHED(); |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 // static | 172 // static |
173 void NewTabPageHandler::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 173 void NewTabPageHandler::RegisterUserPrefs( |
| 174 user_prefs::PrefRegistrySyncable* registry) { |
174 // TODO(estade): should be syncable. | 175 // TODO(estade): should be syncable. |
175 registry->RegisterIntegerPref(prefs::kNtpShownPage, APPS_PAGE_ID, | 176 registry->RegisterIntegerPref( |
176 PrefRegistrySyncable::UNSYNCABLE_PREF); | 177 prefs::kNtpShownPage, |
| 178 APPS_PAGE_ID, |
| 179 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
177 } | 180 } |
178 | 181 |
179 // static | 182 // static |
180 void NewTabPageHandler::GetLocalizedValues(Profile* profile, | 183 void NewTabPageHandler::GetLocalizedValues(Profile* profile, |
181 DictionaryValue* values) { | 184 DictionaryValue* values) { |
182 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); | 185 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); |
183 values->SetInteger("apps_page_id", APPS_PAGE_ID); | 186 values->SetInteger("apps_page_id", APPS_PAGE_ID); |
184 values->SetInteger("suggestions_page_id", SUGGESTIONS_PAGE_ID); | 187 values->SetInteger("suggestions_page_id", SUGGESTIONS_PAGE_ID); |
185 | 188 |
186 PrefService* prefs = profile->GetPrefs(); | 189 PrefService* prefs = profile->GetPrefs(); |
187 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); | 190 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); |
188 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); | 191 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); |
189 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); | 192 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); |
190 } | 193 } |
191 | 194 |
192 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { | 195 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { |
193 content::NotificationService* service = | 196 content::NotificationService* service = |
194 content::NotificationService::current(); | 197 content::NotificationService::current(); |
195 service->Notify(notification_type, | 198 service->Notify(notification_type, |
196 content::Source<NewTabPageHandler>(this), | 199 content::Source<NewTabPageHandler>(this), |
197 content::NotificationService::NoDetails()); | 200 content::NotificationService::NoDetails()); |
198 } | 201 } |
OLD | NEW |