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

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

Issue 7049007: Origin Identifier Value Map. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_ORIGIN_IDENTIFIER_VALUE _MAP_H_
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_ORIGIN_IDENTIFIER_VALUE _MAP_H_
7
8 #include <list>
9 #include <string>
10
11 #include "base/tuple.h"
12 #include "chrome/browser/content_settings/content_settings_pattern.h"
13 #include "chrome/common/content_settings_types.h"
14
15 class GURL;
16 class Value;
17
18 namespace content_settings {
19
20 class OriginIdentifierValueMap {
Bernhard Bauer 2011/05/24 14:21:29 Nit: I think "OriginValueMap" would roll easier of
markusheintz_ 2011/05/26 13:22:13 I'd like to emphasis that there is a second key; w
21 public:
22 typedef std::string ResourceIdentifier;
23
24 typedef Tuple5 <ContentSettingsPattern,
25 ContentSettingsPattern,
26 ContentSettingsType,
27 ResourceIdentifier,
28 Value*> Entry;
29
30 typedef std::list<Entry> EntryList;
31
32 typedef EntryList::const_iterator ConstIterator;
33
34 typedef EntryList::iterator Iterator;
35
36 EntryList::iterator Begin() {
Bernhard Bauer 2011/05/24 14:21:29 use lower case?
markusheintz_ 2011/05/26 13:22:13 Done. Also change end and the names used in the ty
37 return entries_.begin();
38 }
39
40 EntryList::iterator End() {
41 return entries_.end();
42 }
43
44 EntryList::const_iterator Begin() const {
45 return entries_.begin();
46 }
47
48 EntryList::const_iterator End() const {
49 return entries_.end();
50 }
51
52 OriginIdentifierValueMap();
53 ~OriginIdentifierValueMap();
54
55 // Returns a weak pointer to the value for the given |item_pattern|,
56 // |top_level_frame_pattern|, |content_type|, |resource_identifier| tuple. If
57 // no value is stored for the passed parameter Null is returned.
58 Value* GetValue(
59 const GURL& item_url,
60 const GURL& top_level_frame_url,
61 ContentSettingsType content_type,
62 const ResourceIdentifier& resource_identifier) const;
63
64 // Sets the |value| for the given |item_pattern|, |top_level_frame_pattern|,
65 // |content_type|, |resource_identifier| tuple. The method takes the ownership
66 // of the passed |value|.
67 void SetValue(
68 const ContentSettingsPattern& item_pattern,
69 const ContentSettingsPattern& top_level_frame_pattern,
70 ContentSettingsType content_type,
71 const ResourceIdentifier& resource_identifier,
72 Value* value);
73
74 // Deletes the map entry for the given |item_pattern|,
75 // |top_level_frame_pattern|, |content_type|, |resource_identifier| tuple.
76 void DeleteValue(
77 const ContentSettingsPattern& item_pattern,
78 const ContentSettingsPattern& top_level_frame_pattern,
79 ContentSettingsType content_type,
80 const ResourceIdentifier& resource_identifier);
81
82 // TODO
83 EntryList::iterator DeleteValue(EntryList::iterator entry);
84
85 // TODO
86 void Clear();
87
88 private:
89 // Compares the content settings patterns of two list entries and returns the
90 // entry that contains the patterns with higher precedences.
91 EntryList::const_iterator ReturnEntryWithHighestPrecedence(
92 EntryList::const_iterator first,
93 EntryList::const_iterator second) const;
94
95 // Finds the list entry for the given |item_pattern|,
96 // |top_level_frame_pattern|, |content_type|, |resource_identifier| tuple and
97 // returns the iterator of the list entry. If no entry is found for the passed
98 // parameters then the end of list iterator is returned.
99 EntryList::iterator FindEntry(
100 const ContentSettingsPattern& item_pattern,
101 const ContentSettingsPattern& top_level_frame_pattern,
102 ContentSettingsType content_type,
103 const ResourceIdentifier& resource_identifier);
104
105 EntryList entries_;
106
107 DISALLOW_COPY_AND_ASSIGN(OriginIdentifierValueMap);
108 };
109
110 } // namespace content_settings
111
112 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_ORIGIN_IDENTIFIER_VA LUE_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698