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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_bubble_model.cc

Issue 2220573004: Caption for the Subresource filter bubble prompt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mac Created 4 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/content_settings/content_setting_bubble_model.h" 5 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 const ContentSettingsTypeIdEntry *title_ids = kBlockedTitleIDs; 152 const ContentSettingsTypeIdEntry *title_ids = kBlockedTitleIDs;
153 size_t num_title_ids = arraysize(kBlockedTitleIDs); 153 size_t num_title_ids = arraysize(kBlockedTitleIDs);
154 if (content_settings && content_settings->IsContentAllowed(content_type()) && 154 if (content_settings && content_settings->IsContentAllowed(content_type()) &&
155 !content_settings->IsContentBlocked(content_type())) { 155 !content_settings->IsContentBlocked(content_type())) {
156 title_ids = kAccessedTitleIDs; 156 title_ids = kAccessedTitleIDs;
157 num_title_ids = arraysize(kAccessedTitleIDs); 157 num_title_ids = arraysize(kAccessedTitleIDs);
158 } 158 }
159 int title_id = 159 int title_id =
160 GetIdForContentType(title_ids, num_title_ids, content_type()); 160 GetIdForContentType(title_ids, num_title_ids, content_type());
161 if (title_id) 161 if (title_id)
162 set_title(l10n_util::GetStringUTF8(title_id)); 162 set_title(l10n_util::GetStringUTF16(title_id));
163 } 163 }
164 164
165 void ContentSettingSimpleBubbleModel::SetManageLink() { 165 void ContentSettingSimpleBubbleModel::SetManageLink() {
166 static const ContentSettingsTypeIdEntry kLinkIDs[] = { 166 static const ContentSettingsTypeIdEntry kLinkIDs[] = {
167 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_LINK}, 167 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_LINK},
168 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_BLOCKED_IMAGES_LINK}, 168 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_BLOCKED_IMAGES_LINK},
169 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_LINK}, 169 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_LINK},
170 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_LINK}, 170 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_LINK},
171 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_LINK}, 171 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_LINK},
172 {CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_GEOLOCATION_BUBBLE_MANAGE_LINK}, 172 {CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_GEOLOCATION_BUBBLE_MANAGE_LINK},
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 title_id = (state_ & TabSpecificContentSettings::CAMERA_BLOCKED) ? 647 title_id = (state_ & TabSpecificContentSettings::CAMERA_BLOCKED) ?
648 IDS_MICROPHONE_CAMERA_BLOCKED : IDS_MICROPHONE_BLOCKED; 648 IDS_MICROPHONE_CAMERA_BLOCKED : IDS_MICROPHONE_BLOCKED;
649 } else if (state_ & TabSpecificContentSettings::CAMERA_BLOCKED) { 649 } else if (state_ & TabSpecificContentSettings::CAMERA_BLOCKED) {
650 title_id = IDS_CAMERA_BLOCKED; 650 title_id = IDS_CAMERA_BLOCKED;
651 } else if (MicrophoneAccessed()) { 651 } else if (MicrophoneAccessed()) {
652 title_id = CameraAccessed() ? IDS_MICROPHONE_CAMERA_ALLOWED 652 title_id = CameraAccessed() ? IDS_MICROPHONE_CAMERA_ALLOWED
653 : IDS_MICROPHONE_ACCESSED; 653 : IDS_MICROPHONE_ACCESSED;
654 } else if (CameraAccessed()) { 654 } else if (CameraAccessed()) {
655 title_id = IDS_CAMERA_ACCESSED; 655 title_id = IDS_CAMERA_ACCESSED;
656 } 656 }
657 set_title(l10n_util::GetStringUTF8(title_id)); 657 set_title(l10n_util::GetStringUTF16(title_id));
658 } 658 }
659 659
660 void ContentSettingMediaStreamBubbleModel::SetRadioGroup() { 660 void ContentSettingMediaStreamBubbleModel::SetRadioGroup() {
661 TabSpecificContentSettings* content_settings = 661 TabSpecificContentSettings* content_settings =
662 TabSpecificContentSettings::FromWebContents(web_contents()); 662 TabSpecificContentSettings::FromWebContents(web_contents());
663 GURL url = content_settings->media_stream_access_origin(); 663 GURL url = content_settings->media_stream_access_origin();
664 RadioGroup radio_group; 664 RadioGroup radio_group;
665 radio_group.url = url; 665 radio_group.url = url;
666 666
667 base::string16 display_host_utf16 = 667 base::string16 display_host_utf16 =
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 IDS_REGISTER_PROTOCOL_HANDLER_MAILTO_NAME); 1040 IDS_REGISTER_PROTOCOL_HANDLER_MAILTO_NAME);
1041 } else if (pending_handler_.protocol() == "webcal") { 1041 } else if (pending_handler_.protocol() == "webcal") {
1042 protocol = l10n_util::GetStringUTF16( 1042 protocol = l10n_util::GetStringUTF16(
1043 IDS_REGISTER_PROTOCOL_HANDLER_WEBCAL_NAME); 1043 IDS_REGISTER_PROTOCOL_HANDLER_WEBCAL_NAME);
1044 } else { 1044 } else {
1045 protocol = base::UTF8ToUTF16(pending_handler_.protocol()); 1045 protocol = base::UTF8ToUTF16(pending_handler_.protocol());
1046 } 1046 }
1047 1047
1048 // Note that we ignore the |title| parameter. 1048 // Note that we ignore the |title| parameter.
1049 if (previous_handler_.IsEmpty()) { 1049 if (previous_handler_.IsEmpty()) {
1050 set_title(l10n_util::GetStringFUTF8( 1050 set_title(l10n_util::GetStringFUTF16(
1051 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM, 1051 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM,
1052 base::UTF8ToUTF16(pending_handler_.url().host()), 1052 base::UTF8ToUTF16(pending_handler_.url().host()),
1053 protocol)); 1053 protocol));
1054 } else { 1054 } else {
1055 set_title(l10n_util::GetStringFUTF8( 1055 set_title(l10n_util::GetStringFUTF16(
1056 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE, 1056 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE,
1057 base::UTF8ToUTF16(pending_handler_.url().host()), 1057 base::UTF8ToUTF16(pending_handler_.url().host()),
1058 protocol, 1058 protocol,
1059 base::UTF8ToUTF16(previous_handler_.url().host()))); 1059 base::UTF8ToUTF16(previous_handler_.url().host())));
1060 } 1060 }
1061 1061
1062 std::string radio_allow_label = 1062 std::string radio_allow_label =
1063 l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT); 1063 l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT);
1064 std::string radio_deny_label = 1064 std::string radio_deny_label =
1065 l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_DENY); 1065 l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_DENY);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 } 1164 }
1165 1165
1166 // ContentSettingSubresourceFilterBubbleModel ---------------------------------- 1166 // ContentSettingSubresourceFilterBubbleModel ----------------------------------
1167 1167
1168 ContentSettingSubresourceFilterBubbleModel:: 1168 ContentSettingSubresourceFilterBubbleModel::
1169 ContentSettingSubresourceFilterBubbleModel(Delegate* delegate, 1169 ContentSettingSubresourceFilterBubbleModel(Delegate* delegate,
1170 WebContents* web_contents, 1170 WebContents* web_contents,
1171 Profile* profile) 1171 Profile* profile)
1172 : ContentSettingBubbleModel(delegate, web_contents, profile) { 1172 : ContentSettingBubbleModel(delegate, web_contents, profile) {
1173 SetTitle(); 1173 SetTitle();
1174 SetMessage();
1174 SetManageLink(); 1175 SetManageLink();
1175 } 1176 }
1176 1177
1177 ContentSettingSubresourceFilterBubbleModel:: 1178 ContentSettingSubresourceFilterBubbleModel::
1178 ~ContentSettingSubresourceFilterBubbleModel() {} 1179 ~ContentSettingSubresourceFilterBubbleModel() {}
1179 1180
1180 void ContentSettingSubresourceFilterBubbleModel::SetTitle() { 1181 void ContentSettingSubresourceFilterBubbleModel::SetTitle() {
1181 // TODO(melandory): For this bubble we need to introduce ability to have a 1182 set_title(
1182 // caption (something which appears above title and has bigger font). 1183 l10n_util::GetStringUTF16(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_TITLE));
1183 set_title(l10n_util::GetStringUTF8(
1184 IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_EXPLANATION));
1185 } 1184 }
1186 1185
1187 void ContentSettingSubresourceFilterBubbleModel::SetManageLink() { 1186 void ContentSettingSubresourceFilterBubbleModel::SetManageLink() {
1188 // TODO(melandory): introduce the button instead of link. 1187 // TODO(melandory): introduce the button instead of link.
1189 set_manage_link( 1188 set_manage_link(
1190 l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD)); 1189 l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD));
1191 } 1190 }
1192 1191
1192 void ContentSettingSubresourceFilterBubbleModel::SetMessage() {
1193 set_message(l10n_util::GetStringUTF16(
1194 IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_EXPLANATION));
1195 }
1196
1193 void ContentSettingSubresourceFilterBubbleModel::OnManageLinkClicked() { 1197 void ContentSettingSubresourceFilterBubbleModel::OnManageLinkClicked() {
1194 subresource_filter::ContentSubresourceFilterDriverFactory* driver_factory = 1198 subresource_filter::ContentSubresourceFilterDriverFactory* driver_factory =
1195 subresource_filter::ContentSubresourceFilterDriverFactory:: 1199 subresource_filter::ContentSubresourceFilterDriverFactory::
1196 FromWebContents(web_contents()); 1200 FromWebContents(web_contents());
1197 driver_factory->OnReloadRequested(); 1201 driver_factory->OnReloadRequested();
1198 } 1202 }
1199 1203
1200 ContentSettingSubresourceFilterBubbleModel* 1204 ContentSettingSubresourceFilterBubbleModel*
1201 ContentSettingSubresourceFilterBubbleModel::AsSubresourceFilterBubbleModel() { 1205 ContentSettingSubresourceFilterBubbleModel::AsSubresourceFilterBubbleModel() {
1202 return this; 1206 return this;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 ContentSettingMediaStreamBubbleModel* 1406 ContentSettingMediaStreamBubbleModel*
1403 ContentSettingBubbleModel::AsMediaStreamBubbleModel() { 1407 ContentSettingBubbleModel::AsMediaStreamBubbleModel() {
1404 // In general, bubble models might not inherit from the media bubble model. 1408 // In general, bubble models might not inherit from the media bubble model.
1405 return nullptr; 1409 return nullptr;
1406 } 1410 }
1407 1411
1408 ContentSettingSubresourceFilterBubbleModel* 1412 ContentSettingSubresourceFilterBubbleModel*
1409 ContentSettingBubbleModel::AsSubresourceFilterBubbleModel() { 1413 ContentSettingBubbleModel::AsSubresourceFilterBubbleModel() {
1410 return nullptr; 1414 return nullptr;
1411 } 1415 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698