Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: content/browser/webui/shared_resources_data_source.cc

Issue 902053003: Add cr-toggle-button to Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/webui/shared_resources_data_source.h" 5 #include "content/browser/webui/shared_resources_data_source.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 10 matching lines...) Expand all
21 namespace content { 21 namespace content {
22 22
23 namespace { 23 namespace {
24 24
25 using ResourcesMap = base::hash_map<std::string, int>; 25 using ResourcesMap = base::hash_map<std::string, int>;
26 26
27 // TODO(rkc): Once we have a separate source for apps, remove '*/apps/' aliases. 27 // TODO(rkc): Once we have a separate source for apps, remove '*/apps/' aliases.
28 const char* kPathAliases[][2] = { 28 const char* kPathAliases[][2] = {
29 {"../../resources/default_100_percent/common/", "images/apps/"}, 29 {"../../resources/default_100_percent/common/", "images/apps/"},
30 {"../../resources/default_200_percent/common/", "images/2x/apps/"}, 30 {"../../resources/default_200_percent/common/", "images/2x/apps/"},
31 {"../../../third_party/polymer/components-chromium/", "polymer/"} 31 {"../../../third_party/polymer/components-chromium/", "polymer/"},
32 {"../../webui/resources/custom_elements/", "custom-elements/"}
stevenjb 2015/02/05 23:36:21 This should probably come before third_party (or t
michaelpg 2015/02/06 08:55:43 Done.
32 }; 33 };
33 34
34 void AddResource(const std::string& path, 35 void AddResource(const std::string& path,
35 int resource_id, 36 int resource_id,
36 ResourcesMap* resources_map) { 37 ResourcesMap* resources_map) {
37 if (!resources_map->insert(std::make_pair(path, resource_id)).second) 38 if (!resources_map->insert(std::make_pair(path, resource_id)).second)
38 NOTREACHED() << "Redefinition of '" << path << "'"; 39 NOTREACHED() << "Redefinition of '" << path << "'";
39 } 40 }
40 41
41 const ResourcesMap* CreateResourcesMap() { 42 const ResourcesMap* CreateResourcesMap() {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // wildcards, so we need to set its value explicitly by passing the |origin| 114 // wildcards, so we need to set its value explicitly by passing the |origin|
114 // back. 115 // back.
115 std::string allowed_origin_prefix = kChromeUIScheme; 116 std::string allowed_origin_prefix = kChromeUIScheme;
116 allowed_origin_prefix += "://"; 117 allowed_origin_prefix += "://";
117 if (origin.find(allowed_origin_prefix) != 0) 118 if (origin.find(allowed_origin_prefix) != 0)
118 return "null"; 119 return "null";
119 return origin; 120 return origin;
120 } 121 }
121 122
122 } // namespace content 123 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/webui/resources/custom_element_resources.grdp » ('j') | ui/webui/resources/custom_element_resources.grdp » ('J')

Powered by Google App Engine
This is Rietveld 408576698