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/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/scoped_clipboard_writer.h" | 16 #include "base/scoped_clipboard_writer.h" |
17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
18 #include "chrome/renderer/net/render_dns_master.h" | 18 #include "chrome/renderer/net/render_dns_master.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/resource_bundle.h" | 20 #include "chrome/common/resource_bundle.h" |
21 #include "chrome/plugin/npobject_util.h" | 21 #include "chrome/plugin/npobject_util.h" |
22 #include "chrome/renderer/render_view.h" | 22 #include "chrome/renderer/render_view.h" |
23 #include "chrome/renderer/visitedlink_slave.h" | 23 #include "chrome/renderer/visitedlink_slave.h" |
24 #include "googleurl/src/url_util.h" | 24 #include "googleurl/src/url_util.h" |
25 #include "net/base/mime_util.h" | 25 #include "net/base/mime_util.h" |
| 26 #include "net/base/net_errors.h" |
26 #include "webkit/glue/scoped_clipboard_writer_glue.h" | 27 #include "webkit/glue/scoped_clipboard_writer_glue.h" |
27 #include "webkit/glue/webframe.h" | 28 #include "webkit/glue/webframe.h" |
28 #include "webkit/glue/webkit_glue.h" | 29 #include "webkit/glue/webkit_glue.h" |
29 | 30 |
30 #include <vector> | 31 #include <vector> |
31 | 32 |
32 #include "SkBitmap.h" | 33 #include "SkBitmap.h" |
33 | 34 |
34 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
35 #include <strsafe.h> // note: per msdn docs, this must *follow* other includes | 36 #include <strsafe.h> // note: per msdn docs, this must *follow* other includes |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 303 |
303 uint64 VisitedLinkHash(const char* canonical_url, size_t length) { | 304 uint64 VisitedLinkHash(const char* canonical_url, size_t length) { |
304 return g_render_thread->visited_link_slave()->ComputeURLFingerprint( | 305 return g_render_thread->visited_link_slave()->ComputeURLFingerprint( |
305 canonical_url, length); | 306 canonical_url, length); |
306 } | 307 } |
307 | 308 |
308 bool IsLinkVisited(uint64 link_hash) { | 309 bool IsLinkVisited(uint64 link_hash) { |
309 return g_render_thread->visited_link_slave()->IsVisited(link_hash); | 310 return g_render_thread->visited_link_slave()->IsVisited(link_hash); |
310 } | 311 } |
311 | 312 |
| 313 int ResolveProxyFromRenderThread(const GURL& url, std::string* proxy_result) { |
| 314 // Send a synchronous IPC from renderer process to the browser process to |
| 315 // resolve the proxy. (includes --single-process case). |
| 316 int net_error; |
| 317 bool ipc_ok = g_render_thread->Send( |
| 318 new ViewHostMsg_ResolveProxy(url, &net_error, proxy_result)); |
| 319 return ipc_ok ? net_error : net::ERR_UNEXPECTED; |
| 320 } |
| 321 |
312 #ifndef USING_SIMPLE_RESOURCE_LOADER_BRIDGE | 322 #ifndef USING_SIMPLE_RESOURCE_LOADER_BRIDGE |
313 | 323 |
314 // Each RenderView has a ResourceDispatcher. In unit tests, this function may | 324 // Each RenderView has a ResourceDispatcher. In unit tests, this function may |
315 // not work properly since there may be a ResourceDispatcher w/o a RenderView. | 325 // not work properly since there may be a ResourceDispatcher w/o a RenderView. |
316 // The WebView's delegate may be null, which typically happens as a WebView is | 326 // The WebView's delegate may be null, which typically happens as a WebView is |
317 // being closed (but it is also possible that it could be null at other times | 327 // being closed (but it is also possible that it could be null at other times |
318 // since WebView has a SetDelegate method). | 328 // since WebView has a SetDelegate method). |
319 static ResourceDispatcher* GetResourceDispatcher(WebFrame* frame) { | 329 static ResourceDispatcher* GetResourceDispatcher(WebFrame* frame) { |
320 WebViewDelegate* d = frame->GetView()->GetDelegate(); | 330 WebViewDelegate* d = frame->GetView()->GetDelegate(); |
321 return d ? static_cast<RenderView*>(d)->resource_dispatcher() : NULL; | 331 return d ? static_cast<RenderView*>(d)->resource_dispatcher() : NULL; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 // NOTE: Since this can be called from the plugin process, we might not have | 377 // NOTE: Since this can be called from the plugin process, we might not have |
368 // a RenderThread. Do nothing in that case. | 378 // a RenderThread. Do nothing in that case. |
369 if (g_render_thread) | 379 if (g_render_thread) |
370 g_render_thread->InformHostOfCacheStatsLater(); | 380 g_render_thread->InformHostOfCacheStatsLater(); |
371 } | 381 } |
372 | 382 |
373 #endif // !USING_SIMPLE_RESOURCE_LOADER_BRIDGE | 383 #endif // !USING_SIMPLE_RESOURCE_LOADER_BRIDGE |
374 | 384 |
375 } // namespace webkit_glue | 385 } // namespace webkit_glue |
376 | 386 |
OLD | NEW |