OLD | NEW |
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/content_settings/tab_specific_content_settings.h" | 5 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 // TODO(grunell): UI should show for what reason access has been blocked. | 535 // TODO(grunell): UI should show for what reason access has been blocked. |
536 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_POLICY: | 536 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_POLICY: |
537 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER_SETTING: | 537 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER_SETTING: |
538 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER: | 538 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER: |
539 OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 539 OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
540 break; | 540 break; |
541 } | 541 } |
542 } | 542 } |
543 } | 543 } |
544 | 544 |
545 void TabSpecificContentSettings::OnMIDISysExAccessed( | 545 void TabSpecificContentSettings::OnMidiSysExAccessed( |
546 const GURL& requesting_origin) { | 546 const GURL& requesting_origin) { |
547 midi_usages_state_.OnPermissionSet(requesting_origin, true); | 547 midi_usages_state_.OnPermissionSet(requesting_origin, true); |
548 OnContentAllowed(CONTENT_SETTINGS_TYPE_MIDI_SYSEX); | 548 OnContentAllowed(CONTENT_SETTINGS_TYPE_MIDI_SYSEX); |
549 } | 549 } |
550 | 550 |
551 void TabSpecificContentSettings::OnMIDISysExAccessBlocked( | 551 void TabSpecificContentSettings::OnMidiSysExAccessBlocked( |
552 const GURL& requesting_origin) { | 552 const GURL& requesting_origin) { |
553 midi_usages_state_.OnPermissionSet(requesting_origin, false); | 553 midi_usages_state_.OnPermissionSet(requesting_origin, false); |
554 OnContentBlocked(CONTENT_SETTINGS_TYPE_MIDI_SYSEX); | 554 OnContentBlocked(CONTENT_SETTINGS_TYPE_MIDI_SYSEX); |
555 } | 555 } |
556 | 556 |
557 void TabSpecificContentSettings::ClearBlockedContentSettingsExceptForCookies() { | 557 void TabSpecificContentSettings::ClearBlockedContentSettingsExceptForCookies() { |
558 for (size_t i = 0; i < arraysize(content_blocked_); ++i) { | 558 for (size_t i = 0; i < arraysize(content_blocked_); ++i) { |
559 if (i == CONTENT_SETTINGS_TYPE_COOKIES) | 559 if (i == CONTENT_SETTINGS_TYPE_COOKIES) |
560 continue; | 560 continue; |
561 content_blocked_[i] = false; | 561 content_blocked_[i] = false; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, | 599 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
600 content::Source<WebContents>(web_contents()), | 600 content::Source<WebContents>(web_contents()), |
601 content::NotificationService::NoDetails()); | 601 content::NotificationService::NoDetails()); |
602 } | 602 } |
603 | 603 |
604 void TabSpecificContentSettings::GeolocationDidNavigate( | 604 void TabSpecificContentSettings::GeolocationDidNavigate( |
605 const content::LoadCommittedDetails& details) { | 605 const content::LoadCommittedDetails& details) { |
606 geolocation_usages_state_.DidNavigate(details); | 606 geolocation_usages_state_.DidNavigate(details); |
607 } | 607 } |
608 | 608 |
609 void TabSpecificContentSettings::MIDIDidNavigate( | 609 void TabSpecificContentSettings::MidiDidNavigate( |
610 const content::LoadCommittedDetails& details) { | 610 const content::LoadCommittedDetails& details) { |
611 midi_usages_state_.DidNavigate(details); | 611 midi_usages_state_.DidNavigate(details); |
612 } | 612 } |
613 | 613 |
614 void TabSpecificContentSettings::ClearGeolocationContentSettings() { | 614 void TabSpecificContentSettings::ClearGeolocationContentSettings() { |
615 geolocation_usages_state_.ClearStateMap(); | 615 geolocation_usages_state_.ClearStateMap(); |
616 } | 616 } |
617 | 617 |
618 void TabSpecificContentSettings::ClearMIDIContentSettings() { | 618 void TabSpecificContentSettings::ClearMidiContentSettings() { |
619 midi_usages_state_.ClearStateMap(); | 619 midi_usages_state_.ClearStateMap(); |
620 } | 620 } |
621 | 621 |
622 void TabSpecificContentSettings::SetPepperBrokerAllowed(bool allowed) { | 622 void TabSpecificContentSettings::SetPepperBrokerAllowed(bool allowed) { |
623 if (allowed) { | 623 if (allowed) { |
624 OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); | 624 OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); |
625 } else { | 625 } else { |
626 OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); | 626 OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); |
627 } | 627 } |
628 } | 628 } |
(...skipping 16 matching lines...) Expand all Loading... |
645 return handled; | 645 return handled; |
646 } | 646 } |
647 | 647 |
648 void TabSpecificContentSettings::DidNavigateMainFrame( | 648 void TabSpecificContentSettings::DidNavigateMainFrame( |
649 const content::LoadCommittedDetails& details, | 649 const content::LoadCommittedDetails& details, |
650 const content::FrameNavigateParams& params) { | 650 const content::FrameNavigateParams& params) { |
651 if (!details.is_in_page) { | 651 if (!details.is_in_page) { |
652 // Clear "blocked" flags. | 652 // Clear "blocked" flags. |
653 ClearBlockedContentSettingsExceptForCookies(); | 653 ClearBlockedContentSettingsExceptForCookies(); |
654 GeolocationDidNavigate(details); | 654 GeolocationDidNavigate(details); |
655 MIDIDidNavigate(details); | 655 MidiDidNavigate(details); |
656 } | 656 } |
657 } | 657 } |
658 | 658 |
659 void TabSpecificContentSettings::DidStartProvisionalLoadForFrame( | 659 void TabSpecificContentSettings::DidStartProvisionalLoadForFrame( |
660 int64 frame_id, | 660 int64 frame_id, |
661 int64 parent_frame_id, | 661 int64 parent_frame_id, |
662 bool is_main_frame, | 662 bool is_main_frame, |
663 const GURL& validated_url, | 663 const GURL& validated_url, |
664 bool is_error_page, | 664 bool is_error_page, |
665 bool is_iframe_srcdoc, | 665 bool is_iframe_srcdoc, |
666 RenderViewHost* render_view_host) { | 666 RenderViewHost* render_view_host) { |
667 if (!is_main_frame) | 667 if (!is_main_frame) |
668 return; | 668 return; |
669 | 669 |
670 // If we're displaying a network error page do not reset the content | 670 // If we're displaying a network error page do not reset the content |
671 // settings delegate's cookies so the user has a chance to modify cookie | 671 // settings delegate's cookies so the user has a chance to modify cookie |
672 // settings. | 672 // settings. |
673 if (!is_error_page) | 673 if (!is_error_page) |
674 ClearCookieSpecificContentSettings(); | 674 ClearCookieSpecificContentSettings(); |
675 ClearGeolocationContentSettings(); | 675 ClearGeolocationContentSettings(); |
676 ClearMIDIContentSettings(); | 676 ClearMidiContentSettings(); |
677 ClearPendingProtocolHandler(); | 677 ClearPendingProtocolHandler(); |
678 } | 678 } |
679 | 679 |
680 void TabSpecificContentSettings::AppCacheAccessed(const GURL& manifest_url, | 680 void TabSpecificContentSettings::AppCacheAccessed(const GURL& manifest_url, |
681 bool blocked_by_policy) { | 681 bool blocked_by_policy) { |
682 if (blocked_by_policy) { | 682 if (blocked_by_policy) { |
683 blocked_local_shared_objects_.appcaches()->AddAppCache(manifest_url); | 683 blocked_local_shared_objects_.appcaches()->AddAppCache(manifest_url); |
684 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); | 684 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
685 } else { | 685 } else { |
686 allowed_local_shared_objects_.appcaches()->AddAppCache(manifest_url); | 686 allowed_local_shared_objects_.appcaches()->AddAppCache(manifest_url); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 } | 719 } |
720 | 720 |
721 void TabSpecificContentSettings::RemoveSiteDataObserver( | 721 void TabSpecificContentSettings::RemoveSiteDataObserver( |
722 SiteDataObserver* observer) { | 722 SiteDataObserver* observer) { |
723 observer_list_.RemoveObserver(observer); | 723 observer_list_.RemoveObserver(observer); |
724 } | 724 } |
725 | 725 |
726 void TabSpecificContentSettings::NotifySiteDataObservers() { | 726 void TabSpecificContentSettings::NotifySiteDataObservers() { |
727 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); | 727 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); |
728 } | 728 } |
OLD | NEW |