OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/renderer/renderer_webkitclient_impl.h" | 5 #include "content/renderer/renderer_webkitclient_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 }; | 108 }; |
109 | 109 |
110 class RendererWebKitClientImpl::SandboxSupport | 110 class RendererWebKitClientImpl::SandboxSupport |
111 : public WebKit::WebSandboxSupport { | 111 : public WebKit::WebSandboxSupport { |
112 public: | 112 public: |
113 virtual ~SandboxSupport() {} | 113 virtual ~SandboxSupport() {} |
114 | 114 |
115 #if defined(OS_WIN) | 115 #if defined(OS_WIN) |
116 virtual bool ensureFontLoaded(HFONT); | 116 virtual bool ensureFontLoaded(HFONT); |
117 #elif defined(OS_MACOSX) | 117 #elif defined(OS_MACOSX) |
118 // TODO(jeremy): Remove once WebKit side of patch lands - crbug.com/72727 . | |
119 virtual bool loadFont(NSFont* srcFont, ATSFontContainerRef* out); | |
120 virtual bool loadFont( | 118 virtual bool loadFont( |
121 NSFont* srcFont, ATSFontContainerRef* container, uint32* fontID); | 119 NSFont* srcFont, ATSFontContainerRef* container, uint32* fontID); |
122 #elif defined(OS_POSIX) | 120 #elif defined(OS_POSIX) |
123 virtual WebKit::WebString getFontFamilyForCharacters( | 121 virtual WebKit::WebString getFontFamilyForCharacters( |
124 const WebKit::WebUChar* characters, | 122 const WebKit::WebUChar* characters, |
125 size_t numCharacters, | 123 size_t numCharacters, |
126 const char* preferred_locale); | 124 const char* preferred_locale); |
127 virtual void getRenderStyleForStrike( | 125 virtual void getRenderStyleForStrike( |
128 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out); | 126 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out); |
129 | 127 |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 #if defined(OS_WIN) | 431 #if defined(OS_WIN) |
434 | 432 |
435 bool RendererWebKitClientImpl::SandboxSupport::ensureFontLoaded(HFONT font) { | 433 bool RendererWebKitClientImpl::SandboxSupport::ensureFontLoaded(HFONT font) { |
436 LOGFONT logfont; | 434 LOGFONT logfont; |
437 GetObject(font, sizeof(LOGFONT), &logfont); | 435 GetObject(font, sizeof(LOGFONT), &logfont); |
438 return RenderThread::current()->Send(new ViewHostMsg_PreCacheFont(logfont)); | 436 return RenderThread::current()->Send(new ViewHostMsg_PreCacheFont(logfont)); |
439 } | 437 } |
440 | 438 |
441 #elif defined(OS_MACOSX) | 439 #elif defined(OS_MACOSX) |
442 | 440 |
443 // TODO(jeremy): Remove once WebKit side of patch lands - crbug.com/72727 . | |
444 bool RendererWebKitClientImpl::SandboxSupport::loadFont( | |
445 NSFont* srcFont, ATSFontContainerRef* out) { | |
446 uint32 temp; | |
447 return loadFont(srcFont, out, &temp); | |
448 } | |
449 | |
450 bool RendererWebKitClientImpl::SandboxSupport::loadFont( | 441 bool RendererWebKitClientImpl::SandboxSupport::loadFont( |
451 NSFont* srcFont, ATSFontContainerRef* container, uint32* fontID) { | 442 NSFont* srcFont, ATSFontContainerRef* container, uint32* fontID) { |
452 DCHECK(srcFont); | 443 DCHECK(srcFont); |
453 DCHECK(container); | 444 DCHECK(container); |
454 DCHECK(fontID); | 445 DCHECK(fontID); |
455 | 446 |
456 uint32 font_data_size; | 447 uint32 font_data_size; |
457 FontDescriptor src_font_descriptor(srcFont); | 448 FontDescriptor src_font_descriptor(srcFont); |
458 base::SharedMemoryHandle font_data; | 449 base::SharedMemoryHandle font_data; |
459 if (!RenderThread::current()->Send(new ViewHostMsg_LoadFont( | 450 if (!RenderThread::current()->Send(new ViewHostMsg_LoadFont( |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 } | 587 } |
597 | 588 |
598 //------------------------------------------------------------------------------ | 589 //------------------------------------------------------------------------------ |
599 | 590 |
600 WebBlobRegistry* RendererWebKitClientImpl::blobRegistry() { | 591 WebBlobRegistry* RendererWebKitClientImpl::blobRegistry() { |
601 // RenderThread::current can be NULL when running some tests. | 592 // RenderThread::current can be NULL when running some tests. |
602 if (!blob_registry_.get() && RenderThread::current()) | 593 if (!blob_registry_.get() && RenderThread::current()) |
603 blob_registry_.reset(new WebBlobRegistryImpl(RenderThread::current())); | 594 blob_registry_.reset(new WebBlobRegistryImpl(RenderThread::current())); |
604 return blob_registry_.get(); | 595 return blob_registry_.get(); |
605 } | 596 } |
OLD | NEW |