OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/shown_sections_handler.h" | 5 #include "chrome/browser/dom_ui/shown_sections_handler.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 THUMB | RECENT | TIPS | SYNC | APPS); | 103 THUMB | RECENT | TIPS | SYNC | APPS); |
104 } | 104 } |
105 | 105 |
106 // static | 106 // static |
107 void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service, | 107 void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service, |
108 int old_pref_version, | 108 int old_pref_version, |
109 int new_pref_version) { | 109 int new_pref_version) { |
110 bool changed = false; | 110 bool changed = false; |
111 int shown_sections = pref_service->GetInteger(prefs::kNTPShownSections); | 111 int shown_sections = pref_service->GetInteger(prefs::kNTPShownSections); |
112 | 112 |
113 if (old_pref_version < 3) { | 113 if (old_pref_version < 1) { |
114 // At version 3, we added apps. To bring attention to the feature, we start | 114 // TIPS was used in early builds of the NNTP but since it was removed before |
115 // it off as the only expanded section. | 115 // Chrome 3.0 we want to ensure that it is shown by default. |
116 shown_sections = APPS; | 116 shown_sections |= TIPS | SYNC; |
117 changed = true; | 117 changed = true; |
118 } | 118 } |
119 | 119 |
| 120 if (old_pref_version < 2) { |
| 121 // LIST is no longer used. Change to THUMB. |
| 122 shown_sections &= ~LIST; |
| 123 shown_sections |= THUMB; |
| 124 changed = true; |
| 125 } |
| 126 |
120 if (changed) | 127 if (changed) |
121 pref_service->SetInteger(prefs::kNTPShownSections, shown_sections); | 128 pref_service->SetInteger(prefs::kNTPShownSections, shown_sections); |
122 } | 129 } |
OLD | NEW |