| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 user_prefs::PrefRegistrySyncable* registry) { | 168 user_prefs::PrefRegistrySyncable* registry) { |
| 169 // TODO(estade): should be syncable. | 169 // TODO(estade): should be syncable. |
| 170 registry->RegisterIntegerPref(prefs::kNtpShownPage, APPS_PAGE_ID); | 170 registry->RegisterIntegerPref(prefs::kNtpShownPage, APPS_PAGE_ID); |
| 171 } | 171 } |
| 172 | 172 |
| 173 // static | 173 // static |
| 174 void NewTabPageHandler::GetLocalizedValues(Profile* profile, | 174 void NewTabPageHandler::GetLocalizedValues(Profile* profile, |
| 175 base::DictionaryValue* values) { | 175 base::DictionaryValue* values) { |
| 176 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); | 176 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); |
| 177 values->SetInteger("apps_page_id", APPS_PAGE_ID); | 177 values->SetInteger("apps_page_id", APPS_PAGE_ID); |
| 178 values->SetInteger("suggestions_page_id", SUGGESTIONS_PAGE_ID); | |
| 179 | 178 |
| 180 PrefService* prefs = profile->GetPrefs(); | 179 PrefService* prefs = profile->GetPrefs(); |
| 181 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); | 180 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); |
| 182 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); | 181 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); |
| 183 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); | 182 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); |
| 184 } | 183 } |
| 185 | 184 |
| 186 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { | 185 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { |
| 187 content::NotificationService* service = | 186 content::NotificationService* service = |
| 188 content::NotificationService::current(); | 187 content::NotificationService::current(); |
| 189 service->Notify(notification_type, | 188 service->Notify(notification_type, |
| 190 content::Source<NewTabPageHandler>(this), | 189 content::Source<NewTabPageHandler>(this), |
| 191 content::NotificationService::NoDetails()); | 190 content::NotificationService::NoDetails()); |
| 192 } | 191 } |
| OLD | NEW |