1 // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4
5 #include <cstring>
6
7 #include "tests/cefclient/browser/resource.h"
8
9 namespace client {
10
GetResourceId(const char * resource_name)11 int GetResourceId(const char* resource_name) {
12 // Map of resource labels to BINARY id values.
13 static struct _resource_map {
14 const char* name;
15 int id;
16 } resource_map[] = {
17 {"binding.html", IDS_BINDING_HTML},
18 {"dialogs.html", IDS_DIALOGS_HTML},
19 {"draggable.html", IDS_DRAGGABLE_HTML},
20 {"extensions/set_page_color/icon.png",
21 IDS_EXTENSIONS_SET_PAGE_COLOR_ICON_PNG},
22 {"extensions/set_page_color/manifest.json",
23 IDS_EXTENSIONS_SET_PAGE_COLOR_MANIFEST_JSON},
24 {"extensions/set_page_color/popup.html",
25 IDS_EXTENSIONS_SET_PAGE_COLOR_POPUP_HTML},
26 {"extensions/set_page_color/popup.js",
27 IDS_EXTENSIONS_SET_PAGE_COLOR_POPUP_JS},
28 {"localstorage.html", IDS_LOCALSTORAGE_HTML},
29 {"logo.png", IDS_LOGO_PNG},
30 {"media_router.html", IDS_MEDIA_ROUTER_HTML},
31 {"menu_icon.1x.png", IDS_MENU_ICON_1X_PNG},
32 {"menu_icon.2x.png", IDS_MENU_ICON_2X_PNG},
33 {"osr_test.html", IDS_OSRTEST_HTML},
34 {"other_tests.html", IDS_OTHER_TESTS_HTML},
35 {"pdf.html", IDS_PDF_HTML},
36 {"pdf.pdf", IDS_PDF_PDF},
37 {"performance.html", IDS_PERFORMANCE_HTML},
38 {"performance2.html", IDS_PERFORMANCE2_HTML},
39 {"preferences.html", IDS_PREFERENCES_HTML},
40 {"response_filter.html", IDS_RESPONSE_FILTER_HTML},
41 {"server.html", IDS_SERVER_HTML},
42 {"transparency.html", IDS_TRANSPARENCY_HTML},
43 {"urlrequest.html", IDS_URLREQUEST_HTML},
44 {"websocket.html", IDS_WEBSOCKET_HTML},
45 {"window.html", IDS_WINDOW_HTML},
46 {"window_icon.1x.png", IDS_WINDOW_ICON_1X_PNG},
47 {"window_icon.2x.png", IDS_WINDOW_ICON_2X_PNG},
48 {"xmlhttprequest.html", IDS_XMLHTTPREQUEST_HTML},
49 };
50
51 for (size_t i = 0; i < sizeof(resource_map) / sizeof(_resource_map); ++i) {
52 if (!strcmp(resource_map[i].name, resource_name))
53 return resource_map[i].id;
54 }
55
56 return 0;
57 }
58
59 } // namespace client
60