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

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

Issue 1150343004: Changing string id for CONTENT_SETTINGS_TYPE_COOKIES for block and allow case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 6 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_UNBLOCK}, 293 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_UNBLOCK},
294 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_BLOCKED_IMAGES_UNBLOCK}, 294 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_BLOCKED_IMAGES_UNBLOCK},
295 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_UNBLOCK}, 295 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_UNBLOCK},
296 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_UNBLOCK_ALL}, 296 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_UNBLOCK_ALL},
297 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_UNBLOCK}, 297 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_UNBLOCK},
298 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_BLOCKED_PPAPI_BROKER_UNBLOCK}, 298 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_BLOCKED_PPAPI_BROKER_UNBLOCK},
299 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_BLOCKED_DOWNLOAD_UNBLOCK}, 299 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_BLOCKED_DOWNLOAD_UNBLOCK},
300 }; 300 };
301 // Fields as for kBlockedAllowIDs, above. 301 // Fields as for kBlockedAllowIDs, above.
302 static const ContentSettingsTypeIdEntry kAllowedAllowIDs[] = { 302 static const ContentSettingsTypeIdEntry kAllowedAllowIDs[] = {
303 // TODO(bauerb): The string shouldn't be "unblock" (they weren't blocked). 303 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_ALLOWED_COOKIES_NO_ACTION},
304 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_UNBLOCK},
305 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_ALLOWED_PPAPI_BROKER_NO_ACTION}, 304 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_ALLOWED_PPAPI_BROKER_NO_ACTION},
306 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_ALLOWED_DOWNLOAD_NO_ACTION}, 305 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_ALLOWED_DOWNLOAD_NO_ACTION},
307 }; 306 };
308 307
309 std::string radio_allow_label; 308 std::string radio_allow_label;
310 if (allowed) { 309 if (allowed) {
311 int resource_id = GetIdForContentType(kAllowedAllowIDs, 310 int resource_id = GetIdForContentType(kAllowedAllowIDs,
312 arraysize(kAllowedAllowIDs), 311 arraysize(kAllowedAllowIDs),
313 content_type()); 312 content_type());
314 radio_allow_label = (content_type() == CONTENT_SETTINGS_TYPE_COOKIES) ? 313 radio_allow_label = l10n_util::GetStringUTF8(resource_id);
315 l10n_util::GetStringFUTF8(resource_id, display_host) :
316 l10n_util::GetStringUTF8(resource_id);
317 } else { 314 } else {
318 radio_allow_label = l10n_util::GetStringFUTF8( 315 radio_allow_label = l10n_util::GetStringFUTF8(
319 GetIdForContentType(kBlockedAllowIDs, arraysize(kBlockedAllowIDs), 316 GetIdForContentType(kBlockedAllowIDs, arraysize(kBlockedAllowIDs),
320 content_type()), 317 content_type()),
321 display_host); 318 display_host);
322 } 319 }
323 320
324 static const ContentSettingsTypeIdEntry kBlockedBlockIDs[] = { 321 static const ContentSettingsTypeIdEntry kBlockedBlockIDs[] = {
325 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_NO_ACTION}, 322 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_NO_ACTION},
326 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_BLOCKED_IMAGES_NO_ACTION}, 323 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_BLOCKED_IMAGES_NO_ACTION},
327 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_NO_ACTION}, 324 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_NO_ACTION},
328 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_NO_ACTION}, 325 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_NO_ACTION},
329 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_NO_ACTION}, 326 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_NO_ACTION},
330 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_BLOCKED_PPAPI_BROKER_NO_ACTION}, 327 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_BLOCKED_PPAPI_BROKER_NO_ACTION},
331 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_BLOCKED_DOWNLOAD_NO_ACTION}, 328 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_BLOCKED_DOWNLOAD_NO_ACTION},
332 }; 329 };
333 static const ContentSettingsTypeIdEntry kAllowedBlockIDs[] = { 330 static const ContentSettingsTypeIdEntry kAllowedBlockIDs[] = {
334 // TODO(bauerb): The string should say "block". 331 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_ALLOWED_COOKIES_BLOCK},
335 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_NO_ACTION},
336 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_ALLOWED_PPAPI_BROKER_BLOCK}, 332 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_ALLOWED_PPAPI_BROKER_BLOCK},
337 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_ALLOWED_DOWNLOAD_BLOCK}, 333 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_ALLOWED_DOWNLOAD_BLOCK},
338 }; 334 };
339 335
340 std::string radio_block_label; 336 std::string radio_block_label;
341 if (allowed) { 337 if (allowed) {
342 int resource_id = GetIdForContentType(kAllowedBlockIDs, 338 int resource_id = GetIdForContentType(kAllowedBlockIDs,
343 arraysize(kAllowedBlockIDs), 339 arraysize(kAllowedBlockIDs),
344 content_type()); 340 content_type());
345 radio_block_label = (content_type() == CONTENT_SETTINGS_TYPE_COOKIES) ? 341 radio_block_label = l10n_util::GetStringFUTF8(resource_id, display_host);
346 l10n_util::GetStringUTF8(resource_id) :
347 l10n_util::GetStringFUTF8(resource_id, display_host);
348 } else { 342 } else {
349 radio_block_label = l10n_util::GetStringUTF8( 343 radio_block_label = l10n_util::GetStringUTF8(
350 GetIdForContentType(kBlockedBlockIDs, arraysize(kBlockedBlockIDs), 344 GetIdForContentType(kBlockedBlockIDs, arraysize(kBlockedBlockIDs),
351 content_type())); 345 content_type()));
352 } 346 }
353 347
354 radio_group.radio_items.push_back(radio_allow_label); 348 radio_group.radio_items.push_back(radio_allow_label);
355 radio_group.radio_items.push_back(radio_block_label); 349 radio_group.radio_items.push_back(radio_block_label);
356 ContentSetting setting; 350 ContentSetting setting;
357 SettingSource setting_source = SETTING_SOURCE_NONE; 351 SettingSource setting_source = SETTING_SOURCE_NONE;
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { 1292 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) {
1299 DCHECK_EQ(web_contents_, 1293 DCHECK_EQ(web_contents_,
1300 content::Source<WebContents>(source).ptr()); 1294 content::Source<WebContents>(source).ptr());
1301 web_contents_ = NULL; 1295 web_contents_ = NULL;
1302 } else { 1296 } else {
1303 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); 1297 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
1304 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); 1298 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr());
1305 profile_ = NULL; 1299 profile_ = NULL;
1306 } 1300 }
1307 } 1301 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698