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