| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child/blink_platform_impl.h" | 5 #include "content/child/blink_platform_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 } // namespace | 1067 } // namespace |
| 1068 | 1068 |
| 1069 WebData BlinkPlatformImpl::loadResource(const char* name) { | 1069 WebData BlinkPlatformImpl::loadResource(const char* name) { |
| 1070 // Some clients will call into this method with an empty |name| when they have | 1070 // Some clients will call into this method with an empty |name| when they have |
| 1071 // optional resources. For example, the PopupMenuChromium code can have icons | 1071 // optional resources. For example, the PopupMenuChromium code can have icons |
| 1072 // for some Autofill items but not for others. | 1072 // for some Autofill items but not for others. |
| 1073 if (!strlen(name)) | 1073 if (!strlen(name)) |
| 1074 return WebData(); | 1074 return WebData(); |
| 1075 | 1075 |
| 1076 // Check the name prefix to see if it's an audio resource. | 1076 // Check the name prefix to see if it's an audio resource. |
| 1077 if (base::StartsWithASCII(name, "IRC_Composite", true) || | 1077 if (base::StartsWith(name, "IRC_Composite", base::CompareCase::SENSITIVE) || |
| 1078 base::StartsWithASCII(name, "Composite", true)) | 1078 base::StartsWith(name, "Composite", base::CompareCase::SENSITIVE)) |
| 1079 return loadAudioSpatializationResource(name); | 1079 return loadAudioSpatializationResource(name); |
| 1080 | 1080 |
| 1081 // TODO(flackr): We should use a better than linear search here, a trie would | 1081 // TODO(flackr): We should use a better than linear search here, a trie would |
| 1082 // be ideal. | 1082 // be ideal. |
| 1083 for (size_t i = 0; i < arraysize(kDataResources); ++i) { | 1083 for (size_t i = 0; i < arraysize(kDataResources); ++i) { |
| 1084 if (!strcmp(name, kDataResources[i].name)) { | 1084 if (!strcmp(name, kDataResources[i].name)) { |
| 1085 base::StringPiece resource = GetContentClient()->GetDataResource( | 1085 base::StringPiece resource = GetContentClient()->GetDataResource( |
| 1086 kDataResources[i].id, kDataResources[i].scale_factor); | 1086 kDataResources[i].id, kDataResources[i].scale_factor); |
| 1087 return WebData(resource.data(), resource.size()); | 1087 return WebData(resource.data(), resource.size()); |
| 1088 } | 1088 } |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( | 1380 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( |
| 1381 static_cast<ui::DomCode>(dom_code))); | 1381 static_cast<ui::DomCode>(dom_code))); |
| 1382 } | 1382 } |
| 1383 | 1383 |
| 1384 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { | 1384 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { |
| 1385 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( | 1385 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( |
| 1386 code.utf8().data())); | 1386 code.utf8().data())); |
| 1387 } | 1387 } |
| 1388 | 1388 |
| 1389 } // namespace content | 1389 } // namespace content |
| OLD | NEW |