| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ppapi_plugin/ppapi_webkitplatformsupport_impl.h" | 5 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
| 47 virtual bool ensureFontLoaded(HFONT); | 47 virtual bool ensureFontLoaded(HFONT); |
| 48 #elif defined(OS_MACOSX) | 48 #elif defined(OS_MACOSX) |
| 49 virtual bool loadFont( | 49 virtual bool loadFont( |
| 50 NSFont* srcFont, CGFontRef* out, uint32_t* fontID); | 50 NSFont* srcFont, CGFontRef* out, uint32_t* fontID); |
| 51 #elif defined(OS_ANDROID) | 51 #elif defined(OS_ANDROID) |
| 52 // Empty class. | 52 // Empty class. |
| 53 #elif defined(OS_POSIX) | 53 #elif defined(OS_POSIX) |
| 54 SandboxSupport(); | 54 SandboxSupport(); |
| 55 // TODO(dro): crbug.com/382411 Remove this function, once the blink side | |
| 56 // does not need it anymore. | |
| 57 virtual void getFontFamilyForCharacter( | |
| 58 WebUChar32 character, | |
| 59 const char* preferred_locale, | |
| 60 blink::WebFontFamily* family); | |
| 61 virtual void getFallbackFontForCharacter( | 55 virtual void getFallbackFontForCharacter( |
| 62 WebUChar32 character, | 56 WebUChar32 character, |
| 63 const char* preferred_locale, | 57 const char* preferred_locale, |
| 64 blink::WebFallbackFont* fallbackFont); | 58 blink::WebFallbackFont* fallbackFont); |
| 65 virtual void getRenderStyleForStrike( | 59 virtual void getRenderStyleForStrike( |
| 66 const char* family, int sizeAndStyle, blink::WebFontRenderStyle* out); | 60 const char* family, int sizeAndStyle, blink::WebFontRenderStyle* out); |
| 67 | 61 |
| 68 private: | 62 private: |
| 69 // WebKit likes to ask us for the correct font family to use for a set of | 63 // WebKit likes to ask us for the correct font family to use for a set of |
| 70 // unicode code points. It needs this information frequently so we cache it | 64 // unicode code points. It needs this information frequently so we cache it |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 99 |
| 106 // Empty class. | 100 // Empty class. |
| 107 | 101 |
| 108 #elif defined(OS_POSIX) | 102 #elif defined(OS_POSIX) |
| 109 | 103 |
| 110 PpapiWebKitPlatformSupportImpl::SandboxSupport::SandboxSupport() | 104 PpapiWebKitPlatformSupportImpl::SandboxSupport::SandboxSupport() |
| 111 : creation_thread_(base::PlatformThread::CurrentId()) { | 105 : creation_thread_(base::PlatformThread::CurrentId()) { |
| 112 } | 106 } |
| 113 | 107 |
| 114 void | 108 void |
| 115 PpapiWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacter( | |
| 116 WebUChar32 character, | |
| 117 const char* preferred_locale, | |
| 118 blink::WebFontFamily* family) { | |
| 119 ppapi::ProxyLock::AssertAcquired(); | |
| 120 // For debugging crbug.com/312965 | |
| 121 CHECK_EQ(creation_thread_, base::PlatformThread::CurrentId()); | |
| 122 const std::map<int32_t, blink::WebFallbackFont>::const_iterator iter = | |
| 123 unicode_font_families_.find(character); | |
| 124 if (iter != unicode_font_families_.end()) { | |
| 125 family->name = iter->second.name; | |
| 126 family->isBold = iter->second.isBold; | |
| 127 family->isItalic = iter->second.isItalic; | |
| 128 return; | |
| 129 } | |
| 130 | |
| 131 blink::WebFallbackFont fallbackFont; | |
| 132 GetFallbackFontForCharacter(character, preferred_locale, &fallbackFont); | |
| 133 unicode_font_families_.insert(std::make_pair(character, fallbackFont)); | |
| 134 family->name = fallbackFont.name; | |
| 135 family->isBold = fallbackFont.isBold; | |
| 136 family->isItalic = fallbackFont.isItalic; | |
| 137 } | |
| 138 | |
| 139 void | |
| 140 PpapiWebKitPlatformSupportImpl::SandboxSupport::getFallbackFontForCharacter( | 109 PpapiWebKitPlatformSupportImpl::SandboxSupport::getFallbackFontForCharacter( |
| 141 WebUChar32 character, | 110 WebUChar32 character, |
| 142 const char* preferred_locale, | 111 const char* preferred_locale, |
| 143 blink::WebFallbackFont* fallbackFont) { | 112 blink::WebFallbackFont* fallbackFont) { |
| 144 ppapi::ProxyLock::AssertAcquired(); | 113 ppapi::ProxyLock::AssertAcquired(); |
| 145 // For debugging crbug.com/312965 | 114 // For debugging crbug.com/312965 |
| 146 CHECK_EQ(creation_thread_, base::PlatformThread::CurrentId()); | 115 CHECK_EQ(creation_thread_, base::PlatformThread::CurrentId()); |
| 147 const std::map<int32_t, blink::WebFallbackFont>::const_iterator iter = | 116 const std::map<int32_t, blink::WebFallbackFont>::const_iterator iter = |
| 148 unicode_font_families_.find(character); | 117 unicode_font_families_.find(character); |
| 149 if (iter != unicode_font_families_.end()) { | 118 if (iter != unicode_font_families_.end()) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 NOTREACHED(); | 251 NOTREACHED(); |
| 283 } | 252 } |
| 284 | 253 |
| 285 int PpapiWebKitPlatformSupportImpl::databaseDeleteFile( | 254 int PpapiWebKitPlatformSupportImpl::databaseDeleteFile( |
| 286 const blink::WebString& vfs_file_name, bool sync_dir) { | 255 const blink::WebString& vfs_file_name, bool sync_dir) { |
| 287 NOTREACHED(); | 256 NOTREACHED(); |
| 288 return 0; | 257 return 0; |
| 289 } | 258 } |
| 290 | 259 |
| 291 } // namespace content | 260 } // namespace content |
| OLD | NEW |