OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 // static | 128 // static |
129 void NewTabPageHandler::RegisterPrefs(PrefService* prefs) { | 129 void NewTabPageHandler::RegisterPrefs(PrefService* prefs) { |
130 prefs->RegisterIntegerPref(prefs::kNTP4IntroDisplayCount, 0, | 130 prefs->RegisterIntegerPref(prefs::kNTP4IntroDisplayCount, 0, |
131 PrefService::UNSYNCABLE_PREF); | 131 PrefService::UNSYNCABLE_PREF); |
132 } | 132 } |
133 | 133 |
134 // static | 134 // static |
135 void NewTabPageHandler::GetLocalizedValues(Profile* profile, | 135 void NewTabPageHandler::GetLocalizedValues(Profile* profile, |
136 DictionaryValue* values) { | 136 DictionaryValue* values) { |
137 if (!NewTabUI::NTP4Enabled()) | |
138 return; | |
139 | |
140 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); | 137 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); |
141 values->SetInteger("apps_page_id", APPS_PAGE_ID); | 138 values->SetInteger("apps_page_id", APPS_PAGE_ID); |
142 values->SetInteger("bookmarks_page_id", BOOKMARKS_PAGE_ID); | 139 values->SetInteger("bookmarks_page_id", BOOKMARKS_PAGE_ID); |
143 | 140 |
144 PrefService* prefs = profile->GetPrefs(); | 141 PrefService* prefs = profile->GetPrefs(); |
145 int shown_page = prefs->GetInteger(prefs::kNTPShownPage); | 142 int shown_page = prefs->GetInteger(prefs::kNTPShownPage); |
146 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); | 143 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); |
147 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); | 144 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); |
148 | 145 |
149 PrefService* local_state = g_browser_process->local_state(); | 146 PrefService* local_state = g_browser_process->local_state(); |
(...skipping 23 matching lines...) Expand all Loading... |
173 // is only called during startup before the ntp resource cache is constructed. | 170 // is only called during startup before the ntp resource cache is constructed. |
174 } | 171 } |
175 | 172 |
176 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { | 173 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { |
177 content::NotificationService* service = | 174 content::NotificationService* service = |
178 content::NotificationService::current(); | 175 content::NotificationService::current(); |
179 service->Notify(notification_type, | 176 service->Notify(notification_type, |
180 content::Source<NewTabPageHandler>(this), | 177 content::Source<NewTabPageHandler>(this), |
181 content::NotificationService::NoDetails()); | 178 content::NotificationService::NoDetails()); |
182 } | 179 } |
OLD | NEW |