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 "chrome/common/pref_names.h" | 7 #include "chrome/common/pref_names.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sync/profile_sync_service.h" | 10 #include "chrome/browser/sync/profile_sync_service.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // TODO(estade): should be syncable. | 74 // TODO(estade): should be syncable. |
75 prefs->RegisterIntegerPref(prefs::kNTPShownPage, APPS_PAGE_ID, | 75 prefs->RegisterIntegerPref(prefs::kNTPShownPage, APPS_PAGE_ID, |
76 PrefService::UNSYNCABLE_PREF); | 76 PrefService::UNSYNCABLE_PREF); |
77 prefs->RegisterIntegerPref(prefs::kNTP4IntroDisplayCount, 0, | 77 prefs->RegisterIntegerPref(prefs::kNTP4IntroDisplayCount, 0, |
78 PrefService::UNSYNCABLE_PREF); | 78 PrefService::UNSYNCABLE_PREF); |
79 } | 79 } |
80 | 80 |
81 // static | 81 // static |
82 void NewTabPageHandler::GetLocalizedValues(Profile* profile, | 82 void NewTabPageHandler::GetLocalizedValues(Profile* profile, |
83 DictionaryValue* values) { | 83 DictionaryValue* values) { |
84 if (!NewTabUI::Ntp4Enabled()) | 84 if (!NewTabUI::NTP4Enabled()) |
85 return; | 85 return; |
86 | 86 |
87 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); | 87 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); |
88 values->SetInteger("apps_page_id", APPS_PAGE_ID); | 88 values->SetInteger("apps_page_id", APPS_PAGE_ID); |
89 values->SetInteger("bookmarks_page_id", BOOKMARKS_PAGE_ID); | 89 values->SetInteger("bookmarks_page_id", BOOKMARKS_PAGE_ID); |
90 | 90 |
91 PrefService* prefs = profile->GetPrefs(); | 91 PrefService* prefs = profile->GetPrefs(); |
92 int shown_page = prefs->GetInteger(prefs::kNTPShownPage); | 92 int shown_page = prefs->GetInteger(prefs::kNTPShownPage); |
93 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); | 93 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); |
94 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); | 94 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); |
95 | 95 |
96 int intro_displays = prefs->GetInteger(prefs::kNTP4IntroDisplayCount); | 96 int intro_displays = prefs->GetInteger(prefs::kNTP4IntroDisplayCount); |
97 if (intro_displays <= kIntroDisplayMax) { | 97 if (intro_displays <= kIntroDisplayMax) { |
98 values->SetString("ntp4_intro_message", | 98 values->SetString("ntp4_intro_message", |
99 l10n_util::GetStringUTF16(IDS_NTP4_INTRO_MESSAGE)); | 99 l10n_util::GetStringUTF16(IDS_NTP4_INTRO_MESSAGE)); |
100 } | 100 } |
101 } | 101 } |
OLD | NEW |