forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrestricted_cookie_manager.h
73 lines (59 loc) · 2.5 KB
/
restricted_cookie_manager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_NETWORK_RESTRICTED_COOKIE_MANAGER_H_
#define CONTENT_NETWORK_RESTRICTED_COOKIE_MANAGER_H_
#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "net/cookies/canonical_cookie.h"
#include "services/network/public/interfaces/restricted_cookie_manager.mojom.h"
#include "url/gurl.h"
namespace net {
class CookieStore;
} // namespace net
namespace content {
// RestrictedCookieManager implementation.
//
// Instances of this class must be created and used on the I/O thread. Instances
// are created by CreateMojoService() and are bound to the lifetimes of the
// mojo connections that they serve, via mojo::StrongBinding.
class CONTENT_EXPORT RestrictedCookieManager
: public network::mojom::RestrictedCookieManager {
public:
RestrictedCookieManager(net::CookieStore* cookie_store,
int render_process_id,
int render_frame_id);
~RestrictedCookieManager() override;
// Implements CookieStore.getAll() in the Async Cookies API.
//
// This method is also used as the backend for CookieStore.get() and
// CookieStore.has().
void GetAllForUrl(const GURL& url,
const GURL& site_for_cookies,
network::mojom::CookieManagerGetOptionsPtr options,
GetAllForUrlCallback callback) override;
void SetCanonicalCookie(const net::CanonicalCookie& cookie,
const GURL& url,
const GURL& site_for_cookies,
SetCanonicalCookieCallback callback) override;
private:
// Feeds a net::CookieList to a GetAllForUrl() callback.
void CookieListToGetAllForUrlCallback(
const GURL& url,
const GURL& site_for_cookies,
network::mojom::CookieManagerGetOptionsPtr options,
GetAllForUrlCallback callback,
const net::CookieList& cookie_list);
net::CookieStore* cookie_store_;
const int render_process_id_;
const int render_frame_id_;
base::WeakPtrFactory<RestrictedCookieManager> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(RestrictedCookieManager);
};
} // namespace content
#endif // CONTENT_NETWORK_RESTRICTED_COOKIE_MANAGER_H_