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

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

Issue 8879016: Add more per-tab preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 8 years, 12 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
« no previous file with comments | « chrome/browser/prefs/pref_model_associator.h ('k') | chrome/browser/prefs/pref_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/prefs/pref_model_associator.h" 5 #include "chrome/browser/prefs/pref_model_associator.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_value_serializer.h" 9 #include "base/json/json_value_serializer.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 369
370 void PrefModelAssociator::RegisterPref(const char* name) { 370 void PrefModelAssociator::RegisterPref(const char* name) {
371 DCHECK(!models_associated_ && registered_preferences_.count(name) == 0); 371 DCHECK(!models_associated_ && registered_preferences_.count(name) == 0);
372 registered_preferences_.insert(name); 372 registered_preferences_.insert(name);
373 } 373 }
374 374
375 bool PrefModelAssociator::IsPrefRegistered(const char* name) { 375 bool PrefModelAssociator::IsPrefRegistered(const char* name) {
376 return registered_preferences_.count(name) > 0; 376 return registered_preferences_.count(name) > 0;
377 } 377 }
378 378
379 void PrefModelAssociator::UnregisterPref(const char* name) {
380 CHECK(synced_preferences_.count(name) == 0);
Bernhard Bauer 2011/12/28 13:33:42 Make this a DCHECK? And should this be |registered
mnaganov (inactive) 2011/12/28 13:41:40 Of course, DCHECK. Fixed. No. If a property isn't
Bernhard Bauer 2011/12/28 22:35:30 OK, that makes sense.
381 registered_preferences_.erase(name);
382 }
383
379 void PrefModelAssociator::ProcessPrefChange(const std::string& name) { 384 void PrefModelAssociator::ProcessPrefChange(const std::string& name) {
380 if (processing_syncer_changes_) 385 if (processing_syncer_changes_)
381 return; // These are changes originating from us, ignore. 386 return; // These are changes originating from us, ignore.
382 387
383 // We only process changes if we've already associated models. 388 // We only process changes if we've already associated models.
384 if (!models_associated_) 389 if (!models_associated_)
385 return; 390 return;
386 391
387 const PrefService::Preference* preference = 392 const PrefService::Preference* preference =
388 pref_service_->FindPreference(name.c_str()); 393 pref_service_->FindPreference(name.c_str());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 SyncError error = 427 SyncError error =
423 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); 428 sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
424 if (error.IsSet()) 429 if (error.IsSet())
425 StopSyncing(PREFERENCES); 430 StopSyncing(PREFERENCES);
426 } 431 }
427 432
428 void PrefModelAssociator::SetPrefService(PrefService* pref_service) { 433 void PrefModelAssociator::SetPrefService(PrefService* pref_service) {
429 DCHECK(pref_service_ == NULL); 434 DCHECK(pref_service_ == NULL);
430 pref_service_ = pref_service; 435 pref_service_ = pref_service;
431 } 436 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_model_associator.h ('k') | chrome/browser/prefs/pref_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698