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

Side by Side Diff: components/content_settings/core/browser/cookie_settings.h

Issue 2655443003: Unify the "get" and "set" cookie access settings. (Closed)
Patch Set: fix android Created 3 years, 11 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 (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 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_COOKIE_SETTINGS_H_ 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_COOKIE_SETTINGS_H_
6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_COOKIE_SETTINGS_H_ 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_COOKIE_SETTINGS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 25 matching lines...) Expand all
36 36
37 // Returns the default content setting (CONTENT_SETTING_ALLOW, 37 // Returns the default content setting (CONTENT_SETTING_ALLOW,
38 // CONTENT_SETTING_BLOCK, or CONTENT_SETTING_SESSION_ONLY) for cookies. If 38 // CONTENT_SETTING_BLOCK, or CONTENT_SETTING_SESSION_ONLY) for cookies. If
39 // |provider_id| is not nullptr, the id of the provider which provided the 39 // |provider_id| is not nullptr, the id of the provider which provided the
40 // default setting is assigned to it. 40 // default setting is assigned to it.
41 // 41 //
42 // This may be called on any thread. 42 // This may be called on any thread.
43 ContentSetting GetDefaultCookieSetting(std::string* provider_id) const; 43 ContentSetting GetDefaultCookieSetting(std::string* provider_id) const;
44 44
45 // Returns true if the page identified by (|url|, |first_party_url|) is 45 // Returns true if the page identified by (|url|, |first_party_url|) is
46 // allowed to read cookies. 46 // allowed to access cookies.
msramek 2017/01/25 14:41:30 nit: Maybe at this one place, I would actually say
falken 2017/01/25 14:55:51 Good idea. Done. I'll add it to the net/ interface
47 // 47 //
48 // This may be called on any thread. 48 // This may be called on any thread.
49 bool IsReadingCookieAllowed(const GURL& url, 49 bool IsCookieAccessAllowed(const GURL& url,
50 const GURL& first_party_url) const; 50 const GURL& first_party_url) const;
51
52 // Returns true if the page identified by (|url|, |first_party_url|) is
53 // allowed to set cookies (permanent or session only).
54 //
55 // This may be called on any thread.
56 bool IsSettingCookieAllowed(const GURL& url,
57 const GURL& first_party_url) const;
58
59 // Gets the results from IsReadingCookieAllowed and IsSettingCookieAllowed in
60 // a performance efficient way.
61 //
62 // This may be called on any thread.
63 void GetReadingAndSettingCookieAllowed(const GURL& url,
64 const GURL& first_party_url,
65 bool* reading_cookie_allowed,
66 bool* setting_cookie_allowed) const;
67 51
68 // Returns true if the cookie set by a page identified by |url| should be 52 // Returns true if the cookie set by a page identified by |url| should be
69 // session only. Querying this only makes sense if |IsSettingCookieAllowed| 53 // session only. Querying this only makes sense if |IsCookieAccessAllowed|
70 // has returned true. 54 // has returned true.
71 // 55 //
72 // This may be called on any thread. 56 // This may be called on any thread.
73 bool IsCookieSessionOnly(const GURL& url) const; 57 bool IsCookieSessionOnly(const GURL& url) const;
74 58
75 // Returns all patterns with a non-default cookie setting, mapped to their 59 // Returns all patterns with a non-default cookie setting, mapped to their
76 // actual settings, in the precedence order of the setting rules. |settings| 60 // actual settings, in the precedence order of the setting rules. |settings|
77 // must be a non-nullptr outparam. 61 // must be a non-nullptr outparam.
78 // 62 //
79 // This may be called on any thread. 63 // This may be called on any thread.
(...skipping 19 matching lines...) Expand all
99 83
100 // Detaches the |CookieSettings| from |PrefService|. This methods needs to be 84 // Detaches the |CookieSettings| from |PrefService|. This methods needs to be
101 // called before destroying the service. Afterwards, only const methods can be 85 // called before destroying the service. Afterwards, only const methods can be
102 // called. 86 // called.
103 void ShutdownOnUIThread() override; 87 void ShutdownOnUIThread() override;
104 88
105 // A helper for applying third party cookie blocking rules. 89 // A helper for applying third party cookie blocking rules.
106 void GetCookieSetting(const GURL& url, 90 void GetCookieSetting(const GURL& url,
107 const GURL& first_party_url, 91 const GURL& first_party_url,
108 content_settings::SettingSource* source, 92 content_settings::SettingSource* source,
109 ContentSetting* reading_cookie, 93 ContentSetting* cookie_setting) const;
110 ContentSetting* setting_cookie) const;
111 94
112 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 95 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
113 96
114 private: 97 private:
115 ~CookieSettings() override; 98 ~CookieSettings() override;
116 99
117 void OnBlockThirdPartyCookiesChanged(); 100 void OnBlockThirdPartyCookiesChanged();
118 101
119 // Returns true if the "block third party cookies" preference is set. 102 // Returns true if the "block third party cookies" preference is set.
120 // 103 //
(...skipping 10 matching lines...) Expand all
131 mutable base::Lock lock_; 114 mutable base::Lock lock_;
132 115
133 bool block_third_party_cookies_; 116 bool block_third_party_cookies_;
134 117
135 DISALLOW_COPY_AND_ASSIGN(CookieSettings); 118 DISALLOW_COPY_AND_ASSIGN(CookieSettings);
136 }; 119 };
137 120
138 } // namespace content_settings 121 } // namespace content_settings
139 122
140 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_COOKIE_SETTINGS_H_ 123 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_COOKIE_SETTINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698