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

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

Issue 2785923003: [subresource_filter] Clean up special cases in TabSpecificContentSettings (Closed)
Patch Set: remove dependent CL Created 3 years, 8 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_image_model.h" 5 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
6 6
7 #include "base/feature_list.h" 7 #include "base/feature_list.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 419
420 void ContentSettingSubresourceFilterImageModel::UpdateFromWebContents( 420 void ContentSettingSubresourceFilterImageModel::UpdateFromWebContents(
421 WebContents* web_contents) { 421 WebContents* web_contents) {
422 set_visible(false); 422 set_visible(false);
423 423
424 if (!web_contents) 424 if (!web_contents)
425 return; 425 return;
426 426
427 TabSpecificContentSettings* content_settings = 427 TabSpecificContentSettings* content_settings =
428 TabSpecificContentSettings::FromWebContents(web_contents); 428 TabSpecificContentSettings::FromWebContents(web_contents);
429 429 if (!content_settings || !content_settings->IsContentBlocked(
430 if (!content_settings || !content_settings->IsSubresourceBlocked()) 430 CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER)) {
431 return; 431 return;
432 }
432 433
433 set_icon(kSubresourceFilterActiveIcon, kBlockedBadgeIcon); 434 set_icon(kSubresourceFilterActiveIcon, kBlockedBadgeIcon);
434 set_explanatory_string_id(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_TITLE); 435 set_explanatory_string_id(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_TITLE);
435 set_tooltip( 436 set_tooltip(
436 l10n_util::GetStringUTF16(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_TITLE)); 437 l10n_util::GetStringUTF16(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_TITLE));
437 set_visible(true); 438 set_visible(true);
438 } 439 }
439 440
440 ContentSettingBubbleModel* 441 ContentSettingBubbleModel*
441 ContentSettingSubresourceFilterImageModel::CreateBubbleModel( 442 ContentSettingSubresourceFilterImageModel::CreateBubbleModel(
442 ContentSettingBubbleModel::Delegate* delegate, 443 ContentSettingBubbleModel::Delegate* delegate,
443 WebContents* web_contents, 444 WebContents* web_contents,
444 Profile* profile) { 445 Profile* profile) {
445 return new ContentSettingSubresourceFilterBubbleModel(delegate, web_contents, 446 return new ContentSettingSubresourceFilterBubbleModel(delegate, web_contents,
446 profile); 447 profile);
447 } 448 }
448 449
449 bool ContentSettingSubresourceFilterImageModel::ShouldRunAnimation( 450 bool ContentSettingSubresourceFilterImageModel::ShouldRunAnimation(
450 WebContents* web_contents) { 451 WebContents* web_contents) {
451 if (!web_contents) 452 if (!web_contents)
452 return false; 453 return false;
453 TabSpecificContentSettings* content_settings = 454 TabSpecificContentSettings* content_settings =
454 TabSpecificContentSettings::FromWebContents(web_contents); 455 TabSpecificContentSettings::FromWebContents(web_contents);
455 return content_settings && 456 return content_settings && !content_settings->IsBlockageIndicated(
456 !content_settings->IsSubresourceBlockageIndicated(); 457 CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER);
457 } 458 }
458 459
459 void ContentSettingSubresourceFilterImageModel::SetAnimationHasRun( 460 void ContentSettingSubresourceFilterImageModel::SetAnimationHasRun(
460 WebContents* web_contents) { 461 WebContents* web_contents) {
461 if (!web_contents) 462 if (!web_contents)
462 return; 463 return;
463 TabSpecificContentSettings* content_settings = 464 TabSpecificContentSettings* content_settings =
464 TabSpecificContentSettings::FromWebContents(web_contents); 465 TabSpecificContentSettings::FromWebContents(web_contents);
465 if (content_settings) 466 if (content_settings) {
466 content_settings->SetSubresourceBlockageIndicated(); 467 content_settings->SetBlockageHasBeenIndicated(
468 CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER);
469 }
467 } 470 }
468 471
469 // Protocol handlers ----------------------------------------------------------- 472 // Protocol handlers -----------------------------------------------------------
470 473
471 ContentSettingRPHImageModel::ContentSettingRPHImageModel() 474 ContentSettingRPHImageModel::ContentSettingRPHImageModel()
472 : ContentSettingSimpleImageModel(CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) { 475 : ContentSettingSimpleImageModel(CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) {
473 set_icon(ui::kProtocolHandlerIcon, gfx::kNoneIcon); 476 set_icon(ui::kProtocolHandlerIcon, gfx::kNoneIcon);
474 set_tooltip(l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_TOOLTIP)); 477 set_tooltip(l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_TOOLTIP));
475 } 478 }
476 479
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 634
632 #if defined(OS_MACOSX) 635 #if defined(OS_MACOSX)
633 bool ContentSettingImageModel::UpdateFromWebContentsAndCheckIfIconChanged( 636 bool ContentSettingImageModel::UpdateFromWebContentsAndCheckIfIconChanged(
634 content::WebContents* web_contents) { 637 content::WebContents* web_contents) {
635 const gfx::VectorIcon* old_icon = icon_; 638 const gfx::VectorIcon* old_icon = icon_;
636 const gfx::VectorIcon* old_badge_icon = icon_badge_; 639 const gfx::VectorIcon* old_badge_icon = icon_badge_;
637 UpdateFromWebContents(web_contents); 640 UpdateFromWebContents(web_contents);
638 return old_icon != icon_ && old_badge_icon != icon_badge_; 641 return old_icon != icon_ && old_badge_icon != icon_badge_;
639 } 642 }
640 #endif 643 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698