OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 CONTENT_COMMON_COOKIE_SERVICE_H_ |
| 6 #define CONTENT_COMMON_COOKIE_SERVICE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "content/common/cookies.mojom.h" |
| 11 #include "mojo/public/cpp/bindings/binding_set.h" |
| 12 |
| 13 class GURL; |
| 14 |
| 15 namespace net { |
| 16 class CookieStore; |
| 17 } |
| 18 |
| 19 namespace content { |
| 20 |
| 21 // Wrap a cookie store in an implementation of the mojo cookie interface. |
| 22 |
| 23 // This is an IO thread object; all methods on this object must be called on |
| 24 // the IO thread. Note that this does not restrict the locations from which |
| 25 // mojo messages may be sent to the object. |
| 26 class CookieServiceImpl : public content::mojom::CookieService { |
| 27 // Construct a CookieService that can serve mojo requests for the underlying |
| 28 // cookie store. |*cookie_store| must outlive this object. |
| 29 CookieServiceImpl(net::CookieStore* cookie_store); |
| 30 |
| 31 ~CookieServiceImpl() override; |
| 32 |
| 33 // Associated a cookie request pointer with this object. Mojo messages |
| 34 // coming through the associated pipe will be served by this object. |
| 35 void AddRequest(content::mojom::CookieServiceRequest request); |
| 36 |
| 37 // TODO(rdsmith): Add a verion of AddRequest that does renderer-appropriate |
| 38 // security checks on bindings coming through that interface. |
| 39 |
| 40 private: |
| 41 // content::mojom::Cookies |
| 42 void GetAllCookies(GetAllCookiesCallback callback) override; |
| 43 void GetCookieList(const GURL& url, |
| 44 const net::CookieOptions& cookie_options, |
| 45 GetCookieListCallback callback) override; |
| 46 void SetCanonicalCookie(const net::CanonicalCookie& cookie, |
| 47 bool secure_source, |
| 48 bool modify_http_only, |
| 49 SetCanonicalCookieCallback callback) override; |
| 50 void DeleteCookies(content::mojom::CookieDeletionFilterPtr filter, |
| 51 DeleteCookiesCallback callback) override; |
| 52 void RequestNotification( |
| 53 const GURL& url, |
| 54 const std::string& name, |
| 55 content::mojom::CookieChangeNotificationRequest notification_interface, |
| 56 RequestNotificationCallback callback) override; |
| 57 void CloneInterface( |
| 58 content::mojom::CookieServiceRequest new_interface) override; |
| 59 |
| 60 net::CookieStore* cookie_store_; |
| 61 mojo::BindingSet<content::mojom::CookieService> bindings_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(CookieServiceImpl); |
| 64 }; |
| 65 |
| 66 } // namespace content |
| 67 |
| 68 #endif // CONTENT_COMMON_COOKIE_SERVICE_H_ |
OLD | NEW |