OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This file provides the embedder's side of random webkit glue functions. | 5 // This file provides the embedder's side of random webkit glue functions. |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
11 #include <wininet.h> | 11 #include <wininet.h> |
12 #endif | 12 #endif |
13 | 13 |
14 #include "base/clipboard.h" | 14 #include "base/clipboard.h" |
15 #include "base/scoped_clipboard_writer.h" | 15 #include "base/scoped_clipboard_writer.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/render_messages.h" | 18 #include "chrome/common/render_messages.h" |
19 #include "chrome/common/resource_bundle.h" | 19 #include "chrome/common/resource_bundle.h" |
20 #include "chrome/plugin/npobject_util.h" | 20 #include "chrome/plugin/npobject_util.h" |
21 #include "chrome/renderer/net/render_dns_master.h" | 21 #include "chrome/renderer/net/render_dns_master.h" |
22 #include "chrome/renderer/render_process.h" | 22 #include "chrome/renderer/render_process.h" |
23 #include "chrome/renderer/render_thread.h" | 23 #include "chrome/renderer/render_thread.h" |
24 #include "chrome/renderer/render_view.h" | |
25 #include "googleurl/src/url_util.h" | 24 #include "googleurl/src/url_util.h" |
26 #include "webkit/glue/scoped_clipboard_writer_glue.h" | 25 #include "webkit/glue/scoped_clipboard_writer_glue.h" |
27 #include "webkit/glue/webframe.h" | 26 #include "webkit/glue/webframe.h" |
28 #include "webkit/glue/webkit_glue.h" | 27 #include "webkit/glue/webkit_glue.h" |
29 | 28 |
30 #include "WebKit.h" | 29 #include "WebKit.h" |
31 #include "WebKitClient.h" | 30 #include "WebKitClient.h" |
32 #include "WebString.h" | 31 #include "WebString.h" |
33 | 32 |
34 #include <vector> | 33 #include <vector> |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 222 |
224 webkit_glue::ScreenInfo GetScreenInfo(gfx::NativeViewId window) { | 223 webkit_glue::ScreenInfo GetScreenInfo(gfx::NativeViewId window) { |
225 webkit_glue::ScreenInfo results; | 224 webkit_glue::ScreenInfo results; |
226 RenderThread::current()->Send( | 225 RenderThread::current()->Send( |
227 new ViewHostMsg_GetScreenInfo(window, &results)); | 226 new ViewHostMsg_GetScreenInfo(window, &results)); |
228 return results; | 227 return results; |
229 } | 228 } |
230 | 229 |
231 // static factory function | 230 // static factory function |
232 ResourceLoaderBridge* ResourceLoaderBridge::Create( | 231 ResourceLoaderBridge* ResourceLoaderBridge::Create( |
233 WebFrame* webframe, | |
234 const std::string& method, | 232 const std::string& method, |
235 const GURL& url, | 233 const GURL& url, |
236 const GURL& policy_url, | 234 const GURL& policy_url, |
237 const GURL& referrer, | 235 const GURL& referrer, |
238 const std::string& headers, | 236 const std::string& headers, |
239 int load_flags, | 237 int load_flags, |
240 int origin_pid, | 238 int origin_pid, |
241 ResourceType::Type resource_type, | 239 ResourceType::Type resource_type, |
242 bool mixed_content) { | 240 bool mixed_content, |
243 // TODO(darin): we need to eliminate the webframe parameter because webkit | 241 int routing_id) { |
244 // does not always supply it (see ResourceHandle::loadResourceSynchronously). | |
245 // Instead we should add context to ResourceRequest, which will be easy to do | |
246 // once we merge to the latest WebKit (r23806 at least). | |
247 if (!webframe) { | |
248 NOTREACHED() << "no webframe"; | |
249 return NULL; | |
250 } | |
251 | |
252 if (!webframe->GetView()->GetDelegate()) | |
253 return NULL; | |
254 | |
255 RenderView* rv = static_cast<RenderView*>(webframe->GetView()->GetDelegate()); | |
256 int route_id = rv->routing_id(); | |
257 ResourceDispatcher* dispatch = RenderThread::current()->resource_dispatcher(); | 242 ResourceDispatcher* dispatch = RenderThread::current()->resource_dispatcher(); |
258 return dispatch->CreateBridge(method, url, policy_url, referrer, headers, | 243 return dispatch->CreateBridge(method, url, policy_url, referrer, headers, |
259 load_flags, origin_pid, resource_type, | 244 load_flags, origin_pid, resource_type, |
260 mixed_content, 0, route_id); | 245 mixed_content, 0, routing_id); |
261 } | 246 } |
262 | 247 |
263 void NotifyCacheStats() { | 248 void NotifyCacheStats() { |
264 // Update the browser about our cache | 249 // Update the browser about our cache |
265 // NOTE: Since this can be called from the plugin process, we might not have | 250 // NOTE: Since this can be called from the plugin process, we might not have |
266 // a RenderThread. Do nothing in that case. | 251 // a RenderThread. Do nothing in that case. |
267 if (!IsPluginProcess()) | 252 if (!IsPluginProcess()) |
268 RenderThread::current()->InformHostOfCacheStatsLater(); | 253 RenderThread::current()->InformHostOfCacheStatsLater(); |
269 } | 254 } |
270 | 255 |
271 | 256 |
272 } // namespace webkit_glue | 257 } // namespace webkit_glue |
OLD | NEW |