Chromium Code Reviews| Index: chrome/browser/ui/content_settings/content_setting_image_model.cc |
| diff --git a/chrome/browser/ui/content_settings/content_setting_image_model.cc b/chrome/browser/ui/content_settings/content_setting_image_model.cc |
| index 15f20bccbbd4080fda8f217afa754a7382856272..a9809c245a0e0cdb5fc0168d7fb7fc71d029d1c9 100644 |
| --- a/chrome/browser/ui/content_settings/content_setting_image_model.cc |
| +++ b/chrome/browser/ui/content_settings/content_setting_image_model.cc |
| @@ -32,6 +32,13 @@ class ContentSettingGeolocationImageModel : public ContentSettingImageModel { |
| virtual void UpdateFromWebContents(WebContents* web_contents) OVERRIDE; |
| }; |
| +class ContentSettingRPHImageModel : public ContentSettingImageModel { |
| + public: |
| + ContentSettingRPHImageModel(); |
| + |
| + virtual void UpdateFromWebContents(WebContents* web_contents) OVERRIDE; |
| +}; |
| + |
| class ContentSettingNotificationsImageModel : public ContentSettingImageModel { |
| public: |
| ContentSettingNotificationsImageModel(); |
| @@ -156,6 +163,28 @@ void ContentSettingGeolocationImageModel::UpdateFromWebContents( |
| IDS_GEOLOCATION_ALLOWED_TOOLTIP : IDS_GEOLOCATION_BLOCKED_TOOLTIP)); |
| } |
| +ContentSettingRPHImageModel::ContentSettingRPHImageModel() |
| + : ContentSettingImageModel( |
| + CONTENT_SETTINGS_TYPE_REGISTER_PROTOCOL_HANDLER) { |
| +} |
| + |
| +void ContentSettingRPHImageModel::UpdateFromWebContents( |
| + WebContents* web_contents) { |
| + set_visible(false); |
| + if (!web_contents) |
| + return; |
| + |
| + TabSpecificContentSettings* content_settings = |
| + TabContents::FromWebContents(web_contents)->content_settings(); |
| + if (content_settings->GetPendingProtocolHandler().IsEmpty()) |
| + return; |
| + |
| + set_visible(true); |
| + set_icon(IDR_REGISTER_PROTOCOL_HANDLER_LOCATIONBAR_ICON); |
|
Peter Kasting
2012/06/25 23:55:30
Nit: Can you set the icon and tooltip in the const
Greg Billock
2012/06/26 19:17:04
Done.
|
| + |
| + set_tooltip(l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_TOOLTIP)); |
| +} |
| + |
| ContentSettingNotificationsImageModel::ContentSettingNotificationsImageModel() |
| : ContentSettingImageModel(CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { |
| } |
| @@ -183,6 +212,8 @@ ContentSettingImageModel* |
| return new ContentSettingGeolocationImageModel(); |
| case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| return new ContentSettingNotificationsImageModel(); |
| + case CONTENT_SETTINGS_TYPE_REGISTER_PROTOCOL_HANDLER: |
| + return new ContentSettingRPHImageModel(); |
| default: |
| return new ContentSettingBlockedImageModel(content_settings_type); |
| } |