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

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

Issue 294025: DevTools: Implement raw cookies access for inspector. (Closed)
Patch Set: '' Created 11 years, 1 month 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 (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "chrome/renderer/renderer_webkitclient_impl.h" 5 #include "chrome/renderer/renderer_webkitclient_impl.h"
6 6
7 #if defined(USE_SYSTEM_SQLITE) 7 #if defined(USE_SYSTEM_SQLITE)
8 #include <sqlite3.h> 8 #include <sqlite3.h>
9 #else 9 #else
10 #include "third_party/sqlite/preprocessed/sqlite3.h" 10 #include "third_party/sqlite/preprocessed/sqlite3.h"
11 #endif 11 #endif
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/platform_file.h" 15 #include "base/platform_file.h"
16 #include "chrome/common/appcache/appcache_dispatcher.h" 16 #include "chrome/common/appcache/appcache_dispatcher.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/db_message_filter.h" 18 #include "chrome/common/db_message_filter.h"
19 #include "chrome/common/render_messages.h" 19 #include "chrome/common/render_messages.h"
20 #include "chrome/common/webmessageportchannel_impl.h" 20 #include "chrome/common/webmessageportchannel_impl.h"
21 #include "chrome/plugin/npobject_util.h" 21 #include "chrome/plugin/npobject_util.h"
22 #include "chrome/renderer/net/render_dns_master.h" 22 #include "chrome/renderer/net/render_dns_master.h"
23 #include "chrome/renderer/render_thread.h" 23 #include "chrome/renderer/render_thread.h"
24 #include "chrome/renderer/renderer_webstoragenamespace_impl.h" 24 #include "chrome/renderer/renderer_webstoragenamespace_impl.h"
25 #include "chrome/renderer/visitedlink_slave.h" 25 #include "chrome/renderer/visitedlink_slave.h"
26 #include "googleurl/src/gurl.h" 26 #include "googleurl/src/gurl.h"
27 #include "webkit/api/public/WebCookie.h"
27 #include "webkit/api/public/WebString.h" 28 #include "webkit/api/public/WebString.h"
28 #include "webkit/api/public/WebURL.h" 29 #include "webkit/api/public/WebURL.h"
30 #include "webkit/api/public/WebVector.h"
29 #include "webkit/appcache/web_application_cache_host_impl.h" 31 #include "webkit/appcache/web_application_cache_host_impl.h"
30 #include "webkit/glue/glue_util.h" 32 #include "webkit/glue/glue_util.h"
31 #include "webkit/glue/webkit_glue.h" 33 #include "webkit/glue/webkit_glue.h"
32 34
33 #if defined(OS_LINUX) 35 #if defined(OS_LINUX)
34 #include "chrome/renderer/renderer_sandbox_support_linux.h" 36 #include "chrome/renderer/renderer_sandbox_support_linux.h"
35 #endif 37 #endif
36 38
37 #if defined(OS_POSIX) 39 #if defined(OS_POSIX)
38 #include "base/file_descriptor_posix.h" 40 #include "base/file_descriptor_posix.h"
39 #endif 41 #endif
40 42
41 using WebKit::WebApplicationCacheHost; 43 using WebKit::WebApplicationCacheHost;
42 using WebKit::WebApplicationCacheHostClient; 44 using WebKit::WebApplicationCacheHostClient;
45 using WebKit::WebCookie;
43 using WebKit::WebKitClient; 46 using WebKit::WebKitClient;
44 using WebKit::WebStorageArea; 47 using WebKit::WebStorageArea;
45 using WebKit::WebStorageNamespace; 48 using WebKit::WebStorageNamespace;
46 using WebKit::WebString; 49 using WebKit::WebString;
47 using WebKit::WebURL; 50 using WebKit::WebURL;
51 using WebKit::WebVector;
48 52
49 //------------------------------------------------------------------------------ 53 //------------------------------------------------------------------------------
50 54
51 WebKit::WebClipboard* RendererWebKitClientImpl::clipboard() { 55 WebKit::WebClipboard* RendererWebKitClientImpl::clipboard() {
52 return &clipboard_; 56 return &clipboard_;
53 } 57 }
54 58
55 WebKit::WebMimeRegistry* RendererWebKitClientImpl::mimeRegistry() { 59 WebKit::WebMimeRegistry* RendererWebKitClientImpl::mimeRegistry() {
56 return &mime_registry_; 60 return &mime_registry_;
57 } 61 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 117 }
114 118
115 WebString RendererWebKitClientImpl::cookies( 119 WebString RendererWebKitClientImpl::cookies(
116 const WebURL& url, const WebURL& first_party_for_cookies) { 120 const WebURL& url, const WebURL& first_party_for_cookies) {
117 std::string value_utf8; 121 std::string value_utf8;
118 RenderThread::current()->Send( 122 RenderThread::current()->Send(
119 new ViewHostMsg_GetCookies(url, first_party_for_cookies, &value_utf8)); 123 new ViewHostMsg_GetCookies(url, first_party_for_cookies, &value_utf8));
120 return WebString::fromUTF8(value_utf8); 124 return WebString::fromUTF8(value_utf8);
121 } 125 }
122 126
127 bool RendererWebKitClientImpl::rawCookies(
128 const WebURL& url,
129 const WebURL& first_party_for_cookies,
130 WebVector<WebKit::WebCookie>* raw_cookies) {
131 std::vector<webkit_glue::WebCookie> cookies;
132 RenderThread::current()->Send(
133 new ViewHostMsg_GetRawCookies(url, first_party_for_cookies, &cookies));
134
135 WebVector<WebKit::WebCookie> result(cookies.size());
136 int i = 0;
137 for (std::vector<webkit_glue::WebCookie>::iterator it = cookies.begin();
138 it != cookies.end(); ++it)
139 result[i++] = WebKit::WebCookie(WebString::fromUTF8(it->name),
140 WebString::fromUTF8(it->value),
141 WebString::fromUTF8(it->domain),
142 WebString::fromUTF8(it->path),
143 it->expires,
144 it->http_only,
145 it->secure,
146 it->session);
147 raw_cookies->assign(result);
148 return true;
149 }
150
151 void RendererWebKitClientImpl::deleteCookie(const WebURL& url,
152 const WebString& cookie_name) {
153 std::string cookie_name_utf8;
154 UTF16ToUTF8(cookie_name.data(), cookie_name.length(), &cookie_name_utf8);
155 RenderThread::current()->Send(
156 new ViewHostMsg_DeleteCookie(url, cookie_name_utf8));
157 }
158
123 void RendererWebKitClientImpl::prefetchHostName(const WebString& hostname) { 159 void RendererWebKitClientImpl::prefetchHostName(const WebString& hostname) {
124 if (!hostname.isEmpty()) { 160 if (!hostname.isEmpty()) {
125 std::string hostname_utf8; 161 std::string hostname_utf8;
126 UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8); 162 UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8);
127 DnsPrefetchCString(hostname_utf8.data(), hostname_utf8.length()); 163 DnsPrefetchCString(hostname_utf8.data(), hostname_utf8.length());
128 } 164 }
129 } 165 }
130 166
131 WebString RendererWebKitClientImpl::defaultLocale() { 167 WebString RendererWebKitClientImpl::defaultLocale() {
132 // TODO(darin): Eliminate this webkit_glue call. 168 // TODO(darin): Eliminate this webkit_glue call.
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 const WebKit::WebString& challenge, 359 const WebKit::WebString& challenge,
324 const WebKit::WebURL& url) { 360 const WebKit::WebURL& url) {
325 std::string signed_public_key; 361 std::string signed_public_key;
326 RenderThread::current()->Send(new ViewHostMsg_Keygen( 362 RenderThread::current()->Send(new ViewHostMsg_Keygen(
327 static_cast<uint32>(key_size_index), 363 static_cast<uint32>(key_size_index),
328 webkit_glue::WebStringToStdString(challenge), 364 webkit_glue::WebStringToStdString(challenge),
329 GURL(url) , 365 GURL(url) ,
330 &signed_public_key)); 366 &signed_public_key));
331 return webkit_glue::StdStringToWebString(signed_public_key); 367 return webkit_glue::StdStringToWebString(signed_public_key);
332 } 368 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698