Chromium Code Reviews| 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..3b5c075284436373384e69176ec2e51c0c8d522c |
| --- /dev/null |
| +++ b/chrome/browser/content_settings/content_settings_origin_identifier_value_map.h |
| @@ -0,0 +1,82 @@ |
| +// 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/common/content_settings_types.h" |
| +#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.
|
| + |
| +class GURL; |
| +class Value; |
| + |
| +namespace content_settings { |
| + |
| +class OriginIdentifierValueMap { |
| + public: |
| + typedef std::string ResourceIdentifier; |
| + |
| + typedef Tuple5 <ContentSettingsPattern, |
| + ContentSettingsPattern, |
| + ContentSettingsType, |
| + ResourceIdentifier, |
| + Value*> Entry; |
| + |
| + 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
|
| + |
| + // Returns a copy of the stored value for the given |item_pattern|, |
| + // |top_level_frame_pattern|, |content_type|, |resource_identifier| tuple. If |
| + // no value is stored for the passed parameter a null value is returned. The |
| + // caller of this method takes the ownership of the returned value pointer. |
| + 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); |
| + |
| + private: |
| + // Compares the content settings patterns of two list entries and returns the |
| + // entry that contains the patterns with higher precedences. |
| + 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
|
| + 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_; |
| +}; |
|
jochen (gone - plz use gerrit)
2011/05/19 14:37:11
DISALLOW COPY AND ASSIGN?
markusheintz_
2011/05/23 19:55:11
Done.
|
| + |
| +} // namespace content_settings |
| + |
| +#endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_ORIGIN_IDENTIFIER_VALUE_MAP_H_ |