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

Side by Side Diff: webkit/glue/webkitplatformsupport_impl.cc

Issue 8602002: Move some webkit_glue embedder functions into WebKitPlatformSupport virtual methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright year Created 9 years, 1 month 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
« no previous file with comments | « webkit/glue/webkitplatformsupport_impl.h ('k') | webkit/glue/websocketstreamhandle_bridge.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "webkit/glue/webkitplatformsupport_impl.h" 5 #include "webkit/glue/webkitplatformsupport_impl.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <malloc.h> 8 #include <malloc.h>
9 #endif 9 #endif
10 10
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 217
218 WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() { 218 WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() {
219 } 219 }
220 220
221 WebThemeEngine* WebKitPlatformSupportImpl::themeEngine() { 221 WebThemeEngine* WebKitPlatformSupportImpl::themeEngine() {
222 return &theme_engine_; 222 return &theme_engine_;
223 } 223 }
224 224
225 WebURLLoader* WebKitPlatformSupportImpl::createURLLoader() { 225 WebURLLoader* WebKitPlatformSupportImpl::createURLLoader() {
226 return new WebURLLoaderImpl(); 226 return new WebURLLoaderImpl(this);
227 } 227 }
228 228
229 WebSocketStreamHandle* WebKitPlatformSupportImpl::createSocketStreamHandle() { 229 WebSocketStreamHandle* WebKitPlatformSupportImpl::createSocketStreamHandle() {
230 return new WebSocketStreamHandleImpl(); 230 return new WebSocketStreamHandleImpl(this);
231 } 231 }
232 232
233 WebString WebKitPlatformSupportImpl::userAgent(const WebURL& url) { 233 WebString WebKitPlatformSupportImpl::userAgent(const WebURL& url) {
234 return WebString::fromUTF8(webkit_glue::GetUserAgent(url)); 234 return WebString::fromUTF8(webkit_glue::GetUserAgent(url));
235 } 235 }
236 236
237 void WebKitPlatformSupportImpl::getPluginList(bool refresh, 237 void WebKitPlatformSupportImpl::getPluginList(bool refresh,
238 WebPluginListBuilder* builder) { 238 WebPluginListBuilder* builder) {
239 std::vector<webkit::WebPluginInfo> plugins; 239 std::vector<webkit::WebPluginInfo> plugins;
240 GetPlugins(refresh, &plugins); 240 GetPlugins(refresh, &plugins);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 TRACE_EVENT_BEGIN_ETW(name, id, extra); 299 TRACE_EVENT_BEGIN_ETW(name, id, extra);
300 } 300 }
301 301
302 void WebKitPlatformSupportImpl::traceEventEnd(const char* name, void* id, 302 void WebKitPlatformSupportImpl::traceEventEnd(const char* name, void* id,
303 const char* extra) { 303 const char* extra) {
304 TRACE_EVENT_END_ETW(name, id, extra); 304 TRACE_EVENT_END_ETW(name, id, extra);
305 } 305 }
306 306
307 namespace { 307 namespace {
308 308
309 WebData loadAudioSpatializationResource(const char* name) { 309 WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform,
310 const char* name) {
310 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000 311 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000
311 const size_t kExpectedSpatializationNameLength = 31; 312 const size_t kExpectedSpatializationNameLength = 31;
312 if (strlen(name) != kExpectedSpatializationNameLength) { 313 if (strlen(name) != kExpectedSpatializationNameLength) {
313 return WebData(); 314 return WebData();
314 } 315 }
315 316
316 // Extract the azimuth and elevation from the resource name. 317 // Extract the azimuth and elevation from the resource name.
317 int azimuth = 0; 318 int azimuth = 0;
318 int elevation = 0; 319 int elevation = 0;
319 int values_parsed = 320 int values_parsed =
(...skipping 19 matching lines...) Expand all
339 const int kNumberOfElevations = 10; 340 const int kNumberOfElevations = 10;
340 const int kNumberOfAudioResources = 240; 341 const int kNumberOfAudioResources = 240;
341 int resource_index = kNumberOfElevations * azimuth_index + elevation_index; 342 int resource_index = kNumberOfElevations * azimuth_index + elevation_index;
342 bool is_resource_index_good = 0 <= resource_index && 343 bool is_resource_index_good = 0 <= resource_index &&
343 resource_index < kNumberOfAudioResources; 344 resource_index < kNumberOfAudioResources;
344 345
345 if (is_azimuth_index_good && is_elevation_index_good && 346 if (is_azimuth_index_good && is_elevation_index_good &&
346 is_resource_index_good) { 347 is_resource_index_good) {
347 const int kFirstAudioResourceIndex = IDR_AUDIO_SPATIALIZATION_T000_P000; 348 const int kFirstAudioResourceIndex = IDR_AUDIO_SPATIALIZATION_T000_P000;
348 base::StringPiece resource = 349 base::StringPiece resource =
349 GetDataResource(kFirstAudioResourceIndex + resource_index); 350 platform->GetDataResource(kFirstAudioResourceIndex + resource_index);
350 return WebData(resource.data(), resource.size()); 351 return WebData(resource.data(), resource.size());
351 } 352 }
352 #endif // IDR_AUDIO_SPATIALIZATION_T000_P000 353 #endif // IDR_AUDIO_SPATIALIZATION_T000_P000
353 354
354 NOTREACHED(); 355 NOTREACHED();
355 return WebData(); 356 return WebData();
356 } 357 }
357 358
358 struct DataResource { 359 struct DataResource {
359 const char* name; 360 const char* name;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 428
428 WebData WebKitPlatformSupportImpl::loadResource(const char* name) { 429 WebData WebKitPlatformSupportImpl::loadResource(const char* name) {
429 // Some clients will call into this method with an empty |name| when they have 430 // Some clients will call into this method with an empty |name| when they have
430 // optional resources. For example, the PopupMenuChromium code can have icons 431 // optional resources. For example, the PopupMenuChromium code can have icons
431 // for some Autofill items but not for others. 432 // for some Autofill items but not for others.
432 if (!strlen(name)) 433 if (!strlen(name))
433 return WebData(); 434 return WebData();
434 435
435 // Check the name prefix to see if it's an audio resource. 436 // Check the name prefix to see if it's an audio resource.
436 if (StartsWithASCII(name, "IRC_Composite", true)) 437 if (StartsWithASCII(name, "IRC_Composite", true))
437 return loadAudioSpatializationResource(name); 438 return loadAudioSpatializationResource(this, name);
438 439
439 for (size_t i = 0; i < arraysize(kDataResources); ++i) { 440 for (size_t i = 0; i < arraysize(kDataResources); ++i) {
440 if (!strcmp(name, kDataResources[i].name)) { 441 if (!strcmp(name, kDataResources[i].name)) {
441 base::StringPiece resource = GetDataResource(kDataResources[i].id); 442 base::StringPiece resource = GetDataResource(kDataResources[i].id);
442 return WebData(resource.data(), resource.size()); 443 return WebData(resource.data(), resource.size());
443 } 444 }
444 } 445 }
445 446
446 NOTREACHED() << "Unknown image resource " << name; 447 NOTREACHED() << "Unknown image resource " << name;
447 return WebData(); 448 return WebData();
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 680 }
680 681
681 // static 682 // static
682 void WebKitPlatformSupportImpl::DestroyCurrentThread(void* thread) { 683 void WebKitPlatformSupportImpl::DestroyCurrentThread(void* thread) {
683 WebThreadImplForMessageLoop* impl = 684 WebThreadImplForMessageLoop* impl =
684 static_cast<WebThreadImplForMessageLoop*>(thread); 685 static_cast<WebThreadImplForMessageLoop*>(thread);
685 delete impl; 686 delete impl;
686 } 687 }
687 688
688 } // namespace webkit_glue 689 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webkitplatformsupport_impl.h ('k') | webkit/glue/websocketstreamhandle_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698