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

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

Issue 2815042: Add notifications content settings type. (Closed)
Patch Set: '' Created 10 years, 5 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/content_setting_image_model.h" 5 #include "chrome/browser/content_setting_image_model.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "chrome/browser/tab_contents/tab_contents.h" 8 #include "chrome/browser/tab_contents/tab_contents.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "grit/theme_resources.h" 10 #include "grit/theme_resources.h"
(...skipping 10 matching lines...) Expand all
21 static const int kTooltipIDs[]; 21 static const int kTooltipIDs[];
22 }; 22 };
23 23
24 class ContentSettingGeolocationImageModel : public ContentSettingImageModel { 24 class ContentSettingGeolocationImageModel : public ContentSettingImageModel {
25 public: 25 public:
26 ContentSettingGeolocationImageModel(); 26 ContentSettingGeolocationImageModel();
27 27
28 virtual void UpdateFromTabContents(const TabContents* tab_contents); 28 virtual void UpdateFromTabContents(const TabContents* tab_contents);
29 }; 29 };
30 30
31 class ContentSettingNotificationsImageModel : public ContentSettingImageModel {
32 public:
33 ContentSettingNotificationsImageModel();
34
35 virtual void UpdateFromTabContents(const TabContents* tab_contents);
36 };
37
31 const int ContentSettingBlockedImageModel::kBlockedIconIDs[] = { 38 const int ContentSettingBlockedImageModel::kBlockedIconIDs[] = {
32 IDR_BLOCKED_COOKIES, 39 IDR_BLOCKED_COOKIES,
33 IDR_BLOCKED_IMAGES, 40 IDR_BLOCKED_IMAGES,
34 IDR_BLOCKED_JAVASCRIPT, 41 IDR_BLOCKED_JAVASCRIPT,
35 IDR_BLOCKED_PLUGINS, 42 IDR_BLOCKED_PLUGINS,
36 IDR_BLOCKED_POPUPS, 43 IDR_BLOCKED_POPUPS,
37 }; 44 };
38 45
39 const int ContentSettingBlockedImageModel::kTooltipIDs[] = { 46 const int ContentSettingBlockedImageModel::kTooltipIDs[] = {
40 IDS_BLOCKED_COOKIES_TITLE, 47 IDS_BLOCKED_COOKIES_TITLE,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // blocked icon. 93 // blocked icon.
87 if (tab_state_flags & GeolocationSettingsState::TABSTATE_HAS_ANY_ALLOWED) { 94 if (tab_state_flags & GeolocationSettingsState::TABSTATE_HAS_ANY_ALLOWED) {
88 set_icon(IDR_GEOLOCATION_ALLOWED_LOCATIONBAR_ICON); 95 set_icon(IDR_GEOLOCATION_ALLOWED_LOCATIONBAR_ICON);
89 set_tooltip(l10n_util::GetStringUTF8(IDS_GEOLOCATION_ALLOWED_TOOLTIP)); 96 set_tooltip(l10n_util::GetStringUTF8(IDS_GEOLOCATION_ALLOWED_TOOLTIP));
90 return; 97 return;
91 } 98 }
92 set_icon(IDR_GEOLOCATION_DENIED_LOCATIONBAR_ICON); 99 set_icon(IDR_GEOLOCATION_DENIED_LOCATIONBAR_ICON);
93 set_tooltip(l10n_util::GetStringUTF8(IDS_GEOLOCATION_BLOCKED_TOOLTIP)); 100 set_tooltip(l10n_util::GetStringUTF8(IDS_GEOLOCATION_BLOCKED_TOOLTIP));
94 } 101 }
95 102
103 ContentSettingNotificationsImageModel::ContentSettingNotificationsImageModel()
104 : ContentSettingImageModel(CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
105 }
106
107 void ContentSettingNotificationsImageModel::UpdateFromTabContents(
108 const TabContents* tab_contents) {
109 // Notifications do not have a bubble.
110 set_visible(false);
111 }
112
96 ContentSettingImageModel::ContentSettingImageModel( 113 ContentSettingImageModel::ContentSettingImageModel(
97 ContentSettingsType content_settings_type) 114 ContentSettingsType content_settings_type)
98 : content_settings_type_(content_settings_type), 115 : content_settings_type_(content_settings_type),
99 is_visible_(false), 116 is_visible_(false),
100 icon_(0) { 117 icon_(0) {
101 } 118 }
102 119
103 // static 120 // static
104 ContentSettingImageModel* 121 ContentSettingImageModel*
105 ContentSettingImageModel::CreateContentSettingImageModel( 122 ContentSettingImageModel::CreateContentSettingImageModel(
106 ContentSettingsType content_settings_type) { 123 ContentSettingsType content_settings_type) {
107 if (content_settings_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) 124 if (content_settings_type == CONTENT_SETTINGS_TYPE_GEOLOCATION)
108 return new ContentSettingGeolocationImageModel(); 125 return new ContentSettingGeolocationImageModel();
126 if (content_settings_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS)
127 return new ContentSettingNotificationsImageModel();
109 return new ContentSettingBlockedImageModel(content_settings_type); 128 return new ContentSettingBlockedImageModel(content_settings_type);
110 } 129 }
OLDNEW
« no previous file with comments | « chrome/browser/content_setting_bubble_model.cc ('k') | chrome/browser/gtk/options/content_filter_page_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698