Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_page_handler.cc

Issue 8036002: ntp: remove ntp3 resources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/prefs/pref_service.h" 7 #include "chrome/browser/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/profile_sync_service.h" 9 #include "chrome/browser/sync/profile_sync_service.h"
10 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 10 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // TODO(estade): should be syncable. 70 // TODO(estade): should be syncable.
71 prefs->RegisterIntegerPref(prefs::kNTPShownPage, APPS_PAGE_ID, 71 prefs->RegisterIntegerPref(prefs::kNTPShownPage, APPS_PAGE_ID,
72 PrefService::UNSYNCABLE_PREF); 72 PrefService::UNSYNCABLE_PREF);
73 prefs->RegisterIntegerPref(prefs::kNTP4IntroDisplayCount, 0, 73 prefs->RegisterIntegerPref(prefs::kNTP4IntroDisplayCount, 0,
74 PrefService::UNSYNCABLE_PREF); 74 PrefService::UNSYNCABLE_PREF);
75 } 75 }
76 76
77 // static 77 // static
78 void NewTabPageHandler::GetLocalizedValues(Profile* profile, 78 void NewTabPageHandler::GetLocalizedValues(Profile* profile,
79 DictionaryValue* values) { 79 DictionaryValue* values) {
80 if (!NewTabUI::NTP4Enabled())
81 return;
82
83 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); 80 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID);
84 values->SetInteger("apps_page_id", APPS_PAGE_ID); 81 values->SetInteger("apps_page_id", APPS_PAGE_ID);
85 values->SetInteger("bookmarks_page_id", BOOKMARKS_PAGE_ID); 82 values->SetInteger("bookmarks_page_id", BOOKMARKS_PAGE_ID);
86 83
87 PrefService* prefs = profile->GetPrefs(); 84 PrefService* prefs = profile->GetPrefs();
88 int shown_page = prefs->GetInteger(prefs::kNTPShownPage); 85 int shown_page = prefs->GetInteger(prefs::kNTPShownPage);
89 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); 86 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK);
90 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); 87 values->SetInteger("shown_page_index", shown_page & INDEX_MASK);
91 88
92 int intro_displays = prefs->GetInteger(prefs::kNTP4IntroDisplayCount); 89 int intro_displays = prefs->GetInteger(prefs::kNTP4IntroDisplayCount);
93 if (intro_displays <= kIntroDisplayMax) { 90 if (intro_displays <= kIntroDisplayMax) {
94 values->SetString("ntp4_intro_message", 91 values->SetString("ntp4_intro_message",
95 l10n_util::GetStringUTF16(IDS_NTP4_INTRO_MESSAGE)); 92 l10n_util::GetStringUTF16(IDS_NTP4_INTRO_MESSAGE));
96 values->SetString("ntp4_intro_url", kNTP4IntroURL); 93 values->SetString("ntp4_intro_url", kNTP4IntroURL);
97 values->SetString("learn_more", 94 values->SetString("learn_more",
98 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); 95 l10n_util::GetStringUTF16(IDS_LEARN_MORE));
99 } 96 }
100 } 97 }
101 98
102 // static 99 // static
103 void NewTabPageHandler::DismissIntroMessage(PrefService* prefs) { 100 void NewTabPageHandler::DismissIntroMessage(PrefService* prefs) {
104 prefs->SetInteger(prefs::kNTP4IntroDisplayCount, kIntroDisplayMax + 1); 101 prefs->SetInteger(prefs::kNTP4IntroDisplayCount, kIntroDisplayMax + 1);
105 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698