1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_COOKIES_COOKIE_MONSTER_NETLOG_PARAMS_H_
6 #define NET_COOKIES_COOKIE_MONSTER_NETLOG_PARAMS_H_
7 
8 #include <memory>
9 
10 #include "base/values.h"
11 #include "net/cookies/canonical_cookie.h"
12 #include "net/cookies/cookie_change_dispatcher.h"
13 #include "net/cookies/cookie_monster.h"
14 #include "net/cookies/cookie_store.h"
15 #include "net/log/net_log_capture_mode.h"
16 
17 namespace net {
18 
19 // Returns a Value containing NetLog parameters for constructing
20 // a CookieMonster.
21 base::Value NetLogCookieMonsterConstructorParams(bool persistent_store);
22 
23 // Returns a Value containing NetLog parameters for adding a cookie.
24 base::Value NetLogCookieMonsterCookieAdded(const CanonicalCookie* cookie,
25                                            bool sync_requested,
26                                            NetLogCaptureMode capture_mode);
27 
28 // Returns a Value containing NetLog parameters for deleting a cookie.
29 base::Value NetLogCookieMonsterCookieDeleted(const CanonicalCookie* cookie,
30                                              CookieChangeCause cause,
31                                              bool sync_requested,
32                                              NetLogCaptureMode capture_mode);
33 
34 // Returns a Value containing NetLog parameters for when a cookie addition
35 // is rejected because of a conflict with a secure cookie.
36 base::Value NetLogCookieMonsterCookieRejectedSecure(
37     const CanonicalCookie* old_cookie,
38     const CanonicalCookie* new_cookie,
39     NetLogCaptureMode capture_mode);
40 
41 // Returns a Value containing NetLog parameters for when a cookie addition
42 // is rejected because of a conflict with an httponly cookie.
43 base::Value NetLogCookieMonsterCookieRejectedHttponly(
44     const CanonicalCookie* old_cookie,
45     const CanonicalCookie* new_cookie,
46     NetLogCaptureMode capture_mode);
47 
48 // Returns a Value containing NetLog parameters for when, upon an attempted
49 // cookie addition which is rejected due to a conflict with a secure cookie, a
50 // pre-existing cookie would have been deleted but is instead preserved because
51 // the addition failed.
52 base::Value NetLogCookieMonsterCookiePreservedSkippedSecure(
53     const CanonicalCookie* skipped_secure,
54     const CanonicalCookie* preserved,
55     const CanonicalCookie* new_cookie,
56     NetLogCaptureMode capture_mode);
57 
58 }  // namespace net
59 
60 #endif  // NET_COOKIES_COOKIE_MONSTER_NETLOG_PARAMS_H_
61