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

Side by Side Diff: mojo/services/network/cookie_store_impl.cc

Issue 1227373002: Roll mojo SDK to 734c6e1652ff2f3b696e441722838f453f4f9b42 (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 5 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "mojo/services/network/cookie_store_impl.h" 5 #include "mojo/services/network/cookie_store_impl.h"
6 6
7 #include "mojo/common/url_type_converters.h" 7 #include "mojo/common/url_type_converters.h"
8 #include "mojo/services/network/network_context.h" 8 #include "mojo/services/network/network_context.h"
9 #include "net/cookies/cookie_store.h" 9 #include "net/cookies/cookie_store.h"
10 #include "net/url_request/url_request_context.h" 10 #include "net/url_request/url_request_context.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace { 13 namespace {
14 14
15 void AdaptGetCookiesCallback(const Callback<void(String)>& callback, 15 void AdaptGetCookiesCallback(const Callback<void(String)>& callback,
16 const std::string& cookies) { 16 const std::string& cookies) {
17 callback.Run(cookies); 17 callback.Run(cookies);
18 } 18 }
19 19
20 void AdaptSetCookieCallback(const Callback<void(bool)>& callback, 20 void AdaptSetCookieCallback(const Callback<void(bool)>& callback,
21 bool success) { 21 bool success) {
22 callback.Run(success); 22 callback.Run(success);
23 } 23 }
24 24
25 } // namespace 25 } // namespace
26 26
27 CookieStoreImpl::CookieStoreImpl(NetworkContext* context, const GURL& origin) 27 CookieStoreImpl::CookieStoreImpl(InterfaceRequest<CookieStore> request,
28 : context_(context), origin_(origin) { 28 NetworkContext* context,
29 const GURL& origin)
30 : context_(context), origin_(origin), binding_(this, request.Pass()) {
29 } 31 }
30 32
31 CookieStoreImpl::~CookieStoreImpl() { 33 CookieStoreImpl::~CookieStoreImpl() {
32 } 34 }
33 35
34 void CookieStoreImpl::Get(const String& url, 36 void CookieStoreImpl::Get(const String& url,
35 const Callback<void(String)>& callback) { 37 const Callback<void(String)>& callback) {
36 // TODO(darin): Perform origin restriction. 38 // TODO(darin): Perform origin restriction.
37 net::CookieStore* store = context_->url_request_context()->cookie_store(); 39 net::CookieStore* store = context_->url_request_context()->cookie_store();
38 if (!store) { 40 if (!store) {
(...skipping 16 matching lines...) Expand all
55 return; 57 return;
56 } 58 }
57 store->SetCookieWithOptionsAsync( 59 store->SetCookieWithOptionsAsync(
58 url.To<GURL>(), 60 url.To<GURL>(),
59 cookie, 61 cookie,
60 net::CookieOptions(), 62 net::CookieOptions(),
61 base::Bind(&AdaptSetCookieCallback, callback)); 63 base::Bind(&AdaptSetCookieCallback, callback));
62 } 64 }
63 65
64 } // namespace mojo 66 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698