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

Unified Diff: content/common/cookie_service_impl.h

Issue 2908443002: Initial implementation of Cookie service.
Patch Set: Got initial implementation compiling. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/common/cookie_service_impl.h
diff --git a/content/common/cookie_service_impl.h b/content/common/cookie_service_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..21165a23ff81059c1c9423d5c80b380eb28f64fc
--- /dev/null
+++ b/content/common/cookie_service_impl.h
@@ -0,0 +1,68 @@
+// 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_COMMON_COOKIE_SERVICE_H_
yzshen1 2017/06/20 18:33:16 Please match the file path exactly.
+#define CONTENT_COMMON_COOKIE_SERVICE_H_
+
+#include <string>
+
+#include "content/common/cookies.mojom.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+
+class GURL;
+
+namespace net {
+class CookieStore;
+}
+
+namespace content {
+
+// Wrap a cookie store in an implementation of the mojo cookie interface.
+
+// This is an IO thread object; all methods on this object must be called on
+// the IO thread. Note that this does not restrict the locations from which
+// mojo messages may be sent to the object.
+class CookieServiceImpl : public content::mojom::CookieService {
+ // Construct a CookieService that can serve mojo requests for the underlying
+ // cookie store. |*cookie_store| must outlive this object.
+ CookieServiceImpl(net::CookieStore* cookie_store);
+
+ ~CookieServiceImpl() override;
+
+ // Associated a cookie request pointer with this object. Mojo messages
yzshen1 2017/06/20 18:33:17 It would be nice to use "bind...to" instead of "as
+ // coming through the associated pipe will be served by this object.
+ void AddRequest(content::mojom::CookieServiceRequest request);
+
+ // TODO(rdsmith): Add a verion of AddRequest that does renderer-appropriate
+ // security checks on bindings coming through that interface.
+
+ private:
+ // content::mojom::Cookies
+ void GetAllCookies(GetAllCookiesCallback callback) override;
+ void GetCookieList(const GURL& url,
+ const net::CookieOptions& cookie_options,
+ GetCookieListCallback callback) override;
+ void SetCanonicalCookie(const net::CanonicalCookie& cookie,
+ bool secure_source,
+ bool modify_http_only,
+ SetCanonicalCookieCallback callback) override;
+ void DeleteCookies(content::mojom::CookieDeletionFilterPtr filter,
+ DeleteCookiesCallback callback) override;
+ void RequestNotification(
+ const GURL& url,
+ const std::string& name,
+ content::mojom::CookieChangeNotificationRequest notification_interface,
+ RequestNotificationCallback callback) override;
+ void CloneInterface(
+ content::mojom::CookieServiceRequest new_interface) override;
+
+ net::CookieStore* cookie_store_;
+ mojo::BindingSet<content::mojom::CookieService> bindings_;
+
+ DISALLOW_COPY_AND_ASSIGN(CookieServiceImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_COOKIE_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698