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

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

Issue 6713024: Move the renderer_web* files to content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/renderer/renderer_webcookiejar_impl.h"
6
7 #include "base/utf_string_conversions.h"
8 #include "chrome/common/render_messages.h"
9 #include "chrome/renderer/render_thread.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCookie.h"
11 #include "webkit/glue/webcookie.h"
12
13 using WebKit::WebCookie;
14 using WebKit::WebString;
15 using WebKit::WebURL;
16 using WebKit::WebVector;
17
18 void RendererWebCookieJarImpl::setCookie(
19 const WebURL& url, const WebURL& first_party_for_cookies,
20 const WebString& value) {
21 std::string value_utf8;
22 UTF16ToUTF8(value.data(), value.length(), &value_utf8);
23 sender_->Send(new ViewHostMsg_SetCookie(
24 MSG_ROUTING_NONE, url, first_party_for_cookies, value_utf8));
25 }
26
27 WebString RendererWebCookieJarImpl::cookies(
28 const WebURL& url, const WebURL& first_party_for_cookies) {
29 std::string value_utf8;
30 // NOTE: This may pump events (see RenderThread::Send).
31 sender_->Send(new ViewHostMsg_GetCookies(
32 MSG_ROUTING_NONE, url, first_party_for_cookies, &value_utf8));
33 return WebString::fromUTF8(value_utf8);
34 }
35
36 WebString RendererWebCookieJarImpl::cookieRequestHeaderFieldValue(
37 const WebURL& url, const WebURL& first_party_for_cookies) {
38 return cookies(url, first_party_for_cookies);
39 }
40
41 void RendererWebCookieJarImpl::rawCookies(
42 const WebURL& url, const WebURL& first_party_for_cookies,
43 WebVector<WebCookie>& raw_cookies) {
44 std::vector<webkit_glue::WebCookie> cookies;
45 // NOTE: This may pump events (see RenderThread::Send).
46 sender_->Send(new ViewHostMsg_GetRawCookies(
47 MSG_ROUTING_NONE, url, first_party_for_cookies, &cookies));
48
49 WebVector<WebCookie> result(cookies.size());
50 int i = 0;
51 for (std::vector<webkit_glue::WebCookie>::iterator it = cookies.begin();
52 it != cookies.end(); ++it) {
53 result[i++] = WebCookie(WebString::fromUTF8(it->name),
54 WebString::fromUTF8(it->value),
55 WebString::fromUTF8(it->domain),
56 WebString::fromUTF8(it->path),
57 it->expires,
58 it->http_only,
59 it->secure,
60 it->session);
61 }
62 raw_cookies.swap(result);
63 }
64
65 void RendererWebCookieJarImpl::deleteCookie(
66 const WebURL& url, const WebString& cookie_name) {
67 std::string cookie_name_utf8;
68 UTF16ToUTF8(cookie_name.data(), cookie_name.length(), &cookie_name_utf8);
69 sender_->Send(new ViewHostMsg_DeleteCookie(url, cookie_name_utf8));
70 }
71
72 bool RendererWebCookieJarImpl::cookiesEnabled(
73 const WebURL& url, const WebURL& first_party_for_cookies) {
74 bool cookies_enabled;
75 // NOTE: This may pump events (see RenderThread::Send).
76 sender_->Send(new ViewHostMsg_CookiesEnabled(
77 MSG_ROUTING_NONE, url, first_party_for_cookies, &cookies_enabled));
78 return cookies_enabled;
79 }
OLDNEW
« no previous file with comments | « chrome/renderer/renderer_webcookiejar_impl.h ('k') | chrome/renderer/renderer_webidbcursor_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698