| Index: chrome/browser/net/chrome_network_delegate.cc
|
| diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
|
| index 545d127b789df21079f0aeae4a5142900d437290..1e49b0ea211cb4731185b030a4b8471b7cb7820d 100644
|
| --- a/chrome/browser/net/chrome_network_delegate.cc
|
| +++ b/chrome/browser/net/chrome_network_delegate.cc
|
| @@ -29,6 +29,10 @@
|
| #include "net/http/http_response_headers.h"
|
| #include "net/url_request/url_request.h"
|
|
|
| +#if defined(OS_CHROMEOS)
|
| +#include "base/chromeos/chromeos_version.h"
|
| +#endif
|
| +
|
| #if defined(ENABLE_CONFIGURATION_POLICY)
|
| #include "chrome/browser/policy/url_blacklist_manager.h"
|
| #endif
|
| @@ -252,24 +256,24 @@ ChromeNetworkDelegate::OnAuthRequired(
|
| }
|
|
|
| bool ChromeNetworkDelegate::CanGetCookies(
|
| - const net::URLRequest* request,
|
| + const net::URLRequest& request,
|
| const net::CookieList& cookie_list) {
|
| // NULL during tests, or when we're running in the system context.
|
| if (!cookie_settings_)
|
| return true;
|
|
|
| bool allow = cookie_settings_->IsReadingCookieAllowed(
|
| - request->url(), request->first_party_for_cookies());
|
| + request.url(), request.first_party_for_cookies());
|
|
|
| int render_process_id = -1;
|
| int render_view_id = -1;
|
| if (content::ResourceRequestInfo::GetRenderViewForRequest(
|
| - request, &render_process_id, &render_view_id)) {
|
| + &request, &render_process_id, &render_view_id)) {
|
| BrowserThread::PostTask(
|
| BrowserThread::UI, FROM_HERE,
|
| base::Bind(&TabSpecificContentSettings::CookiesRead,
|
| render_process_id, render_view_id,
|
| - request->url(), request->first_party_for_cookies(),
|
| + request.url(), request.first_party_for_cookies(),
|
| cookie_list, !allow));
|
| }
|
|
|
| @@ -277,7 +281,7 @@ bool ChromeNetworkDelegate::CanGetCookies(
|
| }
|
|
|
| bool ChromeNetworkDelegate::CanSetCookie(
|
| - const net::URLRequest* request,
|
| + const net::URLRequest& request,
|
| const std::string& cookie_line,
|
| net::CookieOptions* options) {
|
| // NULL during tests, or when we're running in the system context.
|
| @@ -285,22 +289,56 @@ bool ChromeNetworkDelegate::CanSetCookie(
|
| return true;
|
|
|
| bool allow = cookie_settings_->IsSettingCookieAllowed(
|
| - request->url(), request->first_party_for_cookies());
|
| + request.url(), request.first_party_for_cookies());
|
|
|
| - if (cookie_settings_->IsCookieSessionOnly(request->url()))
|
| + if (cookie_settings_->IsCookieSessionOnly(request.url()))
|
| options->set_force_session();
|
|
|
| int render_process_id = -1;
|
| int render_view_id = -1;
|
| if (content::ResourceRequestInfo::GetRenderViewForRequest(
|
| - request, &render_process_id, &render_view_id)) {
|
| + &request, &render_process_id, &render_view_id)) {
|
| BrowserThread::PostTask(
|
| BrowserThread::UI, FROM_HERE,
|
| base::Bind(&TabSpecificContentSettings::CookieChanged,
|
| render_process_id, render_view_id,
|
| - request->url(), request->first_party_for_cookies(),
|
| + request.url(), request.first_party_for_cookies(),
|
| cookie_line, *options, !allow));
|
| }
|
|
|
| return allow;
|
| }
|
| +
|
| +bool ChromeNetworkDelegate::CanAccessFile(const net::URLRequest& request,
|
| + const FilePath& path) const {
|
| +#if defined(OS_CHROMEOS)
|
| + // ChromeOS uses a whitelist to only allow access to files residing in the
|
| + // list of directories below.
|
| + static const char* const kLocalAccessWhiteList[] = {
|
| + "/home/chronos/user/Downloads",
|
| + "/home/chronos/user/log",
|
| + "/media",
|
| + "/opt/oem",
|
| + "/usr/share/chromeos-assets",
|
| + "/tmp",
|
| + "/var/log",
|
| + };
|
| +
|
| + // If we're running Chrome for ChromeOS on Linux, we want to allow file
|
| + // access.
|
| + if (!base::chromeos::IsRunningOnChromeOS())
|
| + return true;
|
| +
|
| + for (size_t i = 0; i < arraysize(kLocalAccessWhiteList); ++i) {
|
| + const FilePath white_listed_path(kLocalAccessWhiteList[i]);
|
| + // FilePath::operator== should probably handle trailing separators.
|
| + if (white_listed_path == path.StripTrailingSeparators() ||
|
| + white_listed_path.IsParent(path)) {
|
| + return true;
|
| + }
|
| + }
|
| + return false;
|
| +#else
|
| + return true;
|
| +#endif // defined(OS_CHROMEOS)
|
| +}
|
|
|