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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 void TabSpecificContentSettings::OnGeolocationPermissionSet( | 513 void TabSpecificContentSettings::OnGeolocationPermissionSet( |
514 const GURL& requesting_origin, | 514 const GURL& requesting_origin, |
515 bool allowed) { | 515 bool allowed) { |
516 geolocation_usages_state_.OnPermissionSet(requesting_origin, allowed); | 516 geolocation_usages_state_.OnPermissionSet(requesting_origin, allowed); |
517 content::NotificationService::current()->Notify( | 517 content::NotificationService::current()->Notify( |
518 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, | 518 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
519 content::Source<WebContents>(web_contents()), | 519 content::Source<WebContents>(web_contents()), |
520 content::NotificationService::NoDetails()); | 520 content::NotificationService::NoDetails()); |
521 } | 521 } |
522 | 522 |
| 523 void TabSpecificContentSettings::OnDidUseKeygen(const GURL& origin_url) { |
| 524 HostContentSettingsMap* map = HostContentSettingsMapFactory::GetForProfile( |
| 525 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); |
| 526 GURL url = web_contents()->GetLastCommittedURL(); |
| 527 if (map->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_KEYGEN, |
| 528 std::string()) != CONTENT_SETTING_ALLOW) { |
| 529 OnContentBlocked(CONTENT_SETTINGS_TYPE_KEYGEN); |
| 530 } |
| 531 } |
| 532 |
523 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 533 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
524 void TabSpecificContentSettings::OnProtectedMediaIdentifierPermissionSet( | 534 void TabSpecificContentSettings::OnProtectedMediaIdentifierPermissionSet( |
525 const GURL& requesting_origin, | 535 const GURL& requesting_origin, |
526 bool allowed) { | 536 bool allowed) { |
527 if (allowed) { | 537 if (allowed) { |
528 OnContentAllowed(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); | 538 OnContentAllowed(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); |
529 } else { | 539 } else { |
530 OnContentBlocked(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); | 540 OnContentBlocked(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); |
531 } | 541 } |
532 } | 542 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 render_frame_host->GetRoutingID())); | 751 render_frame_host->GetRoutingID())); |
742 } | 752 } |
743 | 753 |
744 bool TabSpecificContentSettings::OnMessageReceived( | 754 bool TabSpecificContentSettings::OnMessageReceived( |
745 const IPC::Message& message, | 755 const IPC::Message& message, |
746 content::RenderFrameHost* render_frame_host) { | 756 content::RenderFrameHost* render_frame_host) { |
747 bool handled = true; | 757 bool handled = true; |
748 IPC_BEGIN_MESSAGE_MAP(TabSpecificContentSettings, message) | 758 IPC_BEGIN_MESSAGE_MAP(TabSpecificContentSettings, message) |
749 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, | 759 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, |
750 OnContentBlockedWithDetail) | 760 OnContentBlockedWithDetail) |
| 761 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidUseKeygen, OnDidUseKeygen) |
751 IPC_MESSAGE_UNHANDLED(handled = false) | 762 IPC_MESSAGE_UNHANDLED(handled = false) |
752 IPC_END_MESSAGE_MAP() | 763 IPC_END_MESSAGE_MAP() |
753 return handled; | 764 return handled; |
754 } | 765 } |
755 | 766 |
756 void TabSpecificContentSettings::DidNavigateMainFrame( | 767 void TabSpecificContentSettings::DidNavigateMainFrame( |
757 const content::LoadCommittedDetails& details, | 768 const content::LoadCommittedDetails& details, |
758 const content::FrameNavigateParams& params) { | 769 const content::FrameNavigateParams& params) { |
759 if (!details.is_in_page) { | 770 if (!details.is_in_page) { |
760 // Clear "blocked" flags. | 771 // Clear "blocked" flags. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 static_cast<MicrophoneCameraStateFlags>( | 856 static_cast<MicrophoneCameraStateFlags>( |
846 TabSpecificContentSettings::MICROPHONE_ACCESSED | | 857 TabSpecificContentSettings::MICROPHONE_ACCESSED | |
847 TabSpecificContentSettings::MICROPHONE_BLOCKED | | 858 TabSpecificContentSettings::MICROPHONE_BLOCKED | |
848 TabSpecificContentSettings::CAMERA_ACCESSED | | 859 TabSpecificContentSettings::CAMERA_ACCESSED | |
849 TabSpecificContentSettings::CAMERA_BLOCKED); | 860 TabSpecificContentSettings::CAMERA_BLOCKED); |
850 OnMediaStreamPermissionSet( | 861 OnMediaStreamPermissionSet( |
851 web_contents()->GetLastCommittedURL(), | 862 web_contents()->GetLastCommittedURL(), |
852 media_blocked, | 863 media_blocked, |
853 std::string(), std::string(), std::string(), std::string()); | 864 std::string(), std::string(), std::string(), std::string()); |
854 } | 865 } |
OLD | NEW |