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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1801 // because of the extension, rather than because of the user's content | 1801 // because of the extension, rather than because of the user's content |
1802 // settings. | 1802 // settings. |
1803 if (!ChromeContentBrowserClientExtensionsPart::AllowServiceWorker( | 1803 if (!ChromeContentBrowserClientExtensionsPart::AllowServiceWorker( |
1804 scope, first_party_url, context, render_process_id, | 1804 scope, first_party_url, context, render_process_id, |
1805 render_frame_id)) { | 1805 render_frame_id)) { |
1806 return false; | 1806 return false; |
1807 } | 1807 } |
1808 #endif | 1808 #endif |
1809 | 1809 |
1810 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1810 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
1811 bool allow = io_data->GetCookieSettings()->IsSettingCookieAllowed( | |
1812 scope, first_party_url); | |
1813 | 1811 |
1812 // Check if javascripts are allowed | |
falken
2016/10/05 01:16:50
nit: Add a period to the end of the sentence. Also
shimazu
2016/10/05 02:10:57
Done.
| |
1813 content_settings::SettingInfo info; | |
1814 std::unique_ptr<base::Value> value = | |
1815 io_data->GetHostContentSettingsMap()->GetWebsiteSetting( | |
1816 first_party_url, first_party_url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, | |
1817 std::string(), &info); | |
1818 ContentSetting setting = content_settings::ValueToContentSetting(value.get()); | |
1819 bool allow_javascript = (setting == CONTENT_SETTING_ALLOW); | |
1820 | |
1821 // Check if cookies are allowed | |
falken
2016/10/05 01:16:49
nit: period at end of the sentence.
shimazu
2016/10/05 02:10:57
Done.
| |
1822 bool allow_serviceworker = | |
1823 io_data->GetCookieSettings()->IsSettingCookieAllowed(scope, | |
1824 first_party_url); | |
1814 // Record access to database for potential display in UI. | 1825 // Record access to database for potential display in UI. |
1815 // Only post the task if this is for a specific frame. | 1826 // Only post the task if this is for a specific frame. |
1816 if (render_process_id != -1 && render_frame_id != -1) { | 1827 if (render_process_id != -1 && render_frame_id != -1) { |
1817 BrowserThread::PostTask( | 1828 BrowserThread::PostTask( |
1818 BrowserThread::UI, FROM_HERE, | 1829 BrowserThread::UI, FROM_HERE, |
1819 base::Bind(&TabSpecificContentSettings::ServiceWorkerAccessed, | 1830 base::Bind(&TabSpecificContentSettings::ServiceWorkerAccessed, |
1820 render_process_id, render_frame_id, scope, !allow)); | 1831 render_process_id, render_frame_id, scope, |
1832 !allow_javascript, !allow_serviceworker)); | |
1821 } | 1833 } |
1822 return allow; | 1834 return allow_javascript && allow_serviceworker; |
1823 } | 1835 } |
1824 | 1836 |
1825 bool ChromeContentBrowserClient::AllowGetCookie( | 1837 bool ChromeContentBrowserClient::AllowGetCookie( |
1826 const GURL& url, | 1838 const GURL& url, |
1827 const GURL& first_party, | 1839 const GURL& first_party, |
1828 const net::CookieList& cookie_list, | 1840 const net::CookieList& cookie_list, |
1829 content::ResourceContext* context, | 1841 content::ResourceContext* context, |
1830 int render_process_id, | 1842 int render_process_id, |
1831 int render_frame_id) { | 1843 int render_frame_id) { |
1832 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1844 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3259 if (channel <= kMaxDisableEncryptionChannel) { | 3271 if (channel <= kMaxDisableEncryptionChannel) { |
3260 static const char* const kWebRtcDevSwitchNames[] = { | 3272 static const char* const kWebRtcDevSwitchNames[] = { |
3261 switches::kDisableWebRtcEncryption, | 3273 switches::kDisableWebRtcEncryption, |
3262 }; | 3274 }; |
3263 to_command_line->CopySwitchesFrom(from_command_line, | 3275 to_command_line->CopySwitchesFrom(from_command_line, |
3264 kWebRtcDevSwitchNames, | 3276 kWebRtcDevSwitchNames, |
3265 arraysize(kWebRtcDevSwitchNames)); | 3277 arraysize(kWebRtcDevSwitchNames)); |
3266 } | 3278 } |
3267 } | 3279 } |
3268 #endif // defined(ENABLE_WEBRTC) | 3280 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |