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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 if (content_type == CONTENT_SETTINGS_TYPE_IMAGES || | 242 if (content_type == CONTENT_SETTINGS_TYPE_IMAGES || |
243 content_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT || | 243 content_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT || |
244 content_type == CONTENT_SETTINGS_TYPE_PLUGINS || | 244 content_type == CONTENT_SETTINGS_TYPE_PLUGINS || |
245 content_type == CONTENT_SETTINGS_TYPE_COOKIES || | 245 content_type == CONTENT_SETTINGS_TYPE_COOKIES || |
246 content_type == CONTENT_SETTINGS_TYPE_POPUPS || | 246 content_type == CONTENT_SETTINGS_TYPE_POPUPS || |
247 content_type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT || | 247 content_type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT || |
248 content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || | 248 content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || |
249 content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA || | 249 content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA || |
250 content_type == CONTENT_SETTINGS_TYPE_PPAPI_BROKER || | 250 content_type == CONTENT_SETTINGS_TYPE_PPAPI_BROKER || |
251 content_type == CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS || | 251 content_type == CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS || |
252 content_type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX || | 252 content_type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { |
253 content_type == CONTENT_SETTINGS_TYPE_KEYGEN) { | |
254 const auto& it = content_settings_status_.find(content_type); | 253 const auto& it = content_settings_status_.find(content_type); |
255 if (it != content_settings_status_.end()) | 254 if (it != content_settings_status_.end()) |
256 return it->second.blocked; | 255 return it->second.blocked; |
257 } | 256 } |
258 | 257 |
259 return false; | 258 return false; |
260 } | 259 } |
261 | 260 |
262 bool TabSpecificContentSettings::IsSubresourceBlocked() const { | 261 bool TabSpecificContentSettings::IsSubresourceBlocked() const { |
263 return subresource_filter_enabled_; | 262 return subresource_filter_enabled_; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 void TabSpecificContentSettings::OnGeolocationPermissionSet( | 532 void TabSpecificContentSettings::OnGeolocationPermissionSet( |
534 const GURL& requesting_origin, | 533 const GURL& requesting_origin, |
535 bool allowed) { | 534 bool allowed) { |
536 geolocation_usages_state_.OnPermissionSet(requesting_origin, allowed); | 535 geolocation_usages_state_.OnPermissionSet(requesting_origin, allowed); |
537 content::NotificationService::current()->Notify( | 536 content::NotificationService::current()->Notify( |
538 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, | 537 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
539 content::Source<WebContents>(web_contents()), | 538 content::Source<WebContents>(web_contents()), |
540 content::NotificationService::NoDetails()); | 539 content::NotificationService::NoDetails()); |
541 } | 540 } |
542 | 541 |
543 void TabSpecificContentSettings::OnDidUseKeygen(const GURL& origin_url) { | |
544 HostContentSettingsMap* map = HostContentSettingsMapFactory::GetForProfile( | |
545 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); | |
546 GURL url = web_contents()->GetLastCommittedURL(); | |
547 if (map->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_KEYGEN, | |
548 std::string()) != CONTENT_SETTING_ALLOW) { | |
549 OnContentBlocked(CONTENT_SETTINGS_TYPE_KEYGEN); | |
550 } | |
551 } | |
552 | |
553 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 542 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
554 void TabSpecificContentSettings::OnProtectedMediaIdentifierPermissionSet( | 543 void TabSpecificContentSettings::OnProtectedMediaIdentifierPermissionSet( |
555 const GURL& requesting_origin, | 544 const GURL& requesting_origin, |
556 bool allowed) { | 545 bool allowed) { |
557 if (allowed) { | 546 if (allowed) { |
558 OnContentAllowed(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); | 547 OnContentAllowed(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); |
559 } else { | 548 } else { |
560 OnContentBlocked(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); | 549 OnContentBlocked(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); |
561 } | 550 } |
562 } | 551 } |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 render_frame_host->GetRoutingID())); | 774 render_frame_host->GetRoutingID())); |
786 } | 775 } |
787 | 776 |
788 bool TabSpecificContentSettings::OnMessageReceived( | 777 bool TabSpecificContentSettings::OnMessageReceived( |
789 const IPC::Message& message, | 778 const IPC::Message& message, |
790 content::RenderFrameHost* render_frame_host) { | 779 content::RenderFrameHost* render_frame_host) { |
791 bool handled = true; | 780 bool handled = true; |
792 IPC_BEGIN_MESSAGE_MAP(TabSpecificContentSettings, message) | 781 IPC_BEGIN_MESSAGE_MAP(TabSpecificContentSettings, message) |
793 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, | 782 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, |
794 OnContentBlockedWithDetail) | 783 OnContentBlockedWithDetail) |
795 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidUseKeygen, OnDidUseKeygen) | |
796 IPC_MESSAGE_UNHANDLED(handled = false) | 784 IPC_MESSAGE_UNHANDLED(handled = false) |
797 IPC_END_MESSAGE_MAP() | 785 IPC_END_MESSAGE_MAP() |
798 return handled; | 786 return handled; |
799 } | 787 } |
800 | 788 |
801 void TabSpecificContentSettings::DidStartNavigation( | 789 void TabSpecificContentSettings::DidStartNavigation( |
802 content::NavigationHandle* navigation_handle) { | 790 content::NavigationHandle* navigation_handle) { |
803 if (!navigation_handle->IsInMainFrame() || navigation_handle->IsSamePage()) | 791 if (!navigation_handle->IsInMainFrame() || navigation_handle->IsSamePage()) |
804 return; | 792 return; |
805 | 793 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 static_cast<MicrophoneCameraStateFlags>( | 898 static_cast<MicrophoneCameraStateFlags>( |
911 TabSpecificContentSettings::MICROPHONE_ACCESSED | | 899 TabSpecificContentSettings::MICROPHONE_ACCESSED | |
912 TabSpecificContentSettings::MICROPHONE_BLOCKED | | 900 TabSpecificContentSettings::MICROPHONE_BLOCKED | |
913 TabSpecificContentSettings::CAMERA_ACCESSED | | 901 TabSpecificContentSettings::CAMERA_ACCESSED | |
914 TabSpecificContentSettings::CAMERA_BLOCKED); | 902 TabSpecificContentSettings::CAMERA_BLOCKED); |
915 OnMediaStreamPermissionSet( | 903 OnMediaStreamPermissionSet( |
916 web_contents()->GetLastCommittedURL(), | 904 web_contents()->GetLastCommittedURL(), |
917 media_blocked, | 905 media_blocked, |
918 std::string(), std::string(), std::string(), std::string()); | 906 std::string(), std::string(), std::string(), std::string()); |
919 } | 907 } |
OLD | NEW |