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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // static | 53 // static |
54 void NewTabPageHandler::RegisterUserPrefs(PrefService* prefs) { | 54 void NewTabPageHandler::RegisterUserPrefs(PrefService* prefs) { |
55 // TODO(estade): should be syncable. | 55 // TODO(estade): should be syncable. |
56 prefs->RegisterIntegerPref(prefs::kNTPShownPage, APPS_PAGE_ID, | 56 prefs->RegisterIntegerPref(prefs::kNTPShownPage, APPS_PAGE_ID, |
57 PrefService::UNSYNCABLE_PREF); | 57 PrefService::UNSYNCABLE_PREF); |
58 } | 58 } |
59 | 59 |
60 // static | 60 // static |
61 void NewTabPageHandler::GetLocalizedValues(Profile* profile, | 61 void NewTabPageHandler::GetLocalizedValues(Profile* profile, |
62 DictionaryValue* values) { | 62 DictionaryValue* values) { |
63 if (!NewTabUI::Ntp4Enabled()) | 63 if (!NewTabUI::NTP4Enabled()) |
64 return; | 64 return; |
65 | 65 |
66 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); | 66 values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); |
67 values->SetInteger("apps_page_id", APPS_PAGE_ID); | 67 values->SetInteger("apps_page_id", APPS_PAGE_ID); |
68 values->SetInteger("bookmarks_page_id", BOOKMARKS_PAGE_ID); | 68 values->SetInteger("bookmarks_page_id", BOOKMARKS_PAGE_ID); |
69 | 69 |
70 PrefService* prefs = profile->GetPrefs(); | 70 PrefService* prefs = profile->GetPrefs(); |
71 int shown_page = prefs->GetInteger(prefs::kNTPShownPage); | 71 int shown_page = prefs->GetInteger(prefs::kNTPShownPage); |
72 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); | 72 values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); |
73 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); | 73 values->SetInteger("shown_page_index", shown_page & INDEX_MASK); |
74 } | 74 } |
OLD | NEW |