• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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       {"drm.html", IDS_DRM_HTML},
21       {"extensions/set_page_color/icon.png",
22        IDS_EXTENSIONS_SET_PAGE_COLOR_ICON_PNG},
23       {"extensions/set_page_color/manifest.json",
24        IDS_EXTENSIONS_SET_PAGE_COLOR_MANIFEST_JSON},
25       {"extensions/set_page_color/popup.html",
26        IDS_EXTENSIONS_SET_PAGE_COLOR_POPUP_HTML},
27       {"extensions/set_page_color/popup.js",
28        IDS_EXTENSIONS_SET_PAGE_COLOR_POPUP_JS},
29       {"localstorage.html", IDS_LOCALSTORAGE_HTML},
30       {"logo.png", IDS_LOGO_PNG},
31       {"media_router.html", IDS_MEDIA_ROUTER_HTML},
32       {"menu_icon.1x.png", IDS_MENU_ICON_1X_PNG},
33       {"menu_icon.2x.png", IDS_MENU_ICON_2X_PNG},
34       {"osr_test.html", IDS_OSRTEST_HTML},
35       {"other_tests.html", IDS_OTHER_TESTS_HTML},
36       {"pdf.html", IDS_PDF_HTML},
37       {"pdf.pdf", IDS_PDF_PDF},
38       {"performance.html", IDS_PERFORMANCE_HTML},
39       {"performance2.html", IDS_PERFORMANCE2_HTML},
40       {"preferences.html", IDS_PREFERENCES_HTML},
41       {"response_filter.html", IDS_RESPONSE_FILTER_HTML},
42       {"server.html", IDS_SERVER_HTML},
43       {"transparency.html", IDS_TRANSPARENCY_HTML},
44       {"urlrequest.html", IDS_URLREQUEST_HTML},
45       {"websocket.html", IDS_WEBSOCKET_HTML},
46       {"window.html", IDS_WINDOW_HTML},
47       {"window_icon.1x.png", IDS_WINDOW_ICON_1X_PNG},
48       {"window_icon.2x.png", IDS_WINDOW_ICON_2X_PNG},
49       {"xmlhttprequest.html", IDS_XMLHTTPREQUEST_HTML},
50   };
51 
52   for (size_t i = 0; i < sizeof(resource_map) / sizeof(_resource_map); ++i) {
53     if (!strcmp(resource_map[i].name, resource_name))
54       return resource_map[i].id;
55   }
56 
57   return 0;
58 }
59 
60 }  // namespace client
61