| 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 IPC_BEGIN_MESSAGE_MAP(TabSpecificContentSettings, message) | 783 IPC_BEGIN_MESSAGE_MAP(TabSpecificContentSettings, message) |
| 784 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, | 784 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, |
| 785 OnContentBlockedWithDetail) | 785 OnContentBlockedWithDetail) |
| 786 IPC_MESSAGE_UNHANDLED(handled = false) | 786 IPC_MESSAGE_UNHANDLED(handled = false) |
| 787 IPC_END_MESSAGE_MAP() | 787 IPC_END_MESSAGE_MAP() |
| 788 return handled; | 788 return handled; |
| 789 } | 789 } |
| 790 | 790 |
| 791 void TabSpecificContentSettings::DidStartNavigation( | 791 void TabSpecificContentSettings::DidStartNavigation( |
| 792 content::NavigationHandle* navigation_handle) { | 792 content::NavigationHandle* navigation_handle) { |
| 793 if (!navigation_handle->IsInMainFrame() || navigation_handle->IsSamePage()) | 793 if (!navigation_handle->IsInMainFrame() || |
| 794 navigation_handle->IsSameDocument()) { |
| 794 return; | 795 return; |
| 796 } |
| 795 | 797 |
| 796 const content::NavigationController& controller = | 798 const content::NavigationController& controller = |
| 797 web_contents()->GetController(); | 799 web_contents()->GetController(); |
| 798 content::NavigationEntry* last_committed_entry = | 800 content::NavigationEntry* last_committed_entry = |
| 799 controller.GetLastCommittedEntry(); | 801 controller.GetLastCommittedEntry(); |
| 800 if (last_committed_entry) | 802 if (last_committed_entry) |
| 801 previous_url_ = last_committed_entry->GetURL(); | 803 previous_url_ = last_committed_entry->GetURL(); |
| 802 | 804 |
| 803 // If we're displaying a network error page do not reset the content | 805 // If we're displaying a network error page do not reset the content |
| 804 // settings delegate's cookies so the user has a chance to modify cookie | 806 // settings delegate's cookies so the user has a chance to modify cookie |
| 805 // settings. | 807 // settings. |
| 806 if (!navigation_handle->IsErrorPage()) | 808 if (!navigation_handle->IsErrorPage()) |
| 807 ClearNavigationRelatedContentSettings(); | 809 ClearNavigationRelatedContentSettings(); |
| 808 ClearGeolocationContentSettings(); | 810 ClearGeolocationContentSettings(); |
| 809 ClearMidiContentSettings(); | 811 ClearMidiContentSettings(); |
| 810 ClearPendingProtocolHandler(); | 812 ClearPendingProtocolHandler(); |
| 811 } | 813 } |
| 812 | 814 |
| 813 void TabSpecificContentSettings::DidFinishNavigation( | 815 void TabSpecificContentSettings::DidFinishNavigation( |
| 814 content::NavigationHandle* navigation_handle) { | 816 content::NavigationHandle* navigation_handle) { |
| 815 if (!navigation_handle->IsInMainFrame() || | 817 if (!navigation_handle->IsInMainFrame() || |
| 816 !navigation_handle->HasCommitted() || | 818 !navigation_handle->HasCommitted() || |
| 817 navigation_handle->IsSamePage()) { | 819 navigation_handle->IsSameDocument()) { |
| 818 return; | 820 return; |
| 819 } | 821 } |
| 820 | 822 |
| 821 // Clear "blocked" flags. | 823 // Clear "blocked" flags. |
| 822 ClearContentSettingsExceptForNavigationRelatedSettings(); | 824 ClearContentSettingsExceptForNavigationRelatedSettings(); |
| 823 blocked_plugin_names_.clear(); | 825 blocked_plugin_names_.clear(); |
| 824 GeolocationDidNavigate(navigation_handle); | 826 GeolocationDidNavigate(navigation_handle); |
| 825 MidiDidNavigate(navigation_handle); | 827 MidiDidNavigate(navigation_handle); |
| 826 | 828 |
| 827 if (web_contents()->GetVisibleURL().SchemeIsHTTPOrHTTPS()) { | 829 if (web_contents()->GetVisibleURL().SchemeIsHTTPOrHTTPS()) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 static_cast<MicrophoneCameraStateFlags>( | 902 static_cast<MicrophoneCameraStateFlags>( |
| 901 TabSpecificContentSettings::MICROPHONE_ACCESSED | | 903 TabSpecificContentSettings::MICROPHONE_ACCESSED | |
| 902 TabSpecificContentSettings::MICROPHONE_BLOCKED | | 904 TabSpecificContentSettings::MICROPHONE_BLOCKED | |
| 903 TabSpecificContentSettings::CAMERA_ACCESSED | | 905 TabSpecificContentSettings::CAMERA_ACCESSED | |
| 904 TabSpecificContentSettings::CAMERA_BLOCKED); | 906 TabSpecificContentSettings::CAMERA_BLOCKED); |
| 905 OnMediaStreamPermissionSet( | 907 OnMediaStreamPermissionSet( |
| 906 web_contents()->GetLastCommittedURL(), | 908 web_contents()->GetLastCommittedURL(), |
| 907 media_blocked, | 909 media_blocked, |
| 908 std::string(), std::string(), std::string(), std::string()); | 910 std::string(), std::string(), std::string(), std::string()); |
| 909 } | 911 } |
| OLD | NEW |