Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2377603002: Disable ServiceWorker when JS is disabled (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_dispatcher_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1776 // to the TabSpecificContentSettings, since the service worker is blocked 1776 // to the TabSpecificContentSettings, since the service worker is blocked
1777 // because of the extension, rather than because of the user's content 1777 // because of the extension, rather than because of the user's content
1778 // settings. 1778 // settings.
1779 if (!ChromeContentBrowserClientExtensionsPart::AllowServiceWorker( 1779 if (!ChromeContentBrowserClientExtensionsPart::AllowServiceWorker(
1780 scope, first_party_url, context, render_process_id, 1780 scope, first_party_url, context, render_process_id,
1781 render_frame_id)) { 1781 render_frame_id)) {
1782 return false; 1782 return false;
1783 } 1783 }
1784 #endif 1784 #endif
1785 1785
1786 // Check if Cookie is allowed
falken 2016/09/28 13:51:27 nit: add a period to the end of comments: https://
shimazu 2016/09/29 04:26:34 Done.
1786 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); 1787 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
1787 bool allow = io_data->GetCookieSettings()->IsSettingCookieAllowed( 1788 bool allow = io_data->GetCookieSettings()->IsSettingCookieAllowed(
1788 scope, first_party_url); 1789 scope, first_party_url);
1789 1790
1791 // Check if JS is allowed
falken 2016/09/28 13:51:27 nit: same
shimazu 2016/09/29 04:26:34 Done.
1792 content_settings::SettingInfo info;
1793 std::unique_ptr<base::Value> value =
1794 io_data->GetHostContentSettingsMap()->GetWebsiteSetting(
1795 first_party_url, first_party_url, CONTENT_SETTINGS_TYPE_JAVASCRIPT,
1796 std::string(), &info);
1797 ContentSetting setting = content_settings::ValueToContentSetting(value.get());
1798 allow = allow && (setting == CONTENT_SETTING_ALLOW);
1799
1790 // Record access to database for potential display in UI. 1800 // Record access to database for potential display in UI.
1791 // Only post the task if this is for a specific frame. 1801 // Only post the task if this is for a specific frame.
1792 if (render_process_id != -1 && render_frame_id != -1) { 1802 if (render_process_id != -1 && render_frame_id != -1) {
1793 BrowserThread::PostTask( 1803 BrowserThread::PostTask(
1794 BrowserThread::UI, FROM_HERE, 1804 BrowserThread::UI, FROM_HERE,
1795 base::Bind(&TabSpecificContentSettings::ServiceWorkerAccessed, 1805 base::Bind(&TabSpecificContentSettings::ServiceWorkerAccessed,
1796 render_process_id, render_frame_id, scope, !allow)); 1806 render_process_id, render_frame_id, scope, !allow));
1797 } 1807 }
1798 return allow; 1808 return allow;
1799 } 1809 }
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
3213 if (channel <= kMaxDisableEncryptionChannel) { 3223 if (channel <= kMaxDisableEncryptionChannel) {
3214 static const char* const kWebRtcDevSwitchNames[] = { 3224 static const char* const kWebRtcDevSwitchNames[] = {
3215 switches::kDisableWebRtcEncryption, 3225 switches::kDisableWebRtcEncryption,
3216 }; 3226 };
3217 to_command_line->CopySwitchesFrom(from_command_line, 3227 to_command_line->CopySwitchesFrom(from_command_line,
3218 kWebRtcDevSwitchNames, 3228 kWebRtcDevSwitchNames,
3219 arraysize(kWebRtcDevSwitchNames)); 3229 arraysize(kWebRtcDevSwitchNames));
3220 } 3230 }
3221 } 3231 }
3222 #endif // defined(ENABLE_WEBRTC) 3232 #endif // defined(ENABLE_WEBRTC)
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698