OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
(...skipping 29 matching lines...) Loading... |
40 bool r = list->GetString(0, &mode_string); | 40 bool r = list->GetString(0, &mode_string); |
41 DCHECK(r) << "Missing value in setShownSections from the NTP Most Visited."; | 41 DCHECK(r) << "Missing value in setShownSections from the NTP Most Visited."; |
42 | 42 |
43 dom_ui_->GetProfile()->GetPrefs()->SetInteger( | 43 dom_ui_->GetProfile()->GetPrefs()->SetInteger( |
44 prefs::kNTPShownSections, StringToInt(mode_string)); | 44 prefs::kNTPShownSections, StringToInt(mode_string)); |
45 } | 45 } |
46 | 46 |
47 // static | 47 // static |
48 void ShownSectionsHandler::RegisterUserPrefs(PrefService* prefs) { | 48 void ShownSectionsHandler::RegisterUserPrefs(PrefService* prefs) { |
49 prefs->RegisterIntegerPref(prefs::kNTPShownSections, | 49 prefs->RegisterIntegerPref(prefs::kNTPShownSections, |
50 THUMB | RECENT | TIPS); | 50 THUMB | RECENT | TIPS | SYNC); |
51 } | 51 } |
52 | 52 |
| 53 // static |
| 54 void ShownSectionsHandler::MigrateUserPrefs(PrefService* prefs, |
| 55 int old_pref_version, |
| 56 int new_pref_version) { |
| 57 if (old_pref_version < 1) { |
| 58 int shown_sections = prefs->GetInteger(prefs::kNTPShownSections); |
| 59 // TIPS was used in early builds of the NNTP but since it was removed before |
| 60 // Chrome 3.0 we want to ensure that it is shown by default. |
| 61 shown_sections |= TIPS | SYNC; |
| 62 prefs->SetInteger(prefs::kNTPShownSections, shown_sections); |
| 63 } |
| 64 } |
OLD | NEW |