| 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 "webkit/glue/webkitplatformsupport_impl.h" |     5 #include "webkit/glue/webkitplatformsupport_impl.h" | 
|     6  |     6  | 
|     7 #include <math.h> |     7 #include <math.h> | 
|     8  |     8  | 
|     9 #include <vector> |     9 #include <vector> | 
|    10  |    10  | 
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   492   TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_enabled, name, id, |   492   TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_enabled, name, id, | 
|   493                                   num_args, arg_names, arg_types, |   493                                   num_args, arg_names, arg_types, | 
|   494                                   arg_values, NULL, flags); |   494                                   arg_values, NULL, flags); | 
|   495 } |   495 } | 
|   496  |   496  | 
|   497  |   497  | 
|   498 namespace { |   498 namespace { | 
|   499  |   499  | 
|   500 WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform, |   500 WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform, | 
|   501                                         const char* name) { |   501                                         const char* name) { | 
 |   502 #ifdef IDR_AUDIO_SPATIALIZATION_COMPOSITE | 
 |   503   if (!strcmp(name, "Composite")) { | 
 |   504     base::StringPiece resource = | 
 |   505         platform->GetDataResource(IDR_AUDIO_SPATIALIZATION_COMPOSITE, | 
 |   506                                   ui::SCALE_FACTOR_NONE); | 
 |   507     return WebData(resource.data(), resource.size()); | 
 |   508   } | 
 |   509 #endif | 
 |   510  | 
|   502 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000 |   511 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000 | 
|   503   const size_t kExpectedSpatializationNameLength = 31; |   512   const size_t kExpectedSpatializationNameLength = 31; | 
|   504   if (strlen(name) != kExpectedSpatializationNameLength) { |   513   if (strlen(name) != kExpectedSpatializationNameLength) { | 
|   505     return WebData(); |   514     return WebData(); | 
|   506   } |   515   } | 
|   507  |   516  | 
|   508   // Extract the azimuth and elevation from the resource name. |   517   // Extract the azimuth and elevation from the resource name. | 
|   509   int azimuth = 0; |   518   int azimuth = 0; | 
|   510   int elevation = 0; |   519   int elevation = 0; | 
|   511   int values_parsed = |   520   int values_parsed = | 
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   659 }  // namespace |   668 }  // namespace | 
|   660  |   669  | 
|   661 WebData WebKitPlatformSupportImpl::loadResource(const char* name) { |   670 WebData WebKitPlatformSupportImpl::loadResource(const char* name) { | 
|   662   // Some clients will call into this method with an empty |name| when they have |   671   // Some clients will call into this method with an empty |name| when they have | 
|   663   // optional resources.  For example, the PopupMenuChromium code can have icons |   672   // optional resources.  For example, the PopupMenuChromium code can have icons | 
|   664   // for some Autofill items but not for others. |   673   // for some Autofill items but not for others. | 
|   665   if (!strlen(name)) |   674   if (!strlen(name)) | 
|   666     return WebData(); |   675     return WebData(); | 
|   667  |   676  | 
|   668   // Check the name prefix to see if it's an audio resource. |   677   // Check the name prefix to see if it's an audio resource. | 
|   669   if (StartsWithASCII(name, "IRC_Composite", true)) |   678   if (StartsWithASCII(name, "IRC_Composite", true) || | 
 |   679       StartsWithASCII(name, "Composite", true)) | 
|   670     return loadAudioSpatializationResource(this, name); |   680     return loadAudioSpatializationResource(this, name); | 
|   671  |   681  | 
|   672   // TODO(flackr): We should use a better than linear search here, a trie would |   682   // TODO(flackr): We should use a better than linear search here, a trie would | 
|   673   // be ideal. |   683   // be ideal. | 
|   674   for (size_t i = 0; i < arraysize(kDataResources); ++i) { |   684   for (size_t i = 0; i < arraysize(kDataResources); ++i) { | 
|   675     if (!strcmp(name, kDataResources[i].name)) { |   685     if (!strcmp(name, kDataResources[i].name)) { | 
|   676       base::StringPiece resource = |   686       base::StringPiece resource = | 
|   677           GetDataResource(kDataResources[i].id, |   687           GetDataResource(kDataResources[i].id, | 
|   678                           kDataResources[i].scale_factor); |   688                           kDataResources[i].scale_factor); | 
|   679       return WebData(resource.data(), resource.size()); |   689       return WebData(resource.data(), resource.size()); | 
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   984 } |   994 } | 
|   985  |   995  | 
|   986 #if defined(OS_ANDROID) |   996 #if defined(OS_ANDROID) | 
|   987 webkit_media::WebAudioMediaCodecRunner |   997 webkit_media::WebAudioMediaCodecRunner | 
|   988     WebKitPlatformSupportImpl::GetWebAudioMediaCodecRunner() { |   998     WebKitPlatformSupportImpl::GetWebAudioMediaCodecRunner() { | 
|   989   return base::Bind(&NullRunWebAudioMediaCodec); |   999   return base::Bind(&NullRunWebAudioMediaCodec); | 
|   990 } |  1000 } | 
|   991 #endif |  1001 #endif | 
|   992  |  1002  | 
|   993 }  // namespace webkit_glue |  1003 }  // namespace webkit_glue | 
| OLD | NEW |