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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 } // namespace | 1019 } // namespace |
1020 | 1020 |
1021 WebData BlinkPlatformImpl::loadResource(const char* name) { | 1021 WebData BlinkPlatformImpl::loadResource(const char* name) { |
1022 // Some clients will call into this method with an empty |name| when they have | 1022 // Some clients will call into this method with an empty |name| when they have |
1023 // optional resources. For example, the PopupMenuChromium code can have icons | 1023 // optional resources. For example, the PopupMenuChromium code can have icons |
1024 // for some Autofill items but not for others. | 1024 // for some Autofill items but not for others. |
1025 if (!strlen(name)) | 1025 if (!strlen(name)) |
1026 return WebData(); | 1026 return WebData(); |
1027 | 1027 |
1028 // Check the name prefix to see if it's an audio resource. | 1028 // Check the name prefix to see if it's an audio resource. |
1029 if (StartsWithASCII(name, "IRC_Composite", true) || | 1029 if (base::StartsWithASCII(name, "IRC_Composite", true) || |
1030 StartsWithASCII(name, "Composite", true)) | 1030 base::StartsWithASCII(name, "Composite", true)) |
1031 return loadAudioSpatializationResource(name); | 1031 return loadAudioSpatializationResource(name); |
1032 | 1032 |
1033 // TODO(flackr): We should use a better than linear search here, a trie would | 1033 // TODO(flackr): We should use a better than linear search here, a trie would |
1034 // be ideal. | 1034 // be ideal. |
1035 for (size_t i = 0; i < arraysize(kDataResources); ++i) { | 1035 for (size_t i = 0; i < arraysize(kDataResources); ++i) { |
1036 if (!strcmp(name, kDataResources[i].name)) { | 1036 if (!strcmp(name, kDataResources[i].name)) { |
1037 base::StringPiece resource = GetContentClient()->GetDataResource( | 1037 base::StringPiece resource = GetContentClient()->GetDataResource( |
1038 kDataResources[i].id, kDataResources[i].scale_factor); | 1038 kDataResources[i].id, kDataResources[i].scale_factor); |
1039 return WebData(resource.data(), resource.size()); | 1039 return WebData(resource.data(), resource.size()); |
1040 } | 1040 } |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( | 1386 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( |
1387 static_cast<ui::DomCode>(dom_code))); | 1387 static_cast<ui::DomCode>(dom_code))); |
1388 } | 1388 } |
1389 | 1389 |
1390 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { | 1390 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { |
1391 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( | 1391 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( |
1392 code.utf8().data())); | 1392 code.utf8().data())); |
1393 } | 1393 } |
1394 | 1394 |
1395 } // namespace content | 1395 } // namespace content |
OLD | NEW |