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

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

Issue 6854035: Move blocked content from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CONTENT_SETTING_IMAGE_MODEL_H_
6 #define CHROME_BROWSER_CONTENT_SETTING_IMAGE_MODEL_H_
7 #pragma once
8
9 #include <string>
10
11 #include "chrome/common/content_settings_types.h"
12
13 class TabContents;
14
15 // This model provides data (icon ids and tooltip) for the content setting icons
16 // that are displayed in the location bar.
17 class ContentSettingImageModel {
18 public:
19 virtual ~ContentSettingImageModel() {}
20
21 // Factory function.
22 static ContentSettingImageModel* CreateContentSettingImageModel(
23 ContentSettingsType content_settings_type);
24
25 // Notifies this model that its setting might have changed and it may need to
26 // update its visibility, icon and tooltip.
27 virtual void UpdateFromTabContents(TabContents* tab_contents) = 0;
28
29 ContentSettingsType get_content_settings_type() const {
30 return content_settings_type_;
31 }
32 bool is_visible() const { return is_visible_; }
33 int get_icon() const { return icon_; }
34 // Returns the resource ID of a string to show when the icon appears, or 0 if
35 // we don't wish to show anything.
36 int explanatory_string_id() const { return explanatory_string_id_; }
37 std::string get_tooltip() const { return tooltip_; }
38
39 protected:
40 explicit ContentSettingImageModel(ContentSettingsType content_settings_type);
41 void set_visible(bool visible) { is_visible_ = visible; }
42 void set_icon(int icon) { icon_ = icon; }
43 void set_explanatory_string_id(int text_id) {
44 explanatory_string_id_ = text_id;
45 }
46 void set_tooltip(const std::string& tooltip) { tooltip_ = tooltip; }
47
48 private:
49 const ContentSettingsType content_settings_type_;
50 bool is_visible_;
51 int icon_;
52 int explanatory_string_id_;
53 std::string tooltip_;
54 };
55
56 #endif // CHROME_BROWSER_CONTENT_SETTING_IMAGE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698