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

Side by Side Diff: components/content_settings/core/browser/content_settings_pref.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/content_settings/core/browser/content_settings_pref.h" 5 #include "components/content_settings/core/browser/content_settings_pref.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 bool found = pattern_pairs_settings->GetDictionaryWithoutPathExpansion( 202 bool found = pattern_pairs_settings->GetDictionaryWithoutPathExpansion(
203 pattern_str, &settings_dictionary); 203 pattern_str, &settings_dictionary);
204 204
205 if (!found) { 205 if (!found) {
206 settings_dictionary = new base::DictionaryValue; 206 settings_dictionary = new base::DictionaryValue;
207 pattern_pairs_settings->SetWithoutPathExpansion(pattern_str, 207 pattern_pairs_settings->SetWithoutPathExpansion(pattern_str,
208 settings_dictionary); 208 settings_dictionary);
209 } 209 }
210 210
211 settings_dictionary->SetWithoutPathExpansion( 211 settings_dictionary->SetWithoutPathExpansion(
212 kLastUsed, new base::FundamentalValue(clock->Now().ToDoubleT())); 212 kLastUsed, new base::Value(clock->Now().ToDoubleT()));
213 } 213 }
214 } 214 }
215 215
216 base::Time ContentSettingsPref::GetLastUsage( 216 base::Time ContentSettingsPref::GetLastUsage(
217 const ContentSettingsPattern& primary_pattern, 217 const ContentSettingsPattern& primary_pattern,
218 const ContentSettingsPattern& secondary_pattern) { 218 const ContentSettingsPattern& secondary_pattern) {
219 const base::DictionaryValue* pattern_pairs_settings = 219 const base::DictionaryValue* pattern_pairs_settings =
220 prefs_->GetDictionary(pref_name_); 220 prefs_->GetDictionary(pref_name_);
221 std::string pattern_str( 221 std::string pattern_str(
222 CreatePatternString(primary_pattern, secondary_pattern)); 222 CreatePatternString(primary_pattern, secondary_pattern));
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 kPerResourceIdentifierPrefName, &resource_dictionary)) { 308 kPerResourceIdentifierPrefName, &resource_dictionary)) {
309 for (base::DictionaryValue::Iterator j(*resource_dictionary); 309 for (base::DictionaryValue::Iterator j(*resource_dictionary);
310 !j.IsAtEnd(); 310 !j.IsAtEnd();
311 j.Advance()) { 311 j.Advance()) {
312 const std::string& resource_identifier(j.key()); 312 const std::string& resource_identifier(j.key());
313 int setting = CONTENT_SETTING_DEFAULT; 313 int setting = CONTENT_SETTING_DEFAULT;
314 bool is_integer = j.value().GetAsInteger(&setting); 314 bool is_integer = j.value().GetAsInteger(&setting);
315 DCHECK(is_integer); 315 DCHECK(is_integer);
316 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); 316 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting);
317 std::unique_ptr<base::Value> setting_ptr( 317 std::unique_ptr<base::Value> setting_ptr(
318 new base::FundamentalValue(setting)); 318 new base::Value(setting));
319 value_map_.SetValue(pattern_pair.first, 319 value_map_.SetValue(pattern_pair.first,
320 pattern_pair.second, 320 pattern_pair.second,
321 content_type_, 321 content_type_,
322 resource_identifier, 322 resource_identifier,
323 setting_ptr->DeepCopy()); 323 setting_ptr->DeepCopy());
324 } 324 }
325 } 325 }
326 } 326 }
327 327
328 const base::Value* value = nullptr; 328 const base::Value* value = nullptr;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 509
510 void ContentSettingsPref::AssertLockNotHeld() const { 510 void ContentSettingsPref::AssertLockNotHeld() const {
511 #if !defined(NDEBUG) 511 #if !defined(NDEBUG)
512 // |Lock::Acquire()| will assert if the lock is held by this thread. 512 // |Lock::Acquire()| will assert if the lock is held by this thread.
513 lock_.Acquire(); 513 lock_.Acquire();
514 lock_.Release(); 514 lock_.Release();
515 #endif 515 #endif
516 } 516 }
517 517
518 } // namespace content_settings 518 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698