| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 void NewTabPageHandler::RegisterPrefs(PrefService* prefs) { | 142 void NewTabPageHandler::RegisterPrefs(PrefService* prefs) { |
| 143 prefs->RegisterIntegerPref(prefs::kNtp4IntroDisplayCount, 0, | 143 prefs->RegisterIntegerPref(prefs::kNtp4IntroDisplayCount, 0, |
| 144 PrefService::UNSYNCABLE_PREF); | 144 PrefService::UNSYNCABLE_PREF); |
| 145 } | 145 } |
| 146 | 146 |
| 147 // static | 147 // static |
| 148 void NewTabPageHandler::GetLocalizedValues(Profile* profile, | 148 void NewTabPageHandler::GetLocalizedValues(Profile* profile, |
| 149 DictionaryValue* values) { | 149 DictionaryValue* values) { |
| 150 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); | 150 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); |
| 151 values->SetInteger("apps_page_id", APPS_PAGE_ID); | 151 values->SetInteger("apps_page_id", APPS_PAGE_ID); |
| 152 values->SetInteger("suggestions_page_id", SUGGESTIONS_PAGE_ID); |
| 152 | 153 |
| 153 PrefService* prefs = profile->GetPrefs(); | 154 PrefService* prefs = profile->GetPrefs(); |
| 154 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); | 155 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); |
| 155 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); | 156 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); |
| 156 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); | 157 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); |
| 157 | 158 |
| 158 PrefService* local_state = g_browser_process->local_state(); | 159 PrefService* local_state = g_browser_process->local_state(); |
| 159 int intro_displays = local_state->GetInteger(prefs::kNtp4IntroDisplayCount); | 160 int intro_displays = local_state->GetInteger(prefs::kNtp4IntroDisplayCount); |
| 160 // This preference used to exist in profile, so check the profile if it has | 161 // This preference used to exist in profile, so check the profile if it has |
| 161 // not been set in local state yet. | 162 // not been set in local state yet. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 182 // is only called during startup before the ntp resource cache is constructed. | 183 // is only called during startup before the ntp resource cache is constructed. |
| 183 } | 184 } |
| 184 | 185 |
| 185 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { | 186 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { |
| 186 content::NotificationService* service = | 187 content::NotificationService* service = |
| 187 content::NotificationService::current(); | 188 content::NotificationService::current(); |
| 188 service->Notify(notification_type, | 189 service->Notify(notification_type, |
| 189 content::Source<NewTabPageHandler>(this), | 190 content::Source<NewTabPageHandler>(this), |
| 190 content::NotificationService::NoDetails()); | 191 content::NotificationService::NoDetails()); |
| 191 } | 192 } |
| OLD | NEW |