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

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

Issue 18199003: Allow Chrome OS login profile to have different default pref values (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 5 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 "apps/app_launcher.h" 7 #include "apps/app_launcher.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 "ExtendedNewTabPage.TimeToClickMostVisited", delta); 163 "ExtendedNewTabPage.TimeToClickMostVisited", delta);
164 } else if (histogram_name == "ExtendedNewTabPage.TimeToClickRecentlyClosed") { 164 } else if (histogram_name == "ExtendedNewTabPage.TimeToClickRecentlyClosed") {
165 UMA_HISTOGRAM_LONG_TIMES( 165 UMA_HISTOGRAM_LONG_TIMES(
166 "ExtendedNewTabPage.TimeToClickRecentlyClosed", delta); 166 "ExtendedNewTabPage.TimeToClickRecentlyClosed", delta);
167 } else { 167 } else {
168 NOTREACHED(); 168 NOTREACHED();
169 } 169 }
170 } 170 }
171 171
172 // static 172 // static
173 void NewTabPageHandler::RegisterUserPrefs( 173 void NewTabPageHandler::RegisterProfilePrefs(
174 user_prefs::PrefRegistrySyncable* registry) { 174 user_prefs::PrefRegistrySyncable* registry) {
175 // TODO(estade): should be syncable. 175 // TODO(estade): should be syncable.
176 registry->RegisterIntegerPref( 176 registry->RegisterIntegerPref(
177 prefs::kNtpShownPage, 177 prefs::kNtpShownPage,
178 APPS_PAGE_ID, 178 APPS_PAGE_ID,
179 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 179 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
180 } 180 }
181 181
182 // static 182 // static
183 void NewTabPageHandler::GetLocalizedValues(Profile* profile, 183 void NewTabPageHandler::GetLocalizedValues(Profile* profile,
184 DictionaryValue* values) { 184 DictionaryValue* values) {
185 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); 185 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID);
186 values->SetInteger("apps_page_id", APPS_PAGE_ID); 186 values->SetInteger("apps_page_id", APPS_PAGE_ID);
187 values->SetInteger("suggestions_page_id", SUGGESTIONS_PAGE_ID); 187 values->SetInteger("suggestions_page_id", SUGGESTIONS_PAGE_ID);
188 188
189 PrefService* prefs = profile->GetPrefs(); 189 PrefService* prefs = profile->GetPrefs();
190 int shown_page = prefs->GetInteger(prefs::kNtpShownPage); 190 int shown_page = prefs->GetInteger(prefs::kNtpShownPage);
191 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); 191 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK);
192 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); 192 values->SetInteger("shown_page_index", shown_page & INDEX_MASK);
193 } 193 }
194 194
195 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { 195 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) {
196 content::NotificationService* service = 196 content::NotificationService* service =
197 content::NotificationService::current(); 197 content::NotificationService::current();
198 service->Notify(notification_type, 198 service->Notify(notification_type,
199 content::Source<NewTabPageHandler>(this), 199 content::Source<NewTabPageHandler>(this),
200 content::NotificationService::NoDetails()); 200 content::NotificationService::NoDetails());
201 } 201 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_page_handler.h ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698