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

Side by Side Diff: content/shell/browser/shell_network_delegate.cc

Issue 2655443003: Unify the "get" and "set" cookie access settings. (Closed)
Patch Set: rebase Created 3 years, 10 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell_network_delegate.h" 5 #include "content/shell/browser/shell_network_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_switches.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 net::AuthCredentials* credentials) { 79 net::AuthCredentials* credentials) {
80 return AUTH_REQUIRED_RESPONSE_NO_ACTION; 80 return AUTH_REQUIRED_RESPONSE_NO_ACTION;
81 } 81 }
82 82
83 bool ShellNetworkDelegate::OnCanGetCookies(const net::URLRequest& request, 83 bool ShellNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
84 const net::CookieList& cookie_list) { 84 const net::CookieList& cookie_list) {
85 net::StaticCookiePolicy::Type policy_type = g_block_third_party_cookies ? 85 net::StaticCookiePolicy::Type policy_type = g_block_third_party_cookies ?
86 net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES : 86 net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES :
87 net::StaticCookiePolicy::ALLOW_ALL_COOKIES; 87 net::StaticCookiePolicy::ALLOW_ALL_COOKIES;
88 net::StaticCookiePolicy policy(policy_type); 88 net::StaticCookiePolicy policy(policy_type);
89 int rv = policy.CanGetCookies( 89 int rv =
90 request.url(), request.first_party_for_cookies()); 90 policy.CanAccessCookies(request.url(), request.first_party_for_cookies());
91 return rv == net::OK; 91 return rv == net::OK;
92 } 92 }
93 93
94 bool ShellNetworkDelegate::OnCanSetCookie(const net::URLRequest& request, 94 bool ShellNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
95 const std::string& cookie_line, 95 const std::string& cookie_line,
96 net::CookieOptions* options) { 96 net::CookieOptions* options) {
97 net::StaticCookiePolicy::Type policy_type = g_block_third_party_cookies ? 97 net::StaticCookiePolicy::Type policy_type = g_block_third_party_cookies ?
98 net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES : 98 net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES :
99 net::StaticCookiePolicy::ALLOW_ALL_COOKIES; 99 net::StaticCookiePolicy::ALLOW_ALL_COOKIES;
100 net::StaticCookiePolicy policy(policy_type); 100 net::StaticCookiePolicy policy(policy_type);
101 int rv = policy.CanSetCookie( 101 int rv =
102 request.url(), request.first_party_for_cookies()); 102 policy.CanAccessCookies(request.url(), request.first_party_for_cookies());
103 return rv == net::OK; 103 return rv == net::OK;
104 } 104 }
105 105
106 bool ShellNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, 106 bool ShellNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
107 const base::FilePath& path) const { 107 const base::FilePath& path) const {
108 return true; 108 return true;
109 } 109 }
110 110
111 bool ShellNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { 111 bool ShellNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const {
112 return base::CommandLine::ForCurrentProcess()->HasSwitch( 112 return base::CommandLine::ForCurrentProcess()->HasSwitch(
113 switches::kEnableExperimentalWebPlatformFeatures); 113 switches::kEnableExperimentalWebPlatformFeatures);
114 } 114 }
115 115
116 bool ShellNetworkDelegate::OnAreStrictSecureCookiesEnabled() const { 116 bool ShellNetworkDelegate::OnAreStrictSecureCookiesEnabled() const {
117 return OnAreExperimentalCookieFeaturesEnabled(); 117 return OnAreExperimentalCookieFeaturesEnabled();
118 } 118 }
119 119
120 } // namespace content 120 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698