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 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2113 | 2113 |
2114 base::Callback<content::WebContents*(void)> wc_getter = | 2114 base::Callback<content::WebContents*(void)> wc_getter = |
2115 base::Bind(&GetWebContents, render_process_id, render_frame_id); | 2115 base::Bind(&GetWebContents, render_process_id, render_frame_id); |
2116 BrowserThread::PostTask( | 2116 BrowserThread::PostTask( |
2117 BrowserThread::UI, FROM_HERE, | 2117 BrowserThread::UI, FROM_HERE, |
2118 base::BindOnce(&TabSpecificContentSettings::CookieChanged, wc_getter, url, | 2118 base::BindOnce(&TabSpecificContentSettings::CookieChanged, wc_getter, url, |
2119 first_party, cookie_line, options, !allow)); | 2119 first_party, cookie_line, options, !allow)); |
2120 return allow; | 2120 return allow; |
2121 } | 2121 } |
2122 | 2122 |
2123 bool ChromeContentBrowserClient::AllowSaveLocalState( | |
2124 content::ResourceContext* context) { | |
2125 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
2126 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | |
2127 content_settings::CookieSettings* cookie_settings = | |
2128 io_data->GetCookieSettings(); | |
2129 ContentSetting setting = cookie_settings->GetDefaultCookieSetting(NULL); | |
2130 | |
2131 // TODO(bauerb): Should we also disallow local state if the default is BLOCK? | |
2132 // Could we even support per-origin settings? | |
2133 return setting != CONTENT_SETTING_SESSION_ONLY; | |
2134 } | |
2135 | |
2136 void ChromeContentBrowserClient::AllowWorkerFileSystem( | 2123 void ChromeContentBrowserClient::AllowWorkerFileSystem( |
2137 const GURL& url, | 2124 const GURL& url, |
2138 content::ResourceContext* context, | 2125 content::ResourceContext* context, |
2139 const std::vector<std::pair<int, int> >& render_frames, | 2126 const std::vector<std::pair<int, int> >& render_frames, |
2140 base::Callback<void(bool)> callback) { | 2127 base::Callback<void(bool)> callback) { |
2141 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 2128 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
2142 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 2129 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
2143 content_settings::CookieSettings* cookie_settings = | 2130 content_settings::CookieSettings* cookie_settings = |
2144 io_data->GetCookieSettings(); | 2131 io_data->GetCookieSettings(); |
2145 bool allow = cookie_settings->IsCookieAccessAllowed(url, url); | 2132 bool allow = cookie_settings->IsCookieAccessAllowed(url, url); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 for (i = render_frames.begin(); i != render_frames.end(); ++i) { | 2223 for (i = render_frames.begin(); i != render_frames.end(); ++i) { |
2237 BrowserThread::PostTask( | 2224 BrowserThread::PostTask( |
2238 BrowserThread::UI, FROM_HERE, | 2225 BrowserThread::UI, FROM_HERE, |
2239 base::BindOnce(&TabSpecificContentSettings::IndexedDBAccessed, i->first, | 2226 base::BindOnce(&TabSpecificContentSettings::IndexedDBAccessed, i->first, |
2240 i->second, url, name, !allow)); | 2227 i->second, url, name, !allow)); |
2241 } | 2228 } |
2242 | 2229 |
2243 return allow; | 2230 return allow; |
2244 } | 2231 } |
2245 | 2232 |
2246 #if BUILDFLAG(ENABLE_WEBRTC) | |
2247 bool ChromeContentBrowserClient::AllowWebRTCIdentityCache( | |
2248 const GURL& url, | |
2249 const GURL& first_party_url, | |
2250 content::ResourceContext* context) { | |
2251 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
2252 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | |
2253 content_settings::CookieSettings* cookie_settings = | |
2254 io_data->GetCookieSettings(); | |
2255 return cookie_settings->IsCookieAccessAllowed(url, first_party_url); | |
2256 } | |
2257 #endif // BUILDFLAG(ENABLE_WEBRTC) | |
2258 | |
2259 ChromeContentBrowserClient::AllowWebBluetoothResult | 2233 ChromeContentBrowserClient::AllowWebBluetoothResult |
2260 ChromeContentBrowserClient::AllowWebBluetooth( | 2234 ChromeContentBrowserClient::AllowWebBluetooth( |
2261 content::BrowserContext* browser_context, | 2235 content::BrowserContext* browser_context, |
2262 const url::Origin& requesting_origin, | 2236 const url::Origin& requesting_origin, |
2263 const url::Origin& embedding_origin) { | 2237 const url::Origin& embedding_origin) { |
2264 // TODO(crbug.com/598890): Don't disable if | 2238 // TODO(crbug.com/598890): Don't disable if |
2265 // base::CommandLine::ForCurrentProcess()-> | 2239 // base::CommandLine::ForCurrentProcess()-> |
2266 // HasSwitch(switches::kEnableWebBluetooth) is true. | 2240 // HasSwitch(switches::kEnableWebBluetooth) is true. |
2267 if (variations::GetVariationParamValue( | 2241 if (variations::GetVariationParamValue( |
2268 PermissionContextBase::kPermissionsKillSwitchFieldStudy, | 2242 PermissionContextBase::kPermissionsKillSwitchFieldStudy, |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3609 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3583 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
3610 return variations::GetVariationParamValue( | 3584 return variations::GetVariationParamValue( |
3611 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3585 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
3612 } | 3586 } |
3613 | 3587 |
3614 // static | 3588 // static |
3615 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3589 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
3616 const storage::QuotaSettings* settings) { | 3590 const storage::QuotaSettings* settings) { |
3617 g_default_quota_settings = settings; | 3591 g_default_quota_settings = settings; |
3618 } | 3592 } |
OLD | NEW |