| 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( | 173 void NewTabPageHandler::RegisterProfilePrefs( |
| 174 user_prefs::PrefRegistrySyncable* registry) { | 174 user_prefs::PrefRegistrySyncable* registry) { |
| 175 // TODO(estade): should be syncable. | 175 // TODO(estade): should be syncable. |
| 176 registry->RegisterIntegerPref( | 176 registry->RegisterIntegerPref( |
| 177 prefs::kNtpShownPage, | 177 prefs::kNtpShownPage, |
| 178 APPS_PAGE_ID, | 178 APPS_PAGE_ID, |
| 179 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 179 user_prefs::PrefRegistrySyncable::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 | 188 |
| 189 PrefService* prefs = profile->GetPrefs(); | 189 PrefService* prefs = profile->GetPrefs(); |
| 190 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); | 190 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); |
| 191 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); | 191 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); |
| 192 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); | 192 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { | 195 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { |
| 196 content::NotificationService* service = | 196 content::NotificationService* service = |
| 197 content::NotificationService::current(); | 197 content::NotificationService::current(); |
| 198 service->Notify(notification_type, | 198 service->Notify(notification_type, |
| 199 content::Source<NewTabPageHandler>(this), | 199 content::Source<NewTabPageHandler>(this), |
| 200 content::NotificationService::NoDetails()); | 200 content::NotificationService::NoDetails()); |
| 201 } | 201 } |
| OLD | NEW |