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/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 void NewTabPageHandler::RegisterPrefs(PrefService* prefs) { | 154 void NewTabPageHandler::RegisterPrefs(PrefService* prefs) { |
155 prefs->RegisterIntegerPref(prefs::kNtp4IntroDisplayCount, 0, | 155 prefs->RegisterIntegerPref(prefs::kNtp4IntroDisplayCount, 0, |
156 PrefService::UNSYNCABLE_PREF); | 156 PrefService::UNSYNCABLE_PREF); |
157 } | 157 } |
158 | 158 |
159 // static | 159 // static |
160 void NewTabPageHandler::GetLocalizedValues(Profile* profile, | 160 void NewTabPageHandler::GetLocalizedValues(Profile* profile, |
161 DictionaryValue* values) { | 161 DictionaryValue* values) { |
162 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); | 162 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); |
163 values->SetInteger("apps_page_id", APPS_PAGE_ID); | 163 values->SetInteger("apps_page_id", APPS_PAGE_ID); |
| 164 values->SetInteger("suggestions_page_id", SUGGESTIONS_PAGE_ID); |
164 | 165 |
165 PrefService* prefs = profile->GetPrefs(); | 166 PrefService* prefs = profile->GetPrefs(); |
166 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); | 167 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); |
167 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); | 168 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); |
168 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); | 169 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); |
169 | 170 |
170 PrefService* local_state = g_browser_process->local_state(); | 171 PrefService* local_state = g_browser_process->local_state(); |
171 int intro_displays = local_state->GetInteger(prefs::kNtp4IntroDisplayCount); | 172 int intro_displays = local_state->GetInteger(prefs::kNtp4IntroDisplayCount); |
172 // This preference used to exist in profile, so check the profile if it has | 173 // This preference used to exist in profile, so check the profile if it has |
173 // not been set in local state yet. | 174 // not been set in local state yet. |
(...skipping 20 matching lines...) Expand all Loading... |
194 // is only called during startup before the ntp resource cache is constructed. | 195 // is only called during startup before the ntp resource cache is constructed. |
195 } | 196 } |
196 | 197 |
197 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { | 198 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { |
198 content::NotificationService* service = | 199 content::NotificationService* service = |
199 content::NotificationService::current(); | 200 content::NotificationService::current(); |
200 service->Notify(notification_type, | 201 service->Notify(notification_type, |
201 content::Source<NewTabPageHandler>(this), | 202 content::Source<NewTabPageHandler>(this), |
202 content::NotificationService::NoDetails()); | 203 content::NotificationService::NoDetails()); |
203 } | 204 } |
OLD | NEW |