Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

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

Issue 3156049: First set of changes for M7 NTP. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: pre-review cleanup Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 if (old_mode != mode) { 83 if (old_mode != mode) {
84 NotifySectionDisabled(mode, old_mode, dom_ui_->GetProfile()); 84 NotifySectionDisabled(mode, old_mode, dom_ui_->GetProfile());
85 pref_service_->SetInteger(prefs::kNTPShownSections, mode); 85 pref_service_->SetInteger(prefs::kNTPShownSections, mode);
86 } 86 }
87 } 87 }
88 88
89 // static 89 // static
90 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { 90 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) {
91 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, 91 pref_service->RegisterIntegerPref(prefs::kNTPShownSections,
92 THUMB | RECENT | TIPS | SYNC); 92 THUMB | RECENT | TIPS | SYNC | APPS);
93 } 93 }
94 94
95 // static 95 // static
96 void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service, 96 void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service,
97 int old_pref_version, 97 int old_pref_version,
98 int new_pref_version) { 98 int new_pref_version) {
99 bool changed = false; 99 bool changed = false;
100 int shown_sections = pref_service->GetInteger(prefs::kNTPShownSections); 100 int shown_sections = pref_service->GetInteger(prefs::kNTPShownSections);
101 101
102 if (old_pref_version < 1) { 102 if (old_pref_version < 1) {
103 // TIPS was used in early builds of the NNTP but since it was removed before 103 // TIPS was used in early builds of the NNTP but since it was removed before
104 // Chrome 3.0 we want to ensure that it is shown by default. 104 // Chrome 3.0 we want to ensure that it is shown by default.
105 shown_sections |= TIPS | SYNC; 105 shown_sections |= TIPS | SYNC;
106 changed = true; 106 changed = true;
107 } 107 }
108 108
109 if (old_pref_version < 2) { 109 if (old_pref_version < 2) {
110 // LIST is no longer used. Change to THUMB. 110 // LIST is no longer used. Change to THUMB.
111 shown_sections &= ~LIST; 111 shown_sections &= ~LIST;
112 shown_sections |= THUMB; 112 shown_sections |= THUMB;
113 changed = true; 113 changed = true;
114 } 114 }
115 115
116 if (old_pref_version < 3) {
117 // We reset people to only see apps by default in v3.
Miranda Callahan 2010/08/26 02:57:08 Should this "only" be in this spot? Or should it b
118 shown_sections = APPS;
119 changed = true;
120 }
121
116 if (changed) 122 if (changed)
117 pref_service->SetInteger(prefs::kNTPShownSections, shown_sections); 123 pref_service->SetInteger(prefs::kNTPShownSections, shown_sections);
118 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698