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

Side by Side Diff: chrome/browser/content_settings/content_settings_origin_identifier_value_map.cc

Issue 106433007: Update some uses of Value in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years 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) 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/content_settings/content_settings_origin_identifier_val ue_map.h" 5 #include "chrome/browser/content_settings/content_settings_origin_identifier_val ue_map.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 EntryMap::const_iterator it; 113 EntryMap::const_iterator it;
114 for (it = entries_.begin(); it != entries_.end(); ++it) 114 for (it = entries_.begin(); it != entries_.end(); ++it)
115 size += it->second.size(); 115 size += it->second.size();
116 return size; 116 return size;
117 } 117 }
118 118
119 OriginIdentifierValueMap::OriginIdentifierValueMap() {} 119 OriginIdentifierValueMap::OriginIdentifierValueMap() {}
120 120
121 OriginIdentifierValueMap::~OriginIdentifierValueMap() {} 121 OriginIdentifierValueMap::~OriginIdentifierValueMap() {}
122 122
123 Value* OriginIdentifierValueMap::GetValue( 123 base::Value* OriginIdentifierValueMap::GetValue(
124 const GURL& primary_url, 124 const GURL& primary_url,
125 const GURL& secondary_url, 125 const GURL& secondary_url,
126 ContentSettingsType content_type, 126 ContentSettingsType content_type,
127 const ResourceIdentifier& resource_identifier) const { 127 const ResourceIdentifier& resource_identifier) const {
128 EntryMapKey key(content_type, resource_identifier); 128 EntryMapKey key(content_type, resource_identifier);
129 EntryMap::const_iterator it = entries_.find(key); 129 EntryMap::const_iterator it = entries_.find(key);
130 if (it == entries_.end()) 130 if (it == entries_.end())
131 return NULL; 131 return NULL;
132 132
133 // Iterate the entries in until a match is found. Since the rules are stored 133 // Iterate the entries in until a match is found. Since the rules are stored
134 // in the order of decreasing precedence, the most specific match is found 134 // in the order of decreasing precedence, the most specific match is found
135 // first. 135 // first.
136 Rules::const_iterator entry; 136 Rules::const_iterator entry;
137 for (entry = it->second.begin(); entry != it->second.end(); ++entry) { 137 for (entry = it->second.begin(); entry != it->second.end(); ++entry) {
138 if (entry->first.primary_pattern.Matches(primary_url) && 138 if (entry->first.primary_pattern.Matches(primary_url) &&
139 entry->first.secondary_pattern.Matches(secondary_url)) { 139 entry->first.secondary_pattern.Matches(secondary_url)) {
140 return entry->second.get(); 140 return entry->second.get();
141 } 141 }
142 } 142 }
143 return NULL; 143 return NULL;
144 } 144 }
145 145
146 void OriginIdentifierValueMap::SetValue( 146 void OriginIdentifierValueMap::SetValue(
147 const ContentSettingsPattern& primary_pattern, 147 const ContentSettingsPattern& primary_pattern,
148 const ContentSettingsPattern& secondary_pattern, 148 const ContentSettingsPattern& secondary_pattern,
149 ContentSettingsType content_type, 149 ContentSettingsType content_type,
150 const ResourceIdentifier& resource_identifier, 150 const ResourceIdentifier& resource_identifier,
151 Value* value) { 151 base::Value* value) {
152 DCHECK(primary_pattern.IsValid()); 152 DCHECK(primary_pattern.IsValid());
153 DCHECK(secondary_pattern.IsValid()); 153 DCHECK(secondary_pattern.IsValid());
154 DCHECK(value); 154 DCHECK(value);
155 EntryMapKey key(content_type, resource_identifier); 155 EntryMapKey key(content_type, resource_identifier);
156 PatternPair patterns(primary_pattern, secondary_pattern); 156 PatternPair patterns(primary_pattern, secondary_pattern);
157 // This will create the entry and the linked_ptr if needed. 157 // This will create the entry and the linked_ptr if needed.
158 entries_[key][patterns].reset(value); 158 entries_[key][patterns].reset(value);
159 } 159 }
160 160
161 void OriginIdentifierValueMap::DeleteValue( 161 void OriginIdentifierValueMap::DeleteValue(
(...skipping 15 matching lines...) Expand all
177 EntryMapKey key(content_type, resource_identifier); 177 EntryMapKey key(content_type, resource_identifier);
178 entries_.erase(key); 178 entries_.erase(key);
179 } 179 }
180 180
181 void OriginIdentifierValueMap::clear() { 181 void OriginIdentifierValueMap::clear() {
182 // Delete all owned value objects. 182 // Delete all owned value objects.
183 entries_.clear(); 183 entries_.clear();
184 } 184 }
185 185
186 } // namespace content_settings 186 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698