Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1010)

Side by Side Diff: content/ppapi_plugin/ppapi_webkitclient_impl.cc

Issue 6981001: Make the Pepper proxy support in-process font rendering. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/ppapi_plugin/ppapi_webkitclient_impl.h"
6
7 #include <map>
8
9 #include "base/synchronization/lock.h"
10 #include "base/logging.h"
11 #include "base/string16.h"
12 #include "build/build_config.h"
13 #include "content/renderer/renderer_webkitclient_impl.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptVa lue.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
16
17 #if defined(OS_WIN)
18 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebSandboxSupport .h"
19 #elif defined(OS_MACOSX)
20 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebSandboxSupport .h"
21 #elif defined(OS_LINUX)
22 #include "content/common/child_process_sandbox_support_linux.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebSandboxSuppo rt.h"
24 #endif
25
26 using WebKit::WebSandboxSupport;
27 using WebKit::WebString;
28 using WebKit::WebUChar;
29
30 class PpapiWebKitClientImpl::SandboxSupport : public WebSandboxSupport {
31 public:
32 #if defined(OS_WIN)
33 virtual bool ensureFontLoaded(HFONT);
34 #elif defined(OS_MACOSX)
35 virtual bool loadFont(NSFont* srcFont, ATSFontContainerRef* out);
36 #elif defined(OS_LINUX)
37 virtual WebString getFontFamilyForCharacters(
38 const WebUChar* characters,
39 size_t numCharacters,
40 const char* preferred_locale);
41 virtual void getRenderStyleForStrike(
42 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out);
43
44 private:
45 // WebKit likes to ask us for the correct font family to use for a set of
46 // unicode code points. It needs this information frequently so we cache it
47 // here. The key in this map is an array of 16-bit UTF16 values from WebKit.
48 // The value is a string containing the correct font family.
49 base::Lock unicode_font_families_mutex_;
50 std::map<string16, std::string> unicode_font_families_;
51 #endif
52 };
53
54 #if defined(OS_WIN)
55
56 bool PpapiWebKitClientImpl::SandboxSupport::ensureFontLoaded(HFONT font) {
57 // TODO(brettw) this should do the something similar to what
58 // RendererWebKitClientImpl does and request that the browser load the font.
59 NOTIMPLEMENTED();
60 return false;
61 }
62
63 #elif defined(OS_MACOSX)
64
65 bool PpapiWebKitClientImpl::SandboxSupport::loadFont(NSFont* srcFont,
66 ATSFontContainerRef* out) {
67 // TODO(brettw) this should do the something similar to what
68 // RendererWebKitClientImpl does and request that the browser load the font.
69 NOTIMPLEMENTED();
70 return false;
71 }
72
73 #elif defined(OS_LINUX)
74
75 WebString PpapiWebKitClientImpl::SandboxSupport::getFontFamilyForCharacters(
76 const WebUChar* characters,
77 size_t num_characters,
78 const char* preferred_locale) {
79 base::AutoLock lock(unicode_font_families_mutex_);
80 const string16 key(characters, num_characters);
81 const std::map<string16, std::string>::const_iterator iter =
82 unicode_font_families_.find(key);
83 if (iter != unicode_font_families_.end())
84 return WebString::fromUTF8(iter->second);
85
86 const std::string family_name =
87 child_process_sandbox_support::getFontFamilyForCharacters(
88 characters,
89 num_characters,
90 preferred_locale);
91 unicode_font_families_.insert(make_pair(key, family_name));
92 return WebString::fromUTF8(family_name);
93 }
94
95 void PpapiWebKitClientImpl::SandboxSupport::getRenderStyleForStrike(
96 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) {
97 child_process_sandbox_support::getRenderStyleForStrike(family, sizeAndStyle,
98 out);
99 }
100
101 #endif
102
103 PpapiWebKitClientImpl::PpapiWebKitClientImpl() {
104 }
105
106 PpapiWebKitClientImpl::~PpapiWebKitClientImpl() {
107 }
108
109 WebKit::WebClipboard* PpapiWebKitClientImpl::clipboard() {
110 NOTREACHED();
111 return NULL;
112 }
113
114 WebKit::WebMimeRegistry* PpapiWebKitClientImpl::mimeRegistry() {
115 NOTREACHED();
116 return NULL;
117 }
118
119 WebKit::WebFileUtilities* PpapiWebKitClientImpl::fileUtilities() {
120 NOTREACHED();
121 return NULL;
122 }
123
124 WebKit::WebSandboxSupport* PpapiWebKitClientImpl::sandboxSupport() {
125 return sandbox_support_.get();
126 }
127
128 bool PpapiWebKitClientImpl::sandboxEnabled() {
129 return true; // Assume PPAPI is always sandboxed.
130 }
131
132 unsigned long long PpapiWebKitClientImpl::visitedLinkHash(
133 const char* canonical_url,
134 size_t length) {
135 NOTREACHED();
136 return 0;
137 }
138
139 bool PpapiWebKitClientImpl::isLinkVisited(unsigned long long link_hash) {
140 NOTREACHED();
141 return false;
142 }
143
144 WebKit::WebMessagePortChannel*
145 PpapiWebKitClientImpl::createMessagePortChannel() {
146 NOTREACHED();
147 return NULL;
148 }
149
150 void PpapiWebKitClientImpl::setCookies(
151 const WebKit::WebURL& url,
152 const WebKit::WebURL& first_party_for_cookies,
153 const WebKit::WebString& value) {
154 NOTREACHED();
155 }
156
157 WebKit::WebString PpapiWebKitClientImpl::cookies(
158 const WebKit::WebURL& url,
159 const WebKit::WebURL& first_party_for_cookies) {
160 NOTREACHED();
161 return WebKit::WebString();
162 }
163
164 void PpapiWebKitClientImpl::prefetchHostName(const WebKit::WebString&) {
165 NOTREACHED();
166 }
167
168 WebKit::WebString PpapiWebKitClientImpl::defaultLocale() {
169 NOTREACHED();
170 return WebKit::WebString();
171 }
172
173 WebKit::WebThemeEngine* PpapiWebKitClientImpl::themeEngine() {
174 NOTREACHED();
175 return NULL;
176 }
177
178 WebKit::WebURLLoader* PpapiWebKitClientImpl::createURLLoader() {
179 NOTREACHED();
180 return NULL;
181 }
182
183 WebKit::WebSocketStreamHandle*
184 PpapiWebKitClientImpl::createSocketStreamHandle() {
185 NOTREACHED();
186 return NULL;
187 }
188
189 void PpapiWebKitClientImpl::getPluginList(bool refresh,
190 WebKit::WebPluginListBuilder* builder) {
191 NOTREACHED();
192 }
193
194 WebKit::WebData PpapiWebKitClientImpl::loadResource(const char* name) {
195 NOTREACHED();
196 return WebKit::WebData();
197 }
198
199 WebKit::WebStorageNamespace*
200 PpapiWebKitClientImpl::createLocalStorageNamespace(
201 const WebKit::WebString& path, unsigned quota) {
202 NOTREACHED();
203 return 0;
204 }
205
206 void PpapiWebKitClientImpl::dispatchStorageEvent(
207 const WebKit::WebString& key, const WebKit::WebString& old_value,
208 const WebKit::WebString& new_value, const WebKit::WebString& origin,
209 const WebKit::WebURL& url, bool is_local_storage) {
210 NOTREACHED();
211 }
212
213 WebKit::WebSharedWorkerRepository*
214 PpapiWebKitClientImpl::sharedWorkerRepository() {
215 NOTREACHED();
216 return NULL;
217 }
218
219 int PpapiWebKitClientImpl::databaseDeleteFile(
220 const WebKit::WebString& vfs_file_name, bool sync_dir) {
221 NOTREACHED();
222 return 0;
223 }
224
225 void PpapiWebKitClientImpl::createIDBKeysFromSerializedValuesAndKeyPath(
226 const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values,
227 const WebKit::WebString& keyPath,
228 WebKit::WebVector<WebKit::WebIDBKey>& keys) {
229 NOTREACHED();
230 }
231
232 WebKit::WebSerializedScriptValue
233 PpapiWebKitClientImpl::injectIDBKeyIntoSerializedValue(
234 const WebKit::WebIDBKey& key,
235 const WebKit::WebSerializedScriptValue& value,
236 const WebKit::WebString& keyPath) {
237 NOTREACHED();
238 return WebKit::WebSerializedScriptValue();
239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698