diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 20:16:50 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 20:16:50 +0000 |
commit | 76960a40e09420ac2e302f4b307c4dd0d8a61ce8 (patch) | |
tree | 8f6a5642af430f77528fd479eba63dfae42169d8 /chrome/common/property_bag.h | |
parent | 45cbfb0444d2ae27d9dbc9880c547c0d42978782 (diff) | |
download | chromium_src-76960a40e09420ac2e302f4b307c4dd0d8a61ce8.zip chromium_src-76960a40e09420ac2e302f4b307c4dd0d8a61ce8.tar.gz chromium_src-76960a40e09420ac2e302f4b307c4dd0d8a61ce8.tar.bz2 |
Add PropertyBag to TabContents. Convert the autocomplete state as a proof of concept. Add necessary const accessors to property bag.
BUG=5260
Review URL: http://codereview.chromium.org/13707
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6920 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/property_bag.h')
-rw-r--r-- | chrome/common/property_bag.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/common/property_bag.h b/chrome/common/property_bag.h index 9965382..d2f3559 100644 --- a/chrome/common/property_bag.h +++ b/chrome/common/property_bag.h @@ -77,6 +77,7 @@ class PropertyBag { // The returned pointer will be NULL if there is no match. Ownership of the // pointer will stay with the property bag. Prop* GetProperty(PropID id); + const Prop* GetProperty(PropID id) const; // Deletes the property with the given ID from the bag if it exists. void DeleteProperty(PropID id); @@ -107,6 +108,9 @@ class PropertyAccessorBase { PropertyBag::Prop* GetPropertyInternal(PropertyBag* bag) { return bag->GetProperty(prop_id_); } + const PropertyBag::Prop* GetPropertyInternal(const PropertyBag* bag) const { + return bag->GetProperty(prop_id_); + } private: // Identifier for this property. @@ -140,6 +144,12 @@ class PropertyAccessor : public PropertyAccessorBase { return NULL; return static_cast<Container*>(prop)->get(); } + const T* GetProperty(const PropertyBag* bag) const { + const PropertyBag::Prop* prop = GetPropertyInternal(bag); + if (!prop) + return NULL; + return static_cast<const Container*>(prop)->get(); + } // See also DeleteProperty on thn PropertyAccessorBase. @@ -149,6 +159,7 @@ class PropertyAccessor : public PropertyAccessorBase { Container(const T& data) : data_(data) {} T* get() { return &data_; } + const T* get() const { return &data_; } private: virtual Prop* copy() { |