| 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/shown_sections_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 NotifySectionDisabled(mode, old_mode, web_ui_->GetProfile()); | 98 NotifySectionDisabled(mode, old_mode, web_ui_->GetProfile()); |
| 99 pref_service_->SetInteger(prefs::kNTPShownSections, mode); | 99 pref_service_->SetInteger(prefs::kNTPShownSections, mode); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 // static | 103 // static |
| 104 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { | 104 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { |
| 105 #if defined(OS_CHROMEOS) | 105 #if defined(OS_CHROMEOS) |
| 106 // Default to have expanded APPS and all other sections are minimized. | 106 // Default to have expanded APPS and all other sections are minimized. |
| 107 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, | 107 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, |
| 108 APPS | MENU_THUMB | MENU_RECENT); | 108 APPS | MENU_THUMB | MENU_RECENT, |
| 109 PrefService::UNSYNCABLE_PREF); |
| 109 #else | 110 #else |
| 110 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, THUMB); | 111 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, |
| 112 THUMB, |
| 113 PrefService::UNSYNCABLE_PREF); |
| 111 #endif | 114 #endif |
| 112 } | 115 } |
| 113 | 116 |
| 114 // static | 117 // static |
| 115 void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service, | 118 void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service, |
| 116 int old_pref_version, | 119 int old_pref_version, |
| 117 int new_pref_version) { | 120 int new_pref_version) { |
| 118 // Nothing to migrate for default kNTPShownSections value. | 121 // Nothing to migrate for default kNTPShownSections value. |
| 119 const PrefService::Preference* shown_sections_pref = | 122 const PrefService::Preference* shown_sections_pref = |
| 120 pref_service->FindPreference(prefs::kNTPShownSections); | 123 pref_service->FindPreference(prefs::kNTPShownSections); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 151 | 154 |
| 152 // Hide any open sections. | 155 // Hide any open sections. |
| 153 mode &= ~ALL_SECTIONS_MASK; | 156 mode &= ~ALL_SECTIONS_MASK; |
| 154 | 157 |
| 155 // Show the apps section. | 158 // Show the apps section. |
| 156 mode |= APPS; | 159 mode |= APPS; |
| 157 | 160 |
| 158 prefs->SetInteger(prefs::kNTPShownSections, mode); | 161 prefs->SetInteger(prefs::kNTPShownSections, mode); |
| 159 } | 162 } |
| 160 } | 163 } |
| OLD | NEW |