| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "net/sdch/sdch_owner.h" | 5 #include "net/sdch/sdch_owner.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
| 9 #include "base/logging.h" | 11 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 11 #include "base/prefs/persistent_pref_store.h" | 13 #include "base/prefs/persistent_pref_store.h" |
| 12 #include "base/prefs/value_map_pref_store.h" | 14 #include "base/prefs/value_map_pref_store.h" |
| 13 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 14 #include "base/time/default_clock.h" | 16 #include "base/time/default_clock.h" |
| 15 #include "base/values.h" | 17 #include "base/values.h" |
| 16 #include "net/base/sdch_manager.h" | 18 #include "net/base/sdch_manager.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 DCHECK(success); | 93 DCHECK(success); |
| 92 DCHECK(dictionary_list_dictionary); | 94 DCHECK(dictionary_list_dictionary); |
| 93 | 95 |
| 94 return dictionary_list_dictionary; | 96 return dictionary_list_dictionary; |
| 95 } | 97 } |
| 96 | 98 |
| 97 // This function initializes a pref store with an empty version of the | 99 // This function initializes a pref store with an empty version of the |
| 98 // above schema, removing anything previously in the store under | 100 // above schema, removing anything previously in the store under |
| 99 // kPreferenceName. | 101 // kPreferenceName. |
| 100 void InitializePrefStore(WriteablePrefStore* store) { | 102 void InitializePrefStore(WriteablePrefStore* store) { |
| 101 base::DictionaryValue* empty_store(new base::DictionaryValue); | 103 scoped_ptr<base::DictionaryValue> empty_store(new base::DictionaryValue); |
| 102 empty_store->SetInteger(kVersionKey, kVersion); | 104 empty_store->SetInteger(kVersionKey, kVersion); |
| 103 empty_store->Set(kDictionariesKey, | 105 empty_store->Set(kDictionariesKey, |
| 104 make_scoped_ptr(new base::DictionaryValue)); | 106 make_scoped_ptr(new base::DictionaryValue)); |
| 105 store->SetValue(kPreferenceName, empty_store, | 107 store->SetValue(kPreferenceName, std::move(empty_store), |
| 106 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 108 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
| 107 } | 109 } |
| 108 | 110 |
| 109 // A class to allow iteration over all dictionaries in the pref store, and | 111 // A class to allow iteration over all dictionaries in the pref store, and |
| 110 // easy lookup of the information associated with those dictionaries. | 112 // easy lookup of the information associated with those dictionaries. |
| 111 // Note that this is an "Iterator" in the same sense (and for the same | 113 // Note that this is an "Iterator" in the same sense (and for the same |
| 112 // reasons) that base::Dictionary::Iterator is an iterator--it allows | 114 // reasons) that base::Dictionary::Iterator is an iterator--it allows |
| 113 // iterating over all the dictionaries in the preference store, but it | 115 // iterating over all the dictionaries in the preference store, but it |
| 114 // does not allow use as an STL iterator because the container it | 116 // does not allow use as an STL iterator because the container it |
| 115 // is iterating over does not export begin()/end() methods. This iterator can | 117 // is iterating over does not export begin()/end() methods. This iterator can |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 } | 777 } |
| 776 | 778 |
| 777 return true; | 779 return true; |
| 778 } | 780 } |
| 779 | 781 |
| 780 bool SdchOwner::IsPersistingDictionaries() const { | 782 bool SdchOwner::IsPersistingDictionaries() const { |
| 781 return in_memory_pref_store_.get() != nullptr; | 783 return in_memory_pref_store_.get() != nullptr; |
| 782 } | 784 } |
| 783 | 785 |
| 784 } // namespace net | 786 } // namespace net |
| OLD | NEW |