OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_NET_CHROME_COOKIE_POLICY_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_COOKIE_POLICY_H_ |
6 #define CHROME_BROWSER_NET_CHROME_COOKIE_POLICY_H_ | 6 #define CHROME_BROWSER_NET_CHROME_COOKIE_POLICY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 10 matching lines...) Expand all Loading... |
21 // We will only prompt the user before setting a cookie. We do not prompt the | 21 // We will only prompt the user before setting a cookie. We do not prompt the |
22 // user before getting a cookie. However, if we are in the process of | 22 // user before getting a cookie. However, if we are in the process of |
23 // prompting the user, then any requests to get cookies will be deferred. | 23 // prompting the user, then any requests to get cookies will be deferred. |
24 // This is done so that cookie requests remain FIFO. | 24 // This is done so that cookie requests remain FIFO. |
25 // | 25 // |
26 class ChromeCookiePolicy | 26 class ChromeCookiePolicy |
27 : public base::RefCountedThreadSafe<ChromeCookiePolicy>, | 27 : public base::RefCountedThreadSafe<ChromeCookiePolicy>, |
28 public net::CookiePolicy { | 28 public net::CookiePolicy { |
29 public: | 29 public: |
30 explicit ChromeCookiePolicy(HostContentSettingsMap* map); | 30 explicit ChromeCookiePolicy(HostContentSettingsMap* map); |
31 ~ChromeCookiePolicy(); | 31 virtual ~ChromeCookiePolicy(); |
32 | 32 |
33 // CookiePolicy methods: | 33 // CookiePolicy methods: |
34 virtual int CanGetCookies(const GURL& url, const GURL& first_party, | 34 virtual int CanGetCookies(const GURL& url, const GURL& first_party, |
35 net::CompletionCallback* callback); | 35 net::CompletionCallback* callback); |
36 virtual int CanSetCookie(const GURL& url, const GURL& first_party, | 36 virtual int CanSetCookie(const GURL& url, const GURL& first_party, |
37 const std::string& cookie_line, | 37 const std::string& cookie_line, |
38 net::CompletionCallback* callback); | 38 net::CompletionCallback* callback); |
39 | 39 |
40 private: | 40 private: |
41 class Completion { | 41 class Completion { |
(...skipping 21 matching lines...) Expand all Loading... |
63 typedef std::vector<Completion> Completions; | 63 typedef std::vector<Completion> Completions; |
64 typedef std::map<std::string, Completions> HostCompletionsMap; | 64 typedef std::map<std::string, Completions> HostCompletionsMap; |
65 | 65 |
66 int CheckPolicy(const GURL& url) const; | 66 int CheckPolicy(const GURL& url) const; |
67 | 67 |
68 // A map from hostname to callbacks awaiting a cookie policy response. | 68 // A map from hostname to callbacks awaiting a cookie policy response. |
69 // This map is only accessed on the IO thread. | 69 // This map is only accessed on the IO thread. |
70 HostCompletionsMap host_completions_map_; | 70 HostCompletionsMap host_completions_map_; |
71 | 71 |
72 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 72 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
| 73 |
| 74 // True if blocking third-party cookies also applies to reading them. |
| 75 bool strict_third_party_blocking_; |
| 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(ChromeCookiePolicy); |
73 }; | 78 }; |
74 | 79 |
75 #endif // CHROME_BROWSER_NET_CHROME_COOKIE_POLICY_H_ | 80 #endif // CHROME_BROWSER_NET_CHROME_COOKIE_POLICY_H_ |
OLD | NEW |