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

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

Issue 12438018: Revert 188727 "Merge 188160" due to compilation error in the unittest. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: Created 7 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/api/infobars/infobar_service.h" 9 #include "chrome/browser/api/infobars/infobar_service.h"
10 #include "chrome/browser/content_settings/content_settings_utils.h" 10 #include "chrome/browser/content_settings/content_settings_utils.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_UNBLOCK}, 270 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_UNBLOCK},
271 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_UNBLOCK_ALL}, 271 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_UNBLOCK_ALL},
272 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_UNBLOCK}, 272 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_UNBLOCK},
273 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_BLOCKED_PPAPI_BROKER_UNBLOCK}, 273 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_BLOCKED_PPAPI_BROKER_UNBLOCK},
274 }; 274 };
275 // Fields as for kBlockedAllowIDs, above. 275 // Fields as for kBlockedAllowIDs, above.
276 static const ContentSettingsTypeIdEntry kResourceSpecificBlockedAllowIDs[] = { 276 static const ContentSettingsTypeIdEntry kResourceSpecificBlockedAllowIDs[] = {
277 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_UNBLOCK}, 277 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_UNBLOCK},
278 }; 278 };
279 static const ContentSettingsTypeIdEntry kAllowedAllowIDs[] = { 279 static const ContentSettingsTypeIdEntry kAllowedAllowIDs[] = {
280 // TODO(bauerb): The string shouldn't be "unblock" (they weren't blocked).
281 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_UNBLOCK},
282 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_ALLOWED_PPAPI_BROKER_NO_ACTION}, 280 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_ALLOWED_PPAPI_BROKER_NO_ACTION},
283 }; 281 };
284 282
285 std::string radio_allow_label; 283 std::string radio_allow_label;
286 if (allowed) { 284 if (allowed) {
287 int resource_id = GetIdForContentType(kAllowedAllowIDs, 285 radio_allow_label = l10n_util::GetStringUTF8(
288 arraysize(kAllowedAllowIDs), 286 GetIdForContentType(kAllowedAllowIDs, arraysize(kAllowedAllowIDs),
289 content_type()); 287 content_type()));
290 radio_allow_label = (content_type() == CONTENT_SETTINGS_TYPE_COOKIES) ?
291 l10n_util::GetStringFUTF8(resource_id, display_host) :
292 l10n_util::GetStringUTF8(resource_id);
293 } else if (resources.empty()) { 288 } else if (resources.empty()) {
294 radio_allow_label = l10n_util::GetStringFUTF8( 289 radio_allow_label = l10n_util::GetStringFUTF8(
295 GetIdForContentType(kBlockedAllowIDs, arraysize(kBlockedAllowIDs), 290 GetIdForContentType(kBlockedAllowIDs, arraysize(kBlockedAllowIDs),
296 content_type()), 291 content_type()),
297 display_host); 292 display_host);
298 } else { 293 } else {
299 radio_allow_label = l10n_util::GetStringFUTF8( 294 radio_allow_label = l10n_util::GetStringFUTF8(
300 GetIdForContentType(kResourceSpecificBlockedAllowIDs, 295 GetIdForContentType(kResourceSpecificBlockedAllowIDs,
301 arraysize(kResourceSpecificBlockedAllowIDs), 296 arraysize(kResourceSpecificBlockedAllowIDs),
302 content_type()), 297 content_type()),
303 display_host); 298 display_host);
304 } 299 }
305 300
306 static const ContentSettingsTypeIdEntry kBlockedBlockIDs[] = { 301 static const ContentSettingsTypeIdEntry kBlockedBlockIDs[] = {
307 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_NO_ACTION}, 302 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_NO_ACTION},
308 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_BLOCKED_IMAGES_NO_ACTION}, 303 {CONTENT_SETTINGS_TYPE_IMAGES, IDS_BLOCKED_IMAGES_NO_ACTION},
309 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_NO_ACTION}, 304 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_BLOCKED_JAVASCRIPT_NO_ACTION},
310 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_NO_ACTION}, 305 {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_BLOCKED_PLUGINS_NO_ACTION},
311 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_NO_ACTION}, 306 {CONTENT_SETTINGS_TYPE_POPUPS, IDS_BLOCKED_POPUPS_NO_ACTION},
312 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_BLOCKED_PPAPI_BROKER_NO_ACTION}, 307 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_BLOCKED_PPAPI_BROKER_NO_ACTION},
313 }; 308 };
314 static const ContentSettingsTypeIdEntry kAllowedBlockIDs[] = { 309 static const ContentSettingsTypeIdEntry kAllowedBlockIDs[] = {
315 // TODO(bauerb): The string should say "block".
316 {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_NO_ACTION},
317 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_ALLOWED_PPAPI_BROKER_BLOCK}, 310 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, IDS_ALLOWED_PPAPI_BROKER_BLOCK},
318 }; 311 };
319 312
320 std::string radio_block_label; 313 std::string radio_block_label;
321 if (allowed) { 314 if (allowed) {
322 int resource_id = GetIdForContentType(kAllowedBlockIDs, 315 radio_block_label = l10n_util::GetStringFUTF8(
323 arraysize(kAllowedBlockIDs), 316 GetIdForContentType(kAllowedBlockIDs, arraysize(kAllowedBlockIDs),
324 content_type()); 317 content_type()),
325 radio_block_label = (content_type() == CONTENT_SETTINGS_TYPE_COOKIES) ? 318 display_host);
326 l10n_util::GetStringUTF8(resource_id) :
327 l10n_util::GetStringFUTF8(resource_id, display_host);
328 } else { 319 } else {
329 radio_block_label = l10n_util::GetStringUTF8( 320 radio_block_label = l10n_util::GetStringUTF8(
330 GetIdForContentType(kBlockedBlockIDs, arraysize(kBlockedBlockIDs), 321 GetIdForContentType(kBlockedBlockIDs, arraysize(kBlockedBlockIDs),
331 content_type())); 322 content_type()));
332 } 323 }
333 324
334 radio_group.radio_items.push_back(radio_allow_label); 325 radio_group.radio_items.push_back(radio_allow_label);
335 radio_group.radio_items.push_back(radio_block_label); 326 radio_group.radio_items.push_back(radio_block_label);
336 HostContentSettingsMap* map = profile()->GetHostContentSettingsMap(); 327 HostContentSettingsMap* map = profile()->GetHostContentSettingsMap();
337 CookieSettings* cookie_settings = 328 CookieSettings* cookie_settings =
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { 1002 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) {
1012 DCHECK_EQ(web_contents_, 1003 DCHECK_EQ(web_contents_,
1013 content::Source<WebContents>(source).ptr()); 1004 content::Source<WebContents>(source).ptr());
1014 web_contents_ = NULL; 1005 web_contents_ = NULL;
1015 } else { 1006 } else {
1016 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); 1007 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
1017 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); 1008 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr());
1018 profile_ = NULL; 1009 profile_ = NULL;
1019 } 1010 }
1020 } 1011 }
OLDNEW
« no previous file with comments | « no previous file | 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