Chromium Code Reviews

Side by Side Diff: chrome/browser/dom_ui/shown_sections_handler.cc

Issue 337011: NTP: Allow hiding tips and bookmark sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
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...)
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 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/shown_sections_handler.h ('k') | chrome/browser/dom_ui/shown_sections_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine