| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 prefs->RegisterIntegerPref(prefs::kNtp4IntroDisplayCount, 0, | 179 prefs->RegisterIntegerPref(prefs::kNtp4IntroDisplayCount, 0, |
| 180 PrefService::UNSYNCABLE_PREF); | 180 PrefService::UNSYNCABLE_PREF); |
| 181 intro_displays = prefs->GetInteger(prefs::kNtp4IntroDisplayCount); | 181 intro_displays = prefs->GetInteger(prefs::kNtp4IntroDisplayCount); |
| 182 if (intro_displays) | 182 if (intro_displays) |
| 183 local_state->SetInteger(prefs::kNtp4IntroDisplayCount, intro_displays); | 183 local_state->SetInteger(prefs::kNtp4IntroDisplayCount, intro_displays); |
| 184 } | 184 } |
| 185 if (intro_displays <= kIntroDisplayMax) { | 185 if (intro_displays <= kIntroDisplayMax) { |
| 186 values->SetString("ntp4_intro_message", | 186 values->SetString("ntp4_intro_message", |
| 187 l10n_util::GetStringUTF16(IDS_NTP4_INTRO_MESSAGE)); | 187 l10n_util::GetStringUTF16(IDS_NTP4_INTRO_MESSAGE)); |
| 188 values->SetString("ntp4_intro_url", kNtp4IntroURL); | 188 values->SetString("ntp4_intro_url", kNtp4IntroURL); |
| 189 values->SetString("learn_more", | |
| 190 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | |
| 191 } | 189 } |
| 192 #endif | 190 #endif |
| 193 } | 191 } |
| 194 | 192 |
| 195 // static | 193 // static |
| 196 void NewTabPageHandler::DismissIntroMessage(PrefService* prefs) { | 194 void NewTabPageHandler::DismissIntroMessage(PrefService* prefs) { |
| 197 prefs->SetInteger(prefs::kNtp4IntroDisplayCount, kIntroDisplayMax + 1); | 195 prefs->SetInteger(prefs::kNtp4IntroDisplayCount, kIntroDisplayMax + 1); |
| 198 // No need to send notification to update resource cache, because this method | 196 // No need to send notification to update resource cache, because this method |
| 199 // is only called during startup before the ntp resource cache is constructed. | 197 // is only called during startup before the ntp resource cache is constructed. |
| 200 } | 198 } |
| 201 | 199 |
| 202 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { | 200 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { |
| 203 content::NotificationService* service = | 201 content::NotificationService* service = |
| 204 content::NotificationService::current(); | 202 content::NotificationService::current(); |
| 205 service->Notify(notification_type, | 203 service->Notify(notification_type, |
| 206 content::Source<NewTabPageHandler>(this), | 204 content::Source<NewTabPageHandler>(this), |
| 207 content::NotificationService::NoDetails()); | 205 content::NotificationService::NoDetails()); |
| 208 } | 206 } |
| OLD | NEW |