Chromium Code Reviews| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 10 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 Profile* profile) = 0; | 42 Profile* profile) = 0; |
| 43 | 43 |
| 44 // Whether the animation should be run for the given |web_contents|. | 44 // Whether the animation should be run for the given |web_contents|. |
| 45 virtual bool ShouldRunAnimation(content::WebContents* web_contents) = 0; | 45 virtual bool ShouldRunAnimation(content::WebContents* web_contents) = 0; |
| 46 | 46 |
| 47 // Remembers that the animation has already run for the given |web_contents|, | 47 // Remembers that the animation has already run for the given |web_contents|, |
| 48 // so that we do not restart it when the parent view is updated. | 48 // so that we do not restart it when the parent view is updated. |
| 49 virtual void SetAnimationHasRun(content::WebContents* web_contents) = 0; | 49 virtual void SetAnimationHasRun(content::WebContents* web_contents) = 0; |
| 50 | 50 |
| 51 bool is_visible() const { return is_visible_; } | 51 bool is_visible() const { return is_visible_; } |
| 52 #if defined(OS_MACOSX) | 52 |
|
Evan Stade
2015/12/07 20:01:28
can we leave this one? I don't want people using i
tapted
2015/12/08 01:50:10
Ah good idea :). Done.
| |
| 53 const gfx::Image& icon() const { return icon_; } | 53 const gfx::Image& raster_icon() const { return raster_icon_; } |
| 54 int icon_id() const { return icon_id_; } | 54 int raster_icon_id() const { return raster_icon_id_; } |
| 55 #else | 55 |
| 56 gfx::Image GetIcon(SkColor nearby_text_color) const; | 56 gfx::Image GetIcon(SkColor nearby_text_color) const; |
| 57 #endif | 57 |
| 58 // Returns the resource ID of a string to show when the icon appears, or 0 if | 58 // Returns the resource ID of a string to show when the icon appears, or 0 if |
| 59 // we don't wish to show anything. | 59 // we don't wish to show anything. |
| 60 int explanatory_string_id() const { return explanatory_string_id_; } | 60 int explanatory_string_id() const { return explanatory_string_id_; } |
| 61 const base::string16& get_tooltip() const { return tooltip_; } | 61 const base::string16& get_tooltip() const { return tooltip_; } |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 ContentSettingImageModel(); | 64 ContentSettingImageModel(); |
| 65 void SetIconByResourceId(int id); | 65 void SetIconByResourceId(int id); |
| 66 #if !defined(OS_MACOSX) | 66 |
| 67 void set_icon_by_vector_id(gfx::VectorIconId id, gfx::VectorIconId badge_id) { | 67 void set_icon_by_vector_id(gfx::VectorIconId id, gfx::VectorIconId badge_id) { |
| 68 vector_icon_id_ = id; | 68 vector_icon_id_ = id; |
| 69 vector_icon_badge_id_ = badge_id; | 69 vector_icon_badge_id_ = badge_id; |
| 70 } | 70 } |
| 71 #endif | 71 |
| 72 void set_visible(bool visible) { is_visible_ = visible; } | 72 void set_visible(bool visible) { is_visible_ = visible; } |
| 73 void set_icon(const gfx::Image& image) { icon_ = image; } | |
| 74 void set_explanatory_string_id(int text_id) { | 73 void set_explanatory_string_id(int text_id) { |
| 75 explanatory_string_id_ = text_id; | 74 explanatory_string_id_ = text_id; |
| 76 } | 75 } |
| 77 void set_tooltip(const base::string16& tooltip) { tooltip_ = tooltip; } | 76 void set_tooltip(const base::string16& tooltip) { tooltip_ = tooltip; } |
| 78 | 77 |
| 79 private: | 78 private: |
| 80 bool is_visible_; | 79 bool is_visible_; |
| 81 // |icon_id_| and |icon_| are only used for pre-MD. | 80 |
| 82 int icon_id_; | 81 // |raster_icon_id_| and |raster_icon_| are only used for pre-MD. |
| 83 gfx::Image icon_; | 82 int raster_icon_id_; |
| 83 gfx::Image raster_icon_; | |
| 84 | |
| 84 // Vector icons are used for MD. | 85 // Vector icons are used for MD. |
| 85 gfx::VectorIconId vector_icon_id_; | 86 gfx::VectorIconId vector_icon_id_; |
| 86 gfx::VectorIconId vector_icon_badge_id_; | 87 gfx::VectorIconId vector_icon_badge_id_; |
| 87 int explanatory_string_id_; | 88 int explanatory_string_id_; |
| 88 base::string16 tooltip_; | 89 base::string16 tooltip_; |
| 89 | 90 |
| 90 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageModel); | 91 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageModel); |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 // A subclass for an image model tied to a single content type. | 94 // A subclass for an image model tied to a single content type. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 110 protected: | 111 protected: |
| 111 ContentSettingsType content_type() { return content_type_; } | 112 ContentSettingsType content_type() { return content_type_; } |
| 112 | 113 |
| 113 private: | 114 private: |
| 114 ContentSettingsType content_type_; | 115 ContentSettingsType content_type_; |
| 115 | 116 |
| 116 DISALLOW_COPY_AND_ASSIGN(ContentSettingSimpleImageModel); | 117 DISALLOW_COPY_AND_ASSIGN(ContentSettingSimpleImageModel); |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_ | 120 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_ |
| OLD | NEW |