| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #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 "base/shared_memory.h" |
| 16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/common/database_util.h" | 18 #include "chrome/common/database_util.h" |
| 19 #include "chrome/common/font_loader_mac.h" |
| 18 #include "chrome/common/render_messages.h" | 20 #include "chrome/common/render_messages.h" |
| 19 #include "chrome/common/webmessageportchannel_impl.h" | 21 #include "chrome/common/webmessageportchannel_impl.h" |
| 20 #include "chrome/plugin/npobject_util.h" | 22 #include "chrome/plugin/npobject_util.h" |
| 21 #include "chrome/renderer/net/render_dns_master.h" | 23 #include "chrome/renderer/net/render_dns_master.h" |
| 22 #include "chrome/renderer/render_thread.h" | 24 #include "chrome/renderer/render_thread.h" |
| 23 #include "chrome/renderer/render_view.h" | 25 #include "chrome/renderer/render_view.h" |
| 24 #include "chrome/renderer/renderer_webindexeddatabase_impl.h" | 26 #include "chrome/renderer/renderer_webindexeddatabase_impl.h" |
| 25 #include "chrome/renderer/renderer_webstoragenamespace_impl.h" | 27 #include "chrome/renderer/renderer_webstoragenamespace_impl.h" |
| 26 #include "chrome/renderer/visitedlink_slave.h" | 28 #include "chrome/renderer/visitedlink_slave.h" |
| 27 #include "chrome/renderer/webgles2context_impl.h" | 29 #include "chrome/renderer/webgles2context_impl.h" |
| 28 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" | 30 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" |
| 29 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
| 30 #include "ipc/ipc_sync_message_filter.h" | 32 #include "ipc/ipc_sync_message_filter.h" |
| 31 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 33 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 32 #include "third_party/WebKit/WebKit/chromium/public/WebGraphicsContext3D.h" | 34 #include "third_party/WebKit/WebKit/chromium/public/WebGraphicsContext3D.h" |
| 33 #include "third_party/WebKit/WebKit/chromium/public/WebIndexedDatabase.h" | 35 #include "third_party/WebKit/WebKit/chromium/public/WebIndexedDatabase.h" |
| 34 #include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h" | 36 #include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h" |
| 35 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | |
| 36 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 37 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
| 37 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" | 38 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" |
| 38 #include "webkit/glue/webkit_glue.h" | 39 #include "webkit/glue/webkit_glue.h" |
| 39 | 40 |
| 41 #if defined(OS_MACOSX) |
| 42 #include "chrome/common/font_descriptor_mac.h" |
| 43 #endif |
| 44 |
| 40 #if defined(OS_LINUX) | 45 #if defined(OS_LINUX) |
| 41 #include "chrome/renderer/renderer_sandbox_support_linux.h" | 46 #include "chrome/renderer/renderer_sandbox_support_linux.h" |
| 42 #endif | 47 #endif |
| 43 | 48 |
| 44 #if defined(OS_POSIX) | 49 #if defined(OS_POSIX) |
| 45 #include "base/file_descriptor_posix.h" | 50 #include "base/file_descriptor_posix.h" |
| 46 #endif | 51 #endif |
| 47 | 52 |
| 48 using WebKit::WebFrame; | 53 using WebKit::WebFrame; |
| 49 using WebKit::WebIndexedDatabase; | 54 using WebKit::WebIndexedDatabase; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 70 | 75 |
| 71 WebKit::WebMimeRegistry* RendererWebKitClientImpl::mimeRegistry() { | 76 WebKit::WebMimeRegistry* RendererWebKitClientImpl::mimeRegistry() { |
| 72 return &mime_registry_; | 77 return &mime_registry_; |
| 73 } | 78 } |
| 74 | 79 |
| 75 WebKit::WebFileSystem* RendererWebKitClientImpl::fileSystem() { | 80 WebKit::WebFileSystem* RendererWebKitClientImpl::fileSystem() { |
| 76 return &file_system_; | 81 return &file_system_; |
| 77 } | 82 } |
| 78 | 83 |
| 79 WebKit::WebSandboxSupport* RendererWebKitClientImpl::sandboxSupport() { | 84 WebKit::WebSandboxSupport* RendererWebKitClientImpl::sandboxSupport() { |
| 80 #if defined(OS_WIN) || defined(OS_LINUX) | |
| 81 return &sandbox_support_; | 85 return &sandbox_support_; |
| 82 #else | |
| 83 return NULL; | |
| 84 #endif | |
| 85 } | 86 } |
| 86 | 87 |
| 87 WebKit::WebCookieJar* RendererWebKitClientImpl::cookieJar() { | 88 WebKit::WebCookieJar* RendererWebKitClientImpl::cookieJar() { |
| 88 NOTREACHED() << "Use WebFrameClient::cookieJar() instead!"; | 89 NOTREACHED() << "Use WebFrameClient::cookieJar() instead!"; |
| 89 return NULL; | 90 return NULL; |
| 90 } | 91 } |
| 91 | 92 |
| 92 bool RendererWebKitClientImpl::sandboxEnabled() { | 93 bool RendererWebKitClientImpl::sandboxEnabled() { |
| 93 // As explained in WebKitClient.h, this function is used to decide whether to | 94 // As explained in WebKitClient.h, this function is used to decide whether to |
| 94 // allow file system operations to come out of WebKit or not. Even if the | 95 // allow file system operations to come out of WebKit or not. Even if the |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 num_characters); | 327 num_characters); |
| 327 unicode_font_families_.insert(make_pair(key, family_name)); | 328 unicode_font_families_.insert(make_pair(key, family_name)); |
| 328 return WebString::fromUTF8(family_name); | 329 return WebString::fromUTF8(family_name); |
| 329 } | 330 } |
| 330 | 331 |
| 331 void RendererWebKitClientImpl::SandboxSupport::getRenderStyleForStrike( | 332 void RendererWebKitClientImpl::SandboxSupport::getRenderStyleForStrike( |
| 332 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) { | 333 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) { |
| 333 renderer_sandbox_support::getRenderStyleForStrike(family, sizeAndStyle, out); | 334 renderer_sandbox_support::getRenderStyleForStrike(family, sizeAndStyle, out); |
| 334 } | 335 } |
| 335 | 336 |
| 337 #elif defined(OS_MACOSX) |
| 338 |
| 339 bool RendererWebKitClientImpl::SandboxSupport::loadFont(NSFont* srcFont, |
| 340 ATSFontContainerRef* out) { |
| 341 DCHECK(srcFont); |
| 342 DCHECK(out); |
| 343 |
| 344 uint32 font_data_size; |
| 345 FontDescriptor src_font_descriptor(srcFont); |
| 346 base::SharedMemoryHandle font_data; |
| 347 if (!RenderThread::current()->Send(new ViewHostMsg_LoadFont( |
| 348 src_font_descriptor, &font_data_size, &font_data))) { |
| 349 LOG(ERROR) << "Sending ViewHostMsg_LoadFont() IPC failed for " << |
| 350 src_font_descriptor.font_name; |
| 351 *out = kATSFontContainerRefUnspecified; |
| 352 return false; |
| 353 } |
| 354 |
| 355 if (font_data_size == 0 || font_data == base::SharedMemory::NULLHandle()) { |
| 356 LOG(ERROR) << "Bad response from ViewHostMsg_LoadFont() for " << |
| 357 src_font_descriptor.font_name; |
| 358 *out = kATSFontContainerRefUnspecified; |
| 359 return false; |
| 360 } |
| 361 |
| 362 return FontLoader::ATSFontContainerFromBuffer(font_data, font_data_size, out); |
| 363 } |
| 364 |
| 336 #endif | 365 #endif |
| 337 | 366 |
| 338 //------------------------------------------------------------------------------ | 367 //------------------------------------------------------------------------------ |
| 339 | 368 |
| 340 WebKitClient::FileHandle RendererWebKitClientImpl::databaseOpenFile( | 369 WebKitClient::FileHandle RendererWebKitClientImpl::databaseOpenFile( |
| 341 const WebString& vfs_file_name, int desired_flags) { | 370 const WebString& vfs_file_name, int desired_flags) { |
| 342 return DatabaseUtil::databaseOpenFile(vfs_file_name, desired_flags); | 371 return DatabaseUtil::databaseOpenFile(vfs_file_name, desired_flags); |
| 343 } | 372 } |
| 344 | 373 |
| 345 int RendererWebKitClientImpl::databaseDeleteFile( | 374 int RendererWebKitClientImpl::databaseDeleteFile( |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 const WebKit::WebString& challenge, | 427 const WebKit::WebString& challenge, |
| 399 const WebKit::WebURL& url) { | 428 const WebKit::WebURL& url) { |
| 400 std::string signed_public_key; | 429 std::string signed_public_key; |
| 401 RenderThread::current()->Send(new ViewHostMsg_Keygen( | 430 RenderThread::current()->Send(new ViewHostMsg_Keygen( |
| 402 static_cast<uint32>(key_size_index), | 431 static_cast<uint32>(key_size_index), |
| 403 challenge.utf8(), | 432 challenge.utf8(), |
| 404 GURL(url), | 433 GURL(url), |
| 405 &signed_public_key)); | 434 &signed_public_key)); |
| 406 return WebString::fromUTF8(signed_public_key); | 435 return WebString::fromUTF8(signed_public_key); |
| 407 } | 436 } |
| OLD | NEW |