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

Side by Side Diff: net/base/static_cookie_policy.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 "net/base/static_cookie_policy.h" 5 #include "net/base/static_cookie_policy.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 9 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 int StaticCookiePolicy::CanGetCookies( 14 int StaticCookiePolicy::CanGetCookies(
15 const GURL& url, 15 const GURL& url,
16 const GURL& first_party_for_cookies) const { 16 const GURL& first_party_for_cookies) const {
17 switch (type_) { 17 switch (type_) {
18 case StaticCookiePolicy::ALLOW_ALL_COOKIES: 18 case StaticCookiePolicy::ALLOW_ALL_COOKIES:
19 return OK; 19 return OK;
20 case StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES: 20 case StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES:
21 if (first_party_for_cookies.is_empty()) 21 if (first_party_for_cookies.is_empty())
22 return OK; // Empty first-party URL indicates a first-party request. 22 return OK; // Empty first-party URL indicates a first-party request.
23 return registry_controlled_domains::SameDomainOrHost( 23 return registry_controlled_domains::SameDomainOrHost(
24 url, 24 url,
25 first_party_for_cookies, 25 first_party_for_cookies,
26 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES) ? 26 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)
27 OK : ERR_ACCESS_DENIED; 27 ? OK
28 : ERR_ACCESS_DENIED;
28 case StaticCookiePolicy::BLOCK_ALL_COOKIES: 29 case StaticCookiePolicy::BLOCK_ALL_COOKIES:
29 return ERR_ACCESS_DENIED; 30 return ERR_ACCESS_DENIED;
30 default: 31 default:
31 NOTREACHED(); 32 NOTREACHED();
32 return ERR_ACCESS_DENIED; 33 return ERR_ACCESS_DENIED;
33 } 34 }
34 } 35 }
35 36
36 int StaticCookiePolicy::CanSetCookie( 37 int StaticCookiePolicy::CanSetCookie(
37 const GURL& url, 38 const GURL& url,
38 const GURL& first_party_for_cookies) const { 39 const GURL& first_party_for_cookies) const {
39 switch (type_) { 40 switch (type_) {
40 case StaticCookiePolicy::ALLOW_ALL_COOKIES: 41 case StaticCookiePolicy::ALLOW_ALL_COOKIES:
41 return OK; 42 return OK;
42 case StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES: 43 case StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES:
43 if (first_party_for_cookies.is_empty()) 44 if (first_party_for_cookies.is_empty())
44 return OK; // Empty first-party URL indicates a first-party request. 45 return OK; // Empty first-party URL indicates a first-party request.
45 return registry_controlled_domains::SameDomainOrHost( 46 return registry_controlled_domains::SameDomainOrHost(
46 url, 47 url,
47 first_party_for_cookies, 48 first_party_for_cookies,
48 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES) ? 49 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)
49 OK : ERR_ACCESS_DENIED; 50 ? OK
51 : ERR_ACCESS_DENIED;
50 case StaticCookiePolicy::BLOCK_ALL_COOKIES: 52 case StaticCookiePolicy::BLOCK_ALL_COOKIES:
51 return ERR_ACCESS_DENIED; 53 return ERR_ACCESS_DENIED;
52 default: 54 default:
53 NOTREACHED(); 55 NOTREACHED();
54 return ERR_ACCESS_DENIED; 56 return ERR_ACCESS_DENIED;
55 } 57 }
56 } 58 }
57 59
58 } // namespace net 60 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698