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

Side by Side Diff: chrome/browser/ui/webui/shown_sections_handler.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the previous fix Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
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/shown_sections_handler.h" 5 #include "chrome/browser/ui/webui/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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 NotifySectionDisabled(mode, old_mode, web_ui_->GetProfile()); 100 NotifySectionDisabled(mode, old_mode, web_ui_->GetProfile());
101 pref_service_->SetInteger(prefs::kNTPShownSections, mode); 101 pref_service_->SetInteger(prefs::kNTPShownSections, mode);
102 } 102 }
103 } 103 }
104 104
105 // static 105 // static
106 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { 106 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) {
107 #if defined(OS_CHROMEOS) 107 #if defined(OS_CHROMEOS)
108 // Default to have expanded APPS and all other sections are minimized. 108 // Default to have expanded APPS and all other sections are minimized.
109 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, 109 pref_service->RegisterIntegerPref(prefs::kNTPShownSections,
110 APPS | MENU_THUMB | MENU_RECENT); 110 APPS | MENU_THUMB | MENU_RECENT,
111 false /* don't sync pref */);
111 #else 112 #else
112 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, THUMB); 113 pref_service->RegisterIntegerPref(prefs::kNTPShownSections,
114 THUMB,
115 false /* don't sync pref */);
113 #endif 116 #endif
114 } 117 }
115 118
116 // static 119 // static
117 void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service, 120 void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service,
118 int old_pref_version, 121 int old_pref_version,
119 int new_pref_version) { 122 int new_pref_version) {
120 // Nothing to migrate for default kNTPShownSections value. 123 // Nothing to migrate for default kNTPShownSections value.
121 const PrefService::Preference* shown_sections_pref = 124 const PrefService::Preference* shown_sections_pref =
122 pref_service->FindPreference(prefs::kNTPShownSections); 125 pref_service->FindPreference(prefs::kNTPShownSections);
(...skipping 30 matching lines...) Expand all
153 156
154 // Hide any open sections. 157 // Hide any open sections.
155 mode &= ~ALL_SECTIONS_MASK; 158 mode &= ~ALL_SECTIONS_MASK;
156 159
157 // Show the apps section. 160 // Show the apps section.
158 mode |= APPS; 161 mode |= APPS;
159 162
160 prefs->SetInteger(prefs::kNTPShownSections, mode); 163 prefs->SetInteger(prefs::kNTPShownSections, mode);
161 } 164 }
162 } 165 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698