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

Side by Side Diff: chrome/browser/prefs/session_startup_pref.cc

Issue 10417032: Disable sync promo when RestoreOnStartupURLs policy is used (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: CL rewritten to address the actual underlying issue. Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/prefs/session_startup_pref.h" 5 #include "chrome/browser/prefs/session_startup_pref.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/net/url_fixer_upper.h" 10 #include "chrome/browser/net/url_fixer_upper.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // static 195 // static
196 bool SessionStartupPref::URLsAreManaged(PrefService* prefs) { 196 bool SessionStartupPref::URLsAreManaged(PrefService* prefs) {
197 DCHECK(prefs); 197 DCHECK(prefs);
198 const PrefService::Preference* pref_urls = 198 const PrefService::Preference* pref_urls =
199 prefs->FindPreference(prefs::kURLsToRestoreOnStartup); 199 prefs->FindPreference(prefs::kURLsToRestoreOnStartup);
200 DCHECK(pref_urls); 200 DCHECK(pref_urls);
201 return pref_urls->IsManaged(); 201 return pref_urls->IsManaged();
202 } 202 }
203 203
204 // static 204 // static
205 bool SessionStartupPref::TypeIsDefault(PrefService* prefs) {
206 DCHECK(prefs);
207 const PrefService::Preference* pref_restore =
208 prefs->FindPreference(prefs::kRestoreOnStartup);
209 DCHECK(pref_restore);
210 return pref_restore->IsDefaultValue();
211 }
212
213 // static
205 SessionStartupPref::Type SessionStartupPref::PrefValueToType(int pref_value) { 214 SessionStartupPref::Type SessionStartupPref::PrefValueToType(int pref_value) {
206 switch (pref_value) { 215 switch (pref_value) {
207 case kPrefValueLast: return SessionStartupPref::LAST; 216 case kPrefValueLast: return SessionStartupPref::LAST;
208 case kPrefValueURLs: return SessionStartupPref::URLS; 217 case kPrefValueURLs: return SessionStartupPref::URLS;
209 case kPrefValueHomePage: return SessionStartupPref::HOMEPAGE; 218 case kPrefValueHomePage: return SessionStartupPref::HOMEPAGE;
210 default: return SessionStartupPref::DEFAULT; 219 default: return SessionStartupPref::DEFAULT;
211 } 220 }
212 } 221 }
213 222
214 // static 223 // static
(...skipping 27 matching lines...) Expand all
242 CHECK(prefs_watcher->GetBackupForPref( 251 CHECK(prefs_watcher->GetBackupForPref(
243 prefs::kURLsToRestoreOnStartup)->GetAsList(&url_list)); 252 prefs::kURLsToRestoreOnStartup)->GetAsList(&url_list));
244 URLListToPref(url_list, &backup_pref); 253 URLListToPref(url_list, &backup_pref);
245 254
246 return backup_pref; 255 return backup_pref;
247 } 256 }
248 257
249 SessionStartupPref::SessionStartupPref(Type type) : type(type) {} 258 SessionStartupPref::SessionStartupPref(Type type) : type(type) {}
250 259
251 SessionStartupPref::~SessionStartupPref() {} 260 SessionStartupPref::~SessionStartupPref() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698