OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_ |
6 #define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_ | 6 #define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 content::WebContents* web_contents); | 57 content::WebContents* web_contents); |
58 #endif | 58 #endif |
59 | 59 |
60 gfx::Image GetIcon(SkColor nearby_text_color) const; | 60 gfx::Image GetIcon(SkColor nearby_text_color) const; |
61 | 61 |
62 // Returns the resource ID of a string to show when the icon appears, or 0 if | 62 // Returns the resource ID of a string to show when the icon appears, or 0 if |
63 // we don't wish to show anything. | 63 // we don't wish to show anything. |
64 int explanatory_string_id() const { return explanatory_string_id_; } | 64 int explanatory_string_id() const { return explanatory_string_id_; } |
65 const base::string16& get_tooltip() const { return tooltip_; } | 65 const base::string16& get_tooltip() const { return tooltip_; } |
66 | 66 |
67 // For testing only. If this image model has a content type, it is returned | |
68 // here. Otherwise, CONTENT_SETTINGS_TYPE_DEFAULT is returned. | |
69 virtual ContentSettingsType GetContentType(); | |
tapted
2017/02/03 23:07:02
This still violates https://chromium.googlesource.
| |
70 | |
67 protected: | 71 protected: |
68 ContentSettingImageModel(); | 72 ContentSettingImageModel(); |
69 | 73 |
70 void set_icon_by_vector_id(gfx::VectorIconId id, gfx::VectorIconId badge_id) { | 74 void set_icon_by_vector_id(gfx::VectorIconId id, gfx::VectorIconId badge_id) { |
71 icon_id_ = id; | 75 icon_id_ = id; |
72 icon_badge_id_ = badge_id; | 76 icon_badge_id_ = badge_id; |
73 } | 77 } |
74 | 78 |
75 void set_visible(bool visible) { is_visible_ = visible; } | 79 void set_visible(bool visible) { is_visible_ = visible; } |
76 void set_explanatory_string_id(int text_id) { | 80 void set_explanatory_string_id(int text_id) { |
(...skipping 18 matching lines...) Expand all Loading... | |
95 explicit ContentSettingSimpleImageModel(ContentSettingsType content_type); | 99 explicit ContentSettingSimpleImageModel(ContentSettingsType content_type); |
96 | 100 |
97 // ContentSettingImageModel implementation. | 101 // ContentSettingImageModel implementation. |
98 ContentSettingBubbleModel* CreateBubbleModel( | 102 ContentSettingBubbleModel* CreateBubbleModel( |
99 ContentSettingBubbleModel::Delegate* delegate, | 103 ContentSettingBubbleModel::Delegate* delegate, |
100 content::WebContents* web_contents, | 104 content::WebContents* web_contents, |
101 Profile* profile) override; | 105 Profile* profile) override; |
102 bool ShouldRunAnimation(content::WebContents* web_contents) override; | 106 bool ShouldRunAnimation(content::WebContents* web_contents) override; |
103 void SetAnimationHasRun(content::WebContents* web_contents) override; | 107 void SetAnimationHasRun(content::WebContents* web_contents) override; |
104 | 108 |
109 ContentSettingsType GetContentType() override; | |
110 | |
105 // Factory method. Used only for testing. | 111 // Factory method. Used only for testing. |
106 static std::unique_ptr<ContentSettingImageModel> | 112 static std::unique_ptr<ContentSettingImageModel> |
107 CreateForContentTypeForTesting(ContentSettingsType content_type); | 113 CreateForContentTypeForTesting(ContentSettingsType content_type); |
108 | 114 |
109 protected: | |
110 ContentSettingsType content_type() { return content_type_; } | |
111 | |
112 private: | 115 private: |
113 ContentSettingsType content_type_; | 116 ContentSettingsType content_type_; |
114 | 117 |
115 DISALLOW_COPY_AND_ASSIGN(ContentSettingSimpleImageModel); | 118 DISALLOW_COPY_AND_ASSIGN(ContentSettingSimpleImageModel); |
116 }; | 119 }; |
117 | 120 |
118 // Image model for subresource filter icons in the location bar. | 121 // Image model for subresource filter icons in the location bar. |
119 class ContentSettingSubresourceFilterImageModel | 122 class ContentSettingSubresourceFilterImageModel |
120 : public ContentSettingImageModel { | 123 : public ContentSettingImageModel { |
121 public: | 124 public: |
122 ContentSettingSubresourceFilterImageModel(); | 125 ContentSettingSubresourceFilterImageModel(); |
123 | 126 |
124 void UpdateFromWebContents(content::WebContents* web_contents) override; | 127 void UpdateFromWebContents(content::WebContents* web_contents) override; |
125 | 128 |
126 ContentSettingBubbleModel* CreateBubbleModel( | 129 ContentSettingBubbleModel* CreateBubbleModel( |
127 ContentSettingBubbleModel::Delegate* delegate, | 130 ContentSettingBubbleModel::Delegate* delegate, |
128 content::WebContents* web_contents, | 131 content::WebContents* web_contents, |
129 Profile* profile) override; | 132 Profile* profile) override; |
130 | 133 |
131 bool ShouldRunAnimation(content::WebContents* web_contents) override; | 134 bool ShouldRunAnimation(content::WebContents* web_contents) override; |
132 void SetAnimationHasRun(content::WebContents* web_contents) override; | 135 void SetAnimationHasRun(content::WebContents* web_contents) override; |
133 | 136 |
134 private: | 137 private: |
135 DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterImageModel); | 138 DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterImageModel); |
136 }; | 139 }; |
137 | 140 |
138 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_ | 141 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_ |
OLD | NEW |