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/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "content/common/child_process_messages.h" | 13 #include "content/common/child_process_messages.h" |
14 #include "content/common/child_thread.h" | 14 #include "content/common/child_thread.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize dScriptValue.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize dScriptValue.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
17 | 17 |
18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/win/WebSandb oxSupport.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/win/WebSandb oxSupport.h" |
20 #elif defined(OS_MACOSX) | 20 #elif defined(OS_MACOSX) |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/mac/WebSandb oxSupport.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/mac/WebSandb oxSupport.h" |
22 #elif defined(OS_POSIX) | 22 #elif defined(OS_POSIX) |
23 #if !defined(OS_ANDROID) | |
23 #include "content/common/child_process_sandbox_support_impl_linux.h" | 24 #include "content/common/child_process_sandbox_support_impl_linux.h" |
25 #endif | |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/linux/WebFon tFamily.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/linux/WebFon tFamily.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/linux/WebSan dboxSupport.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/linux/WebSan dboxSupport.h" |
28 | |
26 #endif | 29 #endif |
27 | 30 |
28 using WebKit::WebSandboxSupport; | 31 using WebKit::WebSandboxSupport; |
29 using WebKit::WebString; | 32 using WebKit::WebString; |
30 using WebKit::WebUChar; | 33 using WebKit::WebUChar; |
31 | 34 |
32 typedef struct CGFont* CGFontRef; | 35 typedef struct CGFont* CGFontRef; |
33 | 36 |
34 class PpapiWebKitPlatformSupportImpl::SandboxSupport : public WebSandboxSupport { | 37 class PpapiWebKitPlatformSupportImpl::SandboxSupport : public WebSandboxSupport { |
35 public: | 38 public: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 bool PpapiWebKitPlatformSupportImpl::SandboxSupport::loadFont( | 78 bool PpapiWebKitPlatformSupportImpl::SandboxSupport::loadFont( |
76 NSFont* src_font, | 79 NSFont* src_font, |
77 CGFontRef* out, | 80 CGFontRef* out, |
78 uint32_t* font_id) { | 81 uint32_t* font_id) { |
79 // TODO(brettw) this should do the something similar to what | 82 // TODO(brettw) this should do the something similar to what |
80 // RendererWebKitClientImpl does and request that the browser load the font. | 83 // RendererWebKitClientImpl does and request that the browser load the font. |
81 NOTIMPLEMENTED(); | 84 NOTIMPLEMENTED(); |
82 return false; | 85 return false; |
83 } | 86 } |
84 | 87 |
88 // TODO(jeremy): Remove once http://webk.it/66935 lands. | |
Yaron
2012/05/09 01:01:42
Why are you adding this to the mac section? Remove
John Grabowski
2012/05/09 17:18:15
You are absolutely right; removing from downstream
| |
89 bool PpapiWebKitPlatformSupportImpl::SandboxSupport::loadFont( | |
90 NSFont* src_font, | |
91 ATSFontContainerRef* out, | |
92 uint32_t* font_id) { | |
93 // TODO(brettw) this should do the something similar to what | |
94 // RendererWebKitPlatformSupportImpl does and request that the browser load | |
95 // the font. | |
96 NOTIMPLEMENTED(); | |
97 return false; | |
98 } | |
99 | |
100 #elif defined(OS_ANDROID) | |
101 | |
102 // TODO(jrg): resolve (and implement?) PPAPI SandboxSupport for Android. | |
103 | |
104 void | |
105 PpapiWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacters( | |
106 const WebUChar* characters, | |
107 size_t num_characters, | |
108 const char* preferred_locale, | |
109 WebKit::WebFontFamily* family) { | |
110 NOTIMPLEMENTED(); | |
111 } | |
112 | |
113 void PpapiWebKitPlatformSupportImpl::SandboxSupport::getRenderStyleForStrike( | |
114 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) { | |
115 NOTIMPLEMENTED(); | |
116 } | |
117 | |
85 #elif defined(OS_POSIX) | 118 #elif defined(OS_POSIX) |
86 | 119 |
87 void | 120 void |
88 PpapiWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacters( | 121 PpapiWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacters( |
89 const WebUChar* characters, | 122 const WebUChar* characters, |
90 size_t num_characters, | 123 size_t num_characters, |
91 const char* preferred_locale, | 124 const char* preferred_locale, |
92 WebKit::WebFontFamily* family) { | 125 WebKit::WebFontFamily* family) { |
93 base::AutoLock lock(unicode_font_families_mutex_); | 126 base::AutoLock lock(unicode_font_families_mutex_); |
94 const string16 key(characters, num_characters); | 127 const string16 key(characters, num_characters); |
95 const std::map<string16, WebKit::WebFontFamily>::const_iterator iter = | 128 const std::map<string16, WebKit::WebFontFamily>::const_iterator iter = |
96 unicode_font_families_.find(key); | 129 unicode_font_families_.find(key); |
97 if (iter != unicode_font_families_.end()) { | 130 if (iter != unicode_font_families_.end()) { |
98 family->name = iter->second.name; | 131 family->name = iter->second.name; |
99 family->isBold = iter->second.isBold; | 132 family->isBold = iter->second.isBold; |
100 family->isItalic = iter->second.isItalic; | 133 family->isItalic = iter->second.isItalic; |
101 return; | 134 return; |
102 } | 135 } |
103 | 136 |
137 #if defined(OS_ANDROID) | |
Yaron
2012/05/09 01:01:42
Isn't this dead code? I think it's just bit-rot. W
| |
138 // TODO(jrg): implement PpapiWebKitPlatformSupportImpl::SandboxSupport::getFon tFamilyForCharacters() | |
Ted C
2012/05/09 00:26:41
>80?
| |
139 NOTIMPLEMENTED(); | |
140 #else | |
104 content::GetFontFamilyForCharacters( | 141 content::GetFontFamilyForCharacters( |
105 characters, | 142 characters, |
106 num_characters, | 143 num_characters, |
107 preferred_locale, | 144 preferred_locale, |
108 family); | 145 family); |
109 unicode_font_families_.insert(make_pair(key, *family)); | 146 unicode_font_families_.insert(make_pair(key, *family)); |
147 #endif | |
110 } | 148 } |
111 | 149 |
112 void PpapiWebKitPlatformSupportImpl::SandboxSupport::getRenderStyleForStrike( | 150 void PpapiWebKitPlatformSupportImpl::SandboxSupport::getRenderStyleForStrike( |
113 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) { | 151 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) { |
152 #if defined(OS_ANDROID) | |
Yaron
2012/05/09 01:01:42
same hedre. please remove
| |
153 // TODO(jrg): implement PpapiWebKitPlatformSupportImpl::SandboxSupport::getRen derStyleForStrike() | |
154 NOTIMPLEMENTED(); | |
155 #else | |
114 content::GetRenderStyleForStrike(family, sizeAndStyle, out); | 156 content::GetRenderStyleForStrike(family, sizeAndStyle, out); |
157 #endif | |
115 } | 158 } |
116 | 159 |
117 #endif | 160 #endif |
118 | 161 |
119 PpapiWebKitPlatformSupportImpl::PpapiWebKitPlatformSupportImpl() | 162 PpapiWebKitPlatformSupportImpl::PpapiWebKitPlatformSupportImpl() |
120 : sandbox_support_(new PpapiWebKitPlatformSupportImpl::SandboxSupport()) { | 163 : sandbox_support_(new PpapiWebKitPlatformSupportImpl::SandboxSupport()) { |
121 } | 164 } |
122 | 165 |
123 PpapiWebKitPlatformSupportImpl::~PpapiWebKitPlatformSupportImpl() { | 166 PpapiWebKitPlatformSupportImpl::~PpapiWebKitPlatformSupportImpl() { |
124 } | 167 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 } | 290 } |
248 | 291 |
249 WebKit::WebSerializedScriptValue | 292 WebKit::WebSerializedScriptValue |
250 PpapiWebKitPlatformSupportImpl::injectIDBKeyIntoSerializedValue( | 293 PpapiWebKitPlatformSupportImpl::injectIDBKeyIntoSerializedValue( |
251 const WebKit::WebIDBKey& key, | 294 const WebKit::WebIDBKey& key, |
252 const WebKit::WebSerializedScriptValue& value, | 295 const WebKit::WebSerializedScriptValue& value, |
253 const WebKit::WebIDBKeyPath& keyPath) { | 296 const WebKit::WebIDBKeyPath& keyPath) { |
254 NOTREACHED(); | 297 NOTREACHED(); |
255 return WebKit::WebSerializedScriptValue(); | 298 return WebKit::WebSerializedScriptValue(); |
256 } | 299 } |
OLD | NEW |