summaryrefslogtreecommitdiffstats
path: root/chrome/browser/content_setting_image_model.h
diff options
context:
space:
mode:
authorbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 11:40:08 +0000
committerbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 11:40:08 +0000
commit352104ee28f47810b5d2dc5fd6193c60d2cd2e95 (patch)
tree1d4d26928b9951a3d5f54688c550835740849837 /chrome/browser/content_setting_image_model.h
parentff039f0833a278d7ca80aeb8987e73b6c258f305 (diff)
downloadchromium_src-352104ee28f47810b5d2dc5fd6193c60d2cd2e95.zip
chromium_src-352104ee28f47810b5d2dc5fd6193c60d2cd2e95.tar.gz
chromium_src-352104ee28f47810b5d2dc5fd6193c60d2cd2e95.tar.bz2
Renames ContentBlockedImageView to ContentSettingImageView.
Adds ContentSettingImageModel to provide icon and tooltips for platform-specific ContentBlockedImageView. (in preparation for: http://codereview.chromium.org/650180/show ) TEST=chrome/browser/content_setting_image_model_unittest.cc Review URL: http://codereview.chromium.org/660279 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/content_setting_image_model.h')
-rw-r--r--chrome/browser/content_setting_image_model.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/chrome/browser/content_setting_image_model.h b/chrome/browser/content_setting_image_model.h
new file mode 100644
index 0000000..f5d5a66
--- /dev/null
+++ b/chrome/browser/content_setting_image_model.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2010 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_SETTING_IMAGE_MODEL_H_
+#define CHROME_BROWSER_CONTENT_SETTING_IMAGE_MODEL_H_
+
+#include <string>
+
+#include "chrome/common/content_settings_types.h"
+
+class TabContents;
+
+// This model provides data (icon ids and tooltip) for the content setting icons
+// that are displayed in the location bar.
+class ContentSettingImageModel {
+ public:
+ // Factory function.
+ static ContentSettingImageModel* CreateContentSettingImageModel(
+ ContentSettingsType content_settings_type);
+
+ // Notifies this model that its setting might have changed and it may need to
+ // update its visibility, icon and tooltip.
+ virtual void UpdateFromTabContents(const TabContents* tab_contents) = 0;
+
+ ContentSettingsType get_content_settings_type() const {
+ return content_settings_type_;
+ }
+ bool is_visible() const { return is_visible_; }
+ int get_icon() const { return icon_; }
+ std::string get_tooltip() const { return tooltip_; }
+
+ protected:
+ explicit ContentSettingImageModel(ContentSettingsType content_settings_type);
+ void set_visible(bool visible) { is_visible_ = visible; }
+ void set_icon(int icon) { icon_ = icon; }
+ void set_tooltip(const std::string& tooltip) { tooltip_ = tooltip; }
+
+ private:
+ const ContentSettingsType content_settings_type_;
+ bool is_visible_;
+ int icon_;
+ std::string tooltip_;
+};
+
+#endif // CHROME_BROWSER_CONTENT_SETTING_IMAGE_MODEL_H_