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

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

Issue 9567027: aura: Remove apps from NTP4 and disable NTP4 intro bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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) 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 DictionaryValue* values) { 161 DictionaryValue* values) {
162 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); 162 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID);
163 values->SetInteger("apps_page_id", APPS_PAGE_ID); 163 values->SetInteger("apps_page_id", APPS_PAGE_ID);
164 values->SetInteger("suggestions_page_id", SUGGESTIONS_PAGE_ID); 164 values->SetInteger("suggestions_page_id", SUGGESTIONS_PAGE_ID);
165 165
166 PrefService* prefs = profile->GetPrefs(); 166 PrefService* prefs = profile->GetPrefs();
167 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); 167 int shown_page = prefs->GetInteger(prefs::kNtpShownPage);
168 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); 168 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK);
169 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); 169 values->SetInteger("shown_page_index", shown_page & INDEX_MASK);
170 170
171 #if !defined(USE_AURA)
172 // Only show intro bubble for non-aura build.
173
171 PrefService* local_state = g_browser_process->local_state(); 174 PrefService* local_state = g_browser_process->local_state();
172 int intro_displays = local_state->GetInteger(prefs::kNtp4IntroDisplayCount); 175 int intro_displays = local_state->GetInteger(prefs::kNtp4IntroDisplayCount);
173 // This preference used to exist in profile, so check the profile if it has 176 // This preference used to exist in profile, so check the profile if it has
174 // not been set in local state yet. 177 // not been set in local state yet.
175 if (!intro_displays) { 178 if (!intro_displays) {
176 prefs->RegisterIntegerPref(prefs::kNtp4IntroDisplayCount, 0, 179 prefs->RegisterIntegerPref(prefs::kNtp4IntroDisplayCount, 0,
177 PrefService::UNSYNCABLE_PREF); 180 PrefService::UNSYNCABLE_PREF);
178 intro_displays = prefs->GetInteger(prefs::kNtp4IntroDisplayCount); 181 intro_displays = prefs->GetInteger(prefs::kNtp4IntroDisplayCount);
179 if (intro_displays) 182 if (intro_displays)
180 local_state->SetInteger(prefs::kNtp4IntroDisplayCount, intro_displays); 183 local_state->SetInteger(prefs::kNtp4IntroDisplayCount, intro_displays);
181 } 184 }
182 if (intro_displays <= kIntroDisplayMax) { 185 if (intro_displays <= kIntroDisplayMax) {
183 values->SetString("ntp4_intro_message", 186 values->SetString("ntp4_intro_message",
184 l10n_util::GetStringUTF16(IDS_NTP4_INTRO_MESSAGE)); 187 l10n_util::GetStringUTF16(IDS_NTP4_INTRO_MESSAGE));
185 values->SetString("ntp4_intro_url", kNtp4IntroURL); 188 values->SetString("ntp4_intro_url", kNtp4IntroURL);
186 values->SetString("learn_more", 189 values->SetString("learn_more",
187 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); 190 l10n_util::GetStringUTF16(IDS_LEARN_MORE));
188 } 191 }
192 #endif
189 } 193 }
190 194
191 // static 195 // static
192 void NewTabPageHandler::DismissIntroMessage(PrefService* prefs) { 196 void NewTabPageHandler::DismissIntroMessage(PrefService* prefs) {
193 prefs->SetInteger(prefs::kNtp4IntroDisplayCount, kIntroDisplayMax + 1); 197 prefs->SetInteger(prefs::kNtp4IntroDisplayCount, kIntroDisplayMax + 1);
194 // No need to send notification to update resource cache, because this method 198 // No need to send notification to update resource cache, because this method
195 // is only called during startup before the ntp resource cache is constructed. 199 // is only called during startup before the ntp resource cache is constructed.
196 } 200 }
197 201
198 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { 202 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) {
199 content::NotificationService* service = 203 content::NotificationService* service =
200 content::NotificationService::current(); 204 content::NotificationService::current();
201 service->Notify(notification_type, 205 service->Notify(notification_type,
202 content::Source<NewTabPageHandler>(this), 206 content::Source<NewTabPageHandler>(this),
203 content::NotificationService::NoDetails()); 207 content::NotificationService::NoDetails());
204 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698