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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/content_settings/content_settings_origin_identifier_value_map.h
diff --git a/chrome/browser/content_settings/content_settings_origin_identifier_value_map.h b/chrome/browser/content_settings/content_settings_origin_identifier_value_map.h
new file mode 100644
index 0000000000000000000000000000000000000000..598c5a3c93098036e8c659408424bb7dcdd3ee03
--- /dev/null
+++ b/chrome/browser/content_settings/content_settings_origin_identifier_value_map.h
@@ -0,0 +1,112 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_ORIGIN_IDENTIFIER_VALUE_MAP_H_
+#define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_ORIGIN_IDENTIFIER_VALUE_MAP_H_
+
+#include <list>
+#include <string>
+
+#include "base/tuple.h"
+#include "chrome/browser/content_settings/content_settings_pattern.h"
+#include "chrome/common/content_settings_types.h"
+
+class GURL;
+class Value;
+
+namespace content_settings {
+
+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
+ public:
+ typedef std::string ResourceIdentifier;
+
+ typedef Tuple5 <ContentSettingsPattern,
+ ContentSettingsPattern,
+ ContentSettingsType,
+ ResourceIdentifier,
+ Value*> Entry;
+
+ typedef std::list<Entry> EntryList;
+
+ typedef EntryList::const_iterator ConstIterator;
+
+ typedef EntryList::iterator Iterator;
+
+ 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
+ return entries_.begin();
+ }
+
+ EntryList::iterator End() {
+ return entries_.end();
+ }
+
+ EntryList::const_iterator Begin() const {
+ return entries_.begin();
+ }
+
+ EntryList::const_iterator End() const {
+ return entries_.end();
+ }
+
+ OriginIdentifierValueMap();
+ ~OriginIdentifierValueMap();
+
+ // Returns a weak pointer to the value for the given |item_pattern|,
+ // |top_level_frame_pattern|, |content_type|, |resource_identifier| tuple. If
+ // no value is stored for the passed parameter Null is returned.
+ Value* GetValue(
+ const GURL& item_url,
+ const GURL& top_level_frame_url,
+ ContentSettingsType content_type,
+ const ResourceIdentifier& resource_identifier) const;
+
+ // Sets the |value| for the given |item_pattern|, |top_level_frame_pattern|,
+ // |content_type|, |resource_identifier| tuple. The method takes the ownership
+ // of the passed |value|.
+ void SetValue(
+ const ContentSettingsPattern& item_pattern,
+ const ContentSettingsPattern& top_level_frame_pattern,
+ ContentSettingsType content_type,
+ const ResourceIdentifier& resource_identifier,
+ Value* value);
+
+ // Deletes the map entry for the given |item_pattern|,
+ // |top_level_frame_pattern|, |content_type|, |resource_identifier| tuple.
+ void DeleteValue(
+ const ContentSettingsPattern& item_pattern,
+ const ContentSettingsPattern& top_level_frame_pattern,
+ ContentSettingsType content_type,
+ const ResourceIdentifier& resource_identifier);
+
+ // TODO
+ EntryList::iterator DeleteValue(EntryList::iterator entry);
+
+ // TODO
+ void Clear();
+
+ private:
+ // Compares the content settings patterns of two list entries and returns the
+ // entry that contains the patterns with higher precedences.
+ EntryList::const_iterator ReturnEntryWithHighestPrecedence(
+ EntryList::const_iterator first,
+ EntryList::const_iterator second) const;
+
+ // Finds the list entry for the given |item_pattern|,
+ // |top_level_frame_pattern|, |content_type|, |resource_identifier| tuple and
+ // returns the iterator of the list entry. If no entry is found for the passed
+ // parameters then the end of list iterator is returned.
+ EntryList::iterator FindEntry(
+ const ContentSettingsPattern& item_pattern,
+ const ContentSettingsPattern& top_level_frame_pattern,
+ ContentSettingsType content_type,
+ const ResourceIdentifier& resource_identifier);
+
+ EntryList entries_;
+
+ DISALLOW_COPY_AND_ASSIGN(OriginIdentifierValueMap);
+};
+
+} // namespace content_settings
+
+#endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_ORIGIN_IDENTIFIER_VALUE_MAP_H_

Powered by Google App Engine
This is Rietveld 408576698