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

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/common/content_settings_types.h"
13 #include "chrome/browser/content_settings/content_settings_pattern.h"
jochen (gone - plz use gerrit) 2011/05/19 14:37:11 alphabetical ordering
markusheintz_ 2011/05/23 19:55:11 Done.
14
15 class GURL;
16 class Value;
17
18 namespace content_settings {
19
20 class OriginIdentifierValueMap {
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;
jochen (gone - plz use gerrit) 2011/05/19 14:37:11 move to private?
markusheintz_ 2011/05/23 19:55:11 Let's wait and see. I guess I'll need to expose so
31
32 // Returns a copy of the stored value for the given |item_pattern|,
33 // |top_level_frame_pattern|, |content_type|, |resource_identifier| tuple. If
34 // no value is stored for the passed parameter a null value is returned. The
35 // caller of this method takes the ownership of the returned value pointer.
36 Value* GetValue(
37 const GURL& item_url,
38 const GURL& top_level_frame_url,
39 ContentSettingsType content_type,
40 const ResourceIdentifier& resource_identifier) const;
41
42 // Sets the |value| for the given |item_pattern|, |top_level_frame_pattern|,
43 // |content_type|, |resource_identifier| tuple. The method takes the ownership
44 // of the passed |value|.
45 void SetValue(
46 const ContentSettingsPattern& item_pattern,
47 const ContentSettingsPattern& top_level_frame_pattern,
48 ContentSettingsType content_type,
49 const ResourceIdentifier& resource_identifier,
50 Value* value);
51
52 // Deletes the map entry for the given |item_pattern|,
53 // |top_level_frame_pattern|, |content_type|, |resource_identifier| tuple.
54 void DeleteValue(
55 const ContentSettingsPattern& item_pattern,
56 const ContentSettingsPattern& top_level_frame_pattern,
57 ContentSettingsType content_type,
58 const ResourceIdentifier& resource_identifier);
59
60 private:
61 // Compares the content settings patterns of two list entries and returns the
62 // entry that contains the patterns with higher precedences.
63 EntryList::const_iterator HighestPrecedence(
jochen (gone - plz use gerrit) 2011/05/19 14:37:11 maybe ReturnPatternWithHighestPrecedence? functio
Bernhard Bauer 2011/05/19 15:05:17 GetPatternWithHighestPrecedence?
markusheintz_ 2011/05/23 19:55:11 I chose ReturnEntryWithHighestPrecedence because a
Bernhard Bauer 2011/05/24 14:21:29 ok, but we usually don't put "return" into method
markusheintz_ 2011/05/26 13:22:13 Return -> Get
64 EntryList::const_iterator first,
65 EntryList::const_iterator second) const;
66
67 // Finds the list entry for the given |item_pattern|,
68 // |top_level_frame_pattern|, |content_type|, |resource_identifier| tuple and
69 // returns the iterator of the list entry. If no entry is found for the passed
70 // parameters then the end of list iterator is returned.
71 EntryList::iterator FindEntry(
72 const ContentSettingsPattern& item_pattern,
73 const ContentSettingsPattern& top_level_frame_pattern,
74 ContentSettingsType content_type,
75 const ResourceIdentifier& resource_identifier);
76
77 EntryList entries_;
78 };
jochen (gone - plz use gerrit) 2011/05/19 14:37:11 DISALLOW COPY AND ASSIGN?
markusheintz_ 2011/05/23 19:55:11 Done.
79
80 } // namespace content_settings
81
82 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_ORIGIN_IDENTIFIER_VA LUE_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698