| OLD | NEW |
| 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 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "chrome/plugin/npobject_util.h" | 10 #include "chrome/plugin/npobject_util.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 WebKit::WebSandboxSupport* RendererWebKitClientImpl::sandboxSupport() { | 36 WebKit::WebSandboxSupport* RendererWebKitClientImpl::sandboxSupport() { |
| 37 #if defined(OS_WIN) || defined(OS_LINUX) | 37 #if defined(OS_WIN) || defined(OS_LINUX) |
| 38 return &sandbox_support_; | 38 return &sandbox_support_; |
| 39 #else | 39 #else |
| 40 return NULL; | 40 return NULL; |
| 41 #endif | 41 #endif |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool RendererWebKitClientImpl::getFileSize(const WebString& path, |
| 45 long long& result) { |
| 46 if (RenderThread::current()->Send(new ViewHostMsg_GetFileSize( |
| 47 FilePath(webkit_glue::WebStringToFilePathString(path)), |
| 48 &result))) { |
| 49 return result >= 0; |
| 50 } else { |
| 51 result = -1; |
| 52 return false; |
| 53 } |
| 54 } |
| 55 |
| 44 unsigned long long RendererWebKitClientImpl::visitedLinkHash( | 56 unsigned long long RendererWebKitClientImpl::visitedLinkHash( |
| 45 const char* canonical_url, | 57 const char* canonical_url, |
| 46 size_t length) { | 58 size_t length) { |
| 47 return RenderThread::current()->visited_link_slave()->ComputeURLFingerprint( | 59 return RenderThread::current()->visited_link_slave()->ComputeURLFingerprint( |
| 48 canonical_url, length); | 60 canonical_url, length); |
| 49 } | 61 } |
| 50 | 62 |
| 51 bool RendererWebKitClientImpl::isLinkVisited(unsigned long long link_hash) { | 63 bool RendererWebKitClientImpl::isLinkVisited(unsigned long long link_hash) { |
| 52 return RenderThread::current()->visited_link_slave()->IsVisited(link_hash); | 64 return RenderThread::current()->visited_link_slave()->IsVisited(link_hash); |
| 53 } | 65 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 70 } | 82 } |
| 71 | 83 |
| 72 void RendererWebKitClientImpl::prefetchHostName(const WebString& hostname) { | 84 void RendererWebKitClientImpl::prefetchHostName(const WebString& hostname) { |
| 73 if (!hostname.isEmpty()) { | 85 if (!hostname.isEmpty()) { |
| 74 std::string hostname_utf8; | 86 std::string hostname_utf8; |
| 75 UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8); | 87 UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8); |
| 76 DnsPrefetchCString(hostname_utf8.data(), hostname_utf8.length()); | 88 DnsPrefetchCString(hostname_utf8.data(), hostname_utf8.length()); |
| 77 } | 89 } |
| 78 } | 90 } |
| 79 | 91 |
| 80 bool RendererWebKitClientImpl::getFileSize(const WebString& path, | |
| 81 long long& result) { | |
| 82 if (RenderThread::current()->Send(new ViewHostMsg_GetFileSize( | |
| 83 FilePath(webkit_glue::WebStringToFilePathString(path)), | |
| 84 &result))) { | |
| 85 return result >= 0; | |
| 86 } else { | |
| 87 result = -1; | |
| 88 return false; | |
| 89 } | |
| 90 } | |
| 91 | |
| 92 WebString RendererWebKitClientImpl::defaultLocale() { | 92 WebString RendererWebKitClientImpl::defaultLocale() { |
| 93 // TODO(darin): Eliminate this webkit_glue call. | 93 // TODO(darin): Eliminate this webkit_glue call. |
| 94 return WideToUTF16(webkit_glue::GetWebKitLocale()); | 94 return WideToUTF16(webkit_glue::GetWebKitLocale()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void RendererWebKitClientImpl::suddenTerminationChanged(bool enabled) { | 97 void RendererWebKitClientImpl::suddenTerminationChanged(bool enabled) { |
| 98 RenderThread* thread = RenderThread::current(); | 98 RenderThread* thread = RenderThread::current(); |
| 99 if (thread) // NULL in unittests. | 99 if (thread) // NULL in unittests. |
| 100 thread->Send(new ViewHostMsg_SuddenTerminationChanged(enabled)); | 100 thread->Send(new ViewHostMsg_SuddenTerminationChanged(enabled)); |
| 101 } | 101 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return WebString::fromUTF8(iter->second.data(), iter->second.size()); | 168 return WebString::fromUTF8(iter->second.data(), iter->second.size()); |
| 169 | 169 |
| 170 const std::string family_name = | 170 const std::string family_name = |
| 171 renderer_sandbox_support::getFontFamilyForCharacters(characters, | 171 renderer_sandbox_support::getFontFamilyForCharacters(characters, |
| 172 num_characters); | 172 num_characters); |
| 173 unicode_font_families_.insert(make_pair(key, family_name)); | 173 unicode_font_families_.insert(make_pair(key, family_name)); |
| 174 return WebString::fromUTF8(family_name); | 174 return WebString::fromUTF8(family_name); |
| 175 } | 175 } |
| 176 | 176 |
| 177 #endif | 177 #endif |
| OLD | NEW |