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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 void RendererWebKitClientImpl::prefetchHostName(const WebString& hostname) { | 72 void RendererWebKitClientImpl::prefetchHostName(const WebString& hostname) { |
73 if (!hostname.isEmpty()) { | 73 if (!hostname.isEmpty()) { |
74 std::string hostname_utf8; | 74 std::string hostname_utf8; |
75 UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8); | 75 UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8); |
76 DnsPrefetchCString(hostname_utf8.data(), hostname_utf8.length()); | 76 DnsPrefetchCString(hostname_utf8.data(), hostname_utf8.length()); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
| 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 |
80 WebString RendererWebKitClientImpl::defaultLocale() { | 92 WebString RendererWebKitClientImpl::defaultLocale() { |
81 // TODO(darin): Eliminate this webkit_glue call. | 93 // TODO(darin): Eliminate this webkit_glue call. |
82 return WideToUTF16(webkit_glue::GetWebKitLocale()); | 94 return WideToUTF16(webkit_glue::GetWebKitLocale()); |
83 } | 95 } |
84 | 96 |
85 void RendererWebKitClientImpl::suddenTerminationChanged(bool enabled) { | 97 void RendererWebKitClientImpl::suddenTerminationChanged(bool enabled) { |
86 RenderThread* thread = RenderThread::current(); | 98 RenderThread* thread = RenderThread::current(); |
87 if (thread) // NULL in unittests. | 99 if (thread) // NULL in unittests. |
88 thread->Send(new ViewHostMsg_SuddenTerminationChanged(enabled)); | 100 thread->Send(new ViewHostMsg_SuddenTerminationChanged(enabled)); |
89 } | 101 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 return WebString::fromUTF8(iter->second.data(), iter->second.size()); | 168 return WebString::fromUTF8(iter->second.data(), iter->second.size()); |
157 | 169 |
158 const std::string family_name = | 170 const std::string family_name = |
159 renderer_sandbox_support::getFontFamilyForCharacters(characters, | 171 renderer_sandbox_support::getFontFamilyForCharacters(characters, |
160 num_characters); | 172 num_characters); |
161 unicode_font_families_.insert(make_pair(key, family_name)); | 173 unicode_font_families_.insert(make_pair(key, family_name)); |
162 return WebString::fromUTF8(family_name); | 174 return WebString::fromUTF8(family_name); |
163 } | 175 } |
164 | 176 |
165 #endif | 177 #endif |
OLD | NEW |