Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_image_model.h

Issue 1482183002: Fix content_setting_image_view compile on mac_views_browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hide raster icons on non-Mac Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
52 #if defined(OS_MACOSX) 53 #if defined(OS_MACOSX)
53 const gfx::Image& icon() const { return icon_; } 54 const gfx::Image& raster_icon() const { return raster_icon_; }
54 int icon_id() const { return icon_id_; } 55 int raster_icon_id() const { return raster_icon_id_; }
55 #else 56 #endif
57
56 gfx::Image GetIcon(SkColor nearby_text_color) const; 58 gfx::Image GetIcon(SkColor nearby_text_color) const;
57 #endif 59
58 // Returns the resource ID of a string to show when the icon appears, or 0 if 60 // Returns the resource ID of a string to show when the icon appears, or 0 if
59 // we don't wish to show anything. 61 // we don't wish to show anything.
60 int explanatory_string_id() const { return explanatory_string_id_; } 62 int explanatory_string_id() const { return explanatory_string_id_; }
61 const base::string16& get_tooltip() const { return tooltip_; } 63 const base::string16& get_tooltip() const { return tooltip_; }
62 64
63 protected: 65 protected:
64 ContentSettingImageModel(); 66 ContentSettingImageModel();
65 void SetIconByResourceId(int id); 67 void SetIconByResourceId(int id);
66 #if !defined(OS_MACOSX) 68
67 void set_icon_by_vector_id(gfx::VectorIconId id, gfx::VectorIconId badge_id) { 69 void set_icon_by_vector_id(gfx::VectorIconId id, gfx::VectorIconId badge_id) {
68 vector_icon_id_ = id; 70 vector_icon_id_ = id;
69 vector_icon_badge_id_ = badge_id; 71 vector_icon_badge_id_ = badge_id;
70 } 72 }
71 #endif 73
72 void set_visible(bool visible) { is_visible_ = visible; } 74 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) { 75 void set_explanatory_string_id(int text_id) {
75 explanatory_string_id_ = text_id; 76 explanatory_string_id_ = text_id;
76 } 77 }
77 void set_tooltip(const base::string16& tooltip) { tooltip_ = tooltip; } 78 void set_tooltip(const base::string16& tooltip) { tooltip_ = tooltip; }
78 79
79 private: 80 private:
80 bool is_visible_; 81 bool is_visible_;
81 // |icon_id_| and |icon_| are only used for pre-MD. 82
82 int icon_id_; 83 // |raster_icon_id_| and |raster_icon_| are only used for pre-MD.
83 gfx::Image icon_; 84 int raster_icon_id_;
85 gfx::Image raster_icon_;
86
84 // Vector icons are used for MD. 87 // Vector icons are used for MD.
85 gfx::VectorIconId vector_icon_id_; 88 gfx::VectorIconId vector_icon_id_;
86 gfx::VectorIconId vector_icon_badge_id_; 89 gfx::VectorIconId vector_icon_badge_id_;
87 int explanatory_string_id_; 90 int explanatory_string_id_;
88 base::string16 tooltip_; 91 base::string16 tooltip_;
89 92
90 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageModel); 93 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageModel);
91 }; 94 };
92 95
93 // A subclass for an image model tied to a single content type. 96 // A subclass for an image model tied to a single content type.
(...skipping 16 matching lines...) Expand all
110 protected: 113 protected:
111 ContentSettingsType content_type() { return content_type_; } 114 ContentSettingsType content_type() { return content_type_; }
112 115
113 private: 116 private:
114 ContentSettingsType content_type_; 117 ContentSettingsType content_type_;
115 118
116 DISALLOW_COPY_AND_ASSIGN(ContentSettingSimpleImageModel); 119 DISALLOW_COPY_AND_ASSIGN(ContentSettingSimpleImageModel);
117 }; 120 };
118 121
119 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_ 122 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698