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 10 matching lines...) Expand all Loading... |
21 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" | 21 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" |
22 #elif defined(OS_ANDROID) | 22 #elif defined(OS_ANDROID) |
23 #include "third_party/WebKit/public/platform/android/WebSandboxSupport.h" | 23 #include "third_party/WebKit/public/platform/android/WebSandboxSupport.h" |
24 #elif defined(OS_POSIX) | 24 #elif defined(OS_POSIX) |
25 #include "content/common/child_process_sandbox_support_impl_linux.h" | 25 #include "content/common/child_process_sandbox_support_impl_linux.h" |
26 #include "third_party/WebKit/public/platform/linux/WebFontFamily.h" | 26 #include "third_party/WebKit/public/platform/linux/WebFontFamily.h" |
27 #include "third_party/WebKit/public/platform/linux/WebSandboxSupport.h" | 27 #include "third_party/WebKit/public/platform/linux/WebSandboxSupport.h" |
28 #include "third_party/icu/source/common/unicode/utf16.h" | 28 #include "third_party/icu/source/common/unicode/utf16.h" |
29 #endif | 29 #endif |
30 | 30 |
31 using WebKit::WebSandboxSupport; | 31 using blink::WebSandboxSupport; |
32 using WebKit::WebString; | 32 using blink::WebString; |
33 using WebKit::WebUChar; | 33 using blink::WebUChar; |
34 using WebKit::WebUChar32; | 34 using blink::WebUChar32; |
35 | 35 |
36 typedef struct CGFont* CGFontRef; | 36 typedef struct CGFont* CGFontRef; |
37 | 37 |
38 namespace content { | 38 namespace content { |
39 | 39 |
40 class PpapiWebKitPlatformSupportImpl::SandboxSupport | 40 class PpapiWebKitPlatformSupportImpl::SandboxSupport |
41 : public WebSandboxSupport { | 41 : public WebSandboxSupport { |
42 public: | 42 public: |
43 virtual ~SandboxSupport() {} | 43 virtual ~SandboxSupport() {} |
44 | 44 |
45 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
46 virtual bool ensureFontLoaded(HFONT); | 46 virtual bool ensureFontLoaded(HFONT); |
47 #elif defined(OS_MACOSX) | 47 #elif defined(OS_MACOSX) |
48 virtual bool loadFont( | 48 virtual bool loadFont( |
49 NSFont* srcFont, CGFontRef* out, uint32_t* fontID); | 49 NSFont* srcFont, CGFontRef* out, uint32_t* fontID); |
50 #elif defined(OS_ANDROID) | 50 #elif defined(OS_ANDROID) |
51 // Empty class. | 51 // Empty class. |
52 #elif defined(OS_POSIX) | 52 #elif defined(OS_POSIX) |
53 virtual void getFontFamilyForCharacter( | 53 virtual void getFontFamilyForCharacter( |
54 WebUChar32 character, | 54 WebUChar32 character, |
55 const char* preferred_locale, | 55 const char* preferred_locale, |
56 WebKit::WebFontFamily* family); | 56 blink::WebFontFamily* family); |
57 virtual void getRenderStyleForStrike( | 57 virtual void getRenderStyleForStrike( |
58 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out); | 58 const char* family, int sizeAndStyle, blink::WebFontRenderStyle* out); |
59 | 59 |
60 private: | 60 private: |
61 // WebKit likes to ask us for the correct font family to use for a set of | 61 // WebKit likes to ask us for the correct font family to use for a set of |
62 // unicode code points. It needs this information frequently so we cache it | 62 // unicode code points. It needs this information frequently so we cache it |
63 // here. | 63 // here. |
64 base::Lock unicode_font_families_mutex_; | 64 base::Lock unicode_font_families_mutex_; |
65 std::map<int32_t, WebKit::WebFontFamily> unicode_font_families_; | 65 std::map<int32_t, blink::WebFontFamily> unicode_font_families_; |
66 #endif | 66 #endif |
67 }; | 67 }; |
68 | 68 |
69 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
70 | 70 |
71 bool PpapiWebKitPlatformSupportImpl::SandboxSupport::ensureFontLoaded( | 71 bool PpapiWebKitPlatformSupportImpl::SandboxSupport::ensureFontLoaded( |
72 HFONT font) { | 72 HFONT font) { |
73 LOGFONT logfont; | 73 LOGFONT logfont; |
74 GetObject(font, sizeof(LOGFONT), &logfont); | 74 GetObject(font, sizeof(LOGFONT), &logfont); |
75 | 75 |
(...skipping 19 matching lines...) Expand all Loading... |
95 #elif defined(OS_ANDROID) | 95 #elif defined(OS_ANDROID) |
96 | 96 |
97 // Empty class. | 97 // Empty class. |
98 | 98 |
99 #elif defined(OS_POSIX) | 99 #elif defined(OS_POSIX) |
100 | 100 |
101 void | 101 void |
102 PpapiWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacter( | 102 PpapiWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacter( |
103 WebUChar32 character, | 103 WebUChar32 character, |
104 const char* preferred_locale, | 104 const char* preferred_locale, |
105 WebKit::WebFontFamily* family) { | 105 blink::WebFontFamily* family) { |
106 base::AutoLock lock(unicode_font_families_mutex_); | 106 base::AutoLock lock(unicode_font_families_mutex_); |
107 const std::map<int32_t, WebKit::WebFontFamily>::const_iterator iter = | 107 const std::map<int32_t, blink::WebFontFamily>::const_iterator iter = |
108 unicode_font_families_.find(character); | 108 unicode_font_families_.find(character); |
109 if (iter != unicode_font_families_.end()) { | 109 if (iter != unicode_font_families_.end()) { |
110 family->name = iter->second.name; | 110 family->name = iter->second.name; |
111 family->isBold = iter->second.isBold; | 111 family->isBold = iter->second.isBold; |
112 family->isItalic = iter->second.isItalic; | 112 family->isItalic = iter->second.isItalic; |
113 return; | 113 return; |
114 } | 114 } |
115 | 115 |
116 GetFontFamilyForCharacter(character, preferred_locale, family); | 116 GetFontFamilyForCharacter(character, preferred_locale, family); |
117 unicode_font_families_.insert(std::make_pair(character, *family)); | 117 unicode_font_families_.insert(std::make_pair(character, *family)); |
118 } | 118 } |
119 | 119 |
120 void PpapiWebKitPlatformSupportImpl::SandboxSupport::getRenderStyleForStrike( | 120 void PpapiWebKitPlatformSupportImpl::SandboxSupport::getRenderStyleForStrike( |
121 const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) { | 121 const char* family, int sizeAndStyle, blink::WebFontRenderStyle* out) { |
122 GetRenderStyleForStrike(family, sizeAndStyle, out); | 122 GetRenderStyleForStrike(family, sizeAndStyle, out); |
123 } | 123 } |
124 | 124 |
125 #endif | 125 #endif |
126 | 126 |
127 PpapiWebKitPlatformSupportImpl::PpapiWebKitPlatformSupportImpl() | 127 PpapiWebKitPlatformSupportImpl::PpapiWebKitPlatformSupportImpl() |
128 : sandbox_support_(new PpapiWebKitPlatformSupportImpl::SandboxSupport()) { | 128 : sandbox_support_(new PpapiWebKitPlatformSupportImpl::SandboxSupport()) { |
129 } | 129 } |
130 | 130 |
131 PpapiWebKitPlatformSupportImpl::~PpapiWebKitPlatformSupportImpl() { | 131 PpapiWebKitPlatformSupportImpl::~PpapiWebKitPlatformSupportImpl() { |
132 } | 132 } |
133 | 133 |
134 WebKit::WebClipboard* PpapiWebKitPlatformSupportImpl::clipboard() { | 134 blink::WebClipboard* PpapiWebKitPlatformSupportImpl::clipboard() { |
135 NOTREACHED(); | 135 NOTREACHED(); |
136 return NULL; | 136 return NULL; |
137 } | 137 } |
138 | 138 |
139 WebKit::WebMimeRegistry* PpapiWebKitPlatformSupportImpl::mimeRegistry() { | 139 blink::WebMimeRegistry* PpapiWebKitPlatformSupportImpl::mimeRegistry() { |
140 NOTREACHED(); | 140 NOTREACHED(); |
141 return NULL; | 141 return NULL; |
142 } | 142 } |
143 | 143 |
144 WebKit::WebFileUtilities* PpapiWebKitPlatformSupportImpl::fileUtilities() { | 144 blink::WebFileUtilities* PpapiWebKitPlatformSupportImpl::fileUtilities() { |
145 NOTREACHED(); | 145 NOTREACHED(); |
146 return NULL; | 146 return NULL; |
147 } | 147 } |
148 | 148 |
149 WebKit::WebSandboxSupport* PpapiWebKitPlatformSupportImpl::sandboxSupport() { | 149 blink::WebSandboxSupport* PpapiWebKitPlatformSupportImpl::sandboxSupport() { |
150 return sandbox_support_.get(); | 150 return sandbox_support_.get(); |
151 } | 151 } |
152 | 152 |
153 bool PpapiWebKitPlatformSupportImpl::sandboxEnabled() { | 153 bool PpapiWebKitPlatformSupportImpl::sandboxEnabled() { |
154 return true; // Assume PPAPI is always sandboxed. | 154 return true; // Assume PPAPI is always sandboxed. |
155 } | 155 } |
156 | 156 |
157 unsigned long long PpapiWebKitPlatformSupportImpl::visitedLinkHash( | 157 unsigned long long PpapiWebKitPlatformSupportImpl::visitedLinkHash( |
158 const char* canonical_url, | 158 const char* canonical_url, |
159 size_t length) { | 159 size_t length) { |
160 NOTREACHED(); | 160 NOTREACHED(); |
161 return 0; | 161 return 0; |
162 } | 162 } |
163 | 163 |
164 bool PpapiWebKitPlatformSupportImpl::isLinkVisited( | 164 bool PpapiWebKitPlatformSupportImpl::isLinkVisited( |
165 unsigned long long link_hash) { | 165 unsigned long long link_hash) { |
166 NOTREACHED(); | 166 NOTREACHED(); |
167 return false; | 167 return false; |
168 } | 168 } |
169 | 169 |
170 WebKit::WebMessagePortChannel* | 170 blink::WebMessagePortChannel* |
171 PpapiWebKitPlatformSupportImpl::createMessagePortChannel() { | 171 PpapiWebKitPlatformSupportImpl::createMessagePortChannel() { |
172 NOTREACHED(); | 172 NOTREACHED(); |
173 return NULL; | 173 return NULL; |
174 } | 174 } |
175 | 175 |
176 void PpapiWebKitPlatformSupportImpl::setCookies( | 176 void PpapiWebKitPlatformSupportImpl::setCookies( |
177 const WebKit::WebURL& url, | 177 const blink::WebURL& url, |
178 const WebKit::WebURL& first_party_for_cookies, | 178 const blink::WebURL& first_party_for_cookies, |
179 const WebKit::WebString& value) { | 179 const blink::WebString& value) { |
180 NOTREACHED(); | 180 NOTREACHED(); |
181 } | 181 } |
182 | 182 |
183 WebKit::WebString PpapiWebKitPlatformSupportImpl::cookies( | 183 blink::WebString PpapiWebKitPlatformSupportImpl::cookies( |
184 const WebKit::WebURL& url, | 184 const blink::WebURL& url, |
185 const WebKit::WebURL& first_party_for_cookies) { | 185 const blink::WebURL& first_party_for_cookies) { |
186 NOTREACHED(); | 186 NOTREACHED(); |
187 return WebKit::WebString(); | 187 return blink::WebString(); |
188 } | 188 } |
189 | 189 |
190 WebKit::WebString PpapiWebKitPlatformSupportImpl::defaultLocale() { | 190 blink::WebString PpapiWebKitPlatformSupportImpl::defaultLocale() { |
191 NOTREACHED(); | 191 NOTREACHED(); |
192 return WebKit::WebString(); | 192 return blink::WebString(); |
193 } | 193 } |
194 | 194 |
195 WebKit::WebThemeEngine* PpapiWebKitPlatformSupportImpl::themeEngine() { | 195 blink::WebThemeEngine* PpapiWebKitPlatformSupportImpl::themeEngine() { |
196 NOTREACHED(); | 196 NOTREACHED(); |
197 return NULL; | 197 return NULL; |
198 } | 198 } |
199 | 199 |
200 WebKit::WebURLLoader* PpapiWebKitPlatformSupportImpl::createURLLoader() { | 200 blink::WebURLLoader* PpapiWebKitPlatformSupportImpl::createURLLoader() { |
201 NOTREACHED(); | 201 NOTREACHED(); |
202 return NULL; | 202 return NULL; |
203 } | 203 } |
204 | 204 |
205 WebKit::WebSocketStreamHandle* | 205 blink::WebSocketStreamHandle* |
206 PpapiWebKitPlatformSupportImpl::createSocketStreamHandle() { | 206 PpapiWebKitPlatformSupportImpl::createSocketStreamHandle() { |
207 NOTREACHED(); | 207 NOTREACHED(); |
208 return NULL; | 208 return NULL; |
209 } | 209 } |
210 | 210 |
211 void PpapiWebKitPlatformSupportImpl::getPluginList(bool refresh, | 211 void PpapiWebKitPlatformSupportImpl::getPluginList(bool refresh, |
212 WebKit::WebPluginListBuilder* builder) { | 212 blink::WebPluginListBuilder* builder) { |
213 NOTREACHED(); | 213 NOTREACHED(); |
214 } | 214 } |
215 | 215 |
216 WebKit::WebData PpapiWebKitPlatformSupportImpl::loadResource(const char* name) { | 216 blink::WebData PpapiWebKitPlatformSupportImpl::loadResource(const char* name) { |
217 NOTREACHED(); | 217 NOTREACHED(); |
218 return WebKit::WebData(); | 218 return blink::WebData(); |
219 } | 219 } |
220 | 220 |
221 WebKit::WebStorageNamespace* | 221 blink::WebStorageNamespace* |
222 PpapiWebKitPlatformSupportImpl::createLocalStorageNamespace() { | 222 PpapiWebKitPlatformSupportImpl::createLocalStorageNamespace() { |
223 NOTREACHED(); | 223 NOTREACHED(); |
224 return 0; | 224 return 0; |
225 } | 225 } |
226 | 226 |
227 void PpapiWebKitPlatformSupportImpl::dispatchStorageEvent( | 227 void PpapiWebKitPlatformSupportImpl::dispatchStorageEvent( |
228 const WebKit::WebString& key, const WebKit::WebString& old_value, | 228 const blink::WebString& key, const blink::WebString& old_value, |
229 const WebKit::WebString& new_value, const WebKit::WebString& origin, | 229 const blink::WebString& new_value, const blink::WebString& origin, |
230 const WebKit::WebURL& url, bool is_local_storage) { | 230 const blink::WebURL& url, bool is_local_storage) { |
231 NOTREACHED(); | 231 NOTREACHED(); |
232 } | 232 } |
233 | 233 |
234 int PpapiWebKitPlatformSupportImpl::databaseDeleteFile( | 234 int PpapiWebKitPlatformSupportImpl::databaseDeleteFile( |
235 const WebKit::WebString& vfs_file_name, bool sync_dir) { | 235 const blink::WebString& vfs_file_name, bool sync_dir) { |
236 NOTREACHED(); | 236 NOTREACHED(); |
237 return 0; | 237 return 0; |
238 } | 238 } |
239 | 239 |
240 } // namespace content | 240 } // namespace content |
OLD | NEW |