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

Side by Side Diff: content/renderer/renderer_webcookiejar_impl.cc

Issue 1082623002: Remove GetRawCookies and DeleteCookie implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « content/renderer/renderer_webcookiejar_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "content/renderer/renderer_webcookiejar_impl.h" 5 #include "content/renderer/renderer_webcookiejar_impl.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/common/cookie_data.h"
9 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
10 #include "content/public/renderer/content_renderer_client.h" 9 #include "content/public/renderer/content_renderer_client.h"
11 #include "content/renderer/render_view_impl.h" 10 #include "content/renderer/render_view_impl.h"
12 #include "third_party/WebKit/public/platform/WebCookie.h"
13 11
14 using blink::WebCookie;
15 using blink::WebString; 12 using blink::WebString;
16 using blink::WebURL; 13 using blink::WebURL;
17 using blink::WebVector;
18 14
19 namespace content { 15 namespace content {
20 16
21 void RendererWebCookieJarImpl::setCookie( 17 void RendererWebCookieJarImpl::setCookie(
22 const WebURL& url, const WebURL& first_party_for_cookies, 18 const WebURL& url, const WebURL& first_party_for_cookies,
23 const WebString& value) { 19 const WebString& value) {
24 std::string value_utf8 = base::UTF16ToUTF8(value); 20 std::string value_utf8 = base::UTF16ToUTF8(value);
25 sender_->Send(new ViewHostMsg_SetCookie( 21 sender_->Send(new ViewHostMsg_SetCookie(
26 sender_->GetRoutingID(), url, first_party_for_cookies, value_utf8)); 22 sender_->GetRoutingID(), url, first_party_for_cookies, value_utf8));
27 } 23 }
28 24
29 WebString RendererWebCookieJarImpl::cookies( 25 WebString RendererWebCookieJarImpl::cookies(
30 const WebURL& url, const WebURL& first_party_for_cookies) { 26 const WebURL& url, const WebURL& first_party_for_cookies) {
31 std::string value_utf8; 27 std::string value_utf8;
32 sender_->Send(new ViewHostMsg_GetCookies( 28 sender_->Send(new ViewHostMsg_GetCookies(
33 sender_->GetRoutingID(), url, first_party_for_cookies, &value_utf8)); 29 sender_->GetRoutingID(), url, first_party_for_cookies, &value_utf8));
34 return WebString::fromUTF8(value_utf8); 30 return WebString::fromUTF8(value_utf8);
35 } 31 }
36 32
37 WebString RendererWebCookieJarImpl::cookieRequestHeaderFieldValue( 33 WebString RendererWebCookieJarImpl::cookieRequestHeaderFieldValue(
38 const WebURL& url, const WebURL& first_party_for_cookies) { 34 const WebURL& url, const WebURL& first_party_for_cookies) {
39 return cookies(url, first_party_for_cookies); 35 return cookies(url, first_party_for_cookies);
40 } 36 }
41 37
42 void RendererWebCookieJarImpl::rawCookies(
43 const WebURL& url, const WebURL& first_party_for_cookies,
44 WebVector<WebCookie>& raw_cookies) {
45 std::vector<CookieData> cookies;
46 sender_->Send(new ViewHostMsg_GetRawCookies(
47 url, first_party_for_cookies, &cookies));
48
49 WebVector<WebCookie> result(cookies.size());
50 for (size_t i = 0; i < cookies.size(); ++i) {
51 const CookieData& c = cookies[i];
52 result[i] = WebCookie(WebString::fromUTF8(c.name),
53 WebString::fromUTF8(c.value),
54 WebString::fromUTF8(c.domain),
55 WebString::fromUTF8(c.path),
56 c.expires,
57 c.http_only,
58 c.secure,
59 c.session);
60 }
61 raw_cookies.swap(result);
62 }
63
64 void RendererWebCookieJarImpl::deleteCookie(
65 const WebURL& url, const WebString& cookie_name) {
66 std::string cookie_name_utf8 = base::UTF16ToUTF8(cookie_name);
67 sender_->Send(new ViewHostMsg_DeleteCookie(url, cookie_name_utf8));
68 }
69
70 bool RendererWebCookieJarImpl::cookiesEnabled( 38 bool RendererWebCookieJarImpl::cookiesEnabled(
71 const WebURL& url, const WebURL& first_party_for_cookies) { 39 const WebURL& url, const WebURL& first_party_for_cookies) {
72 bool cookies_enabled = false; 40 bool cookies_enabled = false;
73 sender_->Send(new ViewHostMsg_CookiesEnabled( 41 sender_->Send(new ViewHostMsg_CookiesEnabled(
74 sender_->GetRoutingID(), url, first_party_for_cookies, &cookies_enabled)); 42 sender_->GetRoutingID(), url, first_party_for_cookies, &cookies_enabled));
75 return cookies_enabled; 43 return cookies_enabled;
76 } 44 }
77 45
78 } // namespace content 46 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_webcookiejar_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698