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

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

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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
« no previous file with comments | « content/browser/tracing/tracing_ui.cc ('k') | content/child/blink_platform_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 29 matching lines...) Expand all
40 NOTREACHED() << "Redefinition of '" << path << "'"; 40 NOTREACHED() << "Redefinition of '" << path << "'";
41 } 41 }
42 42
43 const ResourcesMap* CreateResourcesMap() { 43 const ResourcesMap* CreateResourcesMap() {
44 ResourcesMap* result = new ResourcesMap(); 44 ResourcesMap* result = new ResourcesMap();
45 for (size_t i = 0; i < kWebuiResourcesSize; ++i) { 45 for (size_t i = 0; i < kWebuiResourcesSize; ++i) {
46 const std::string resource_name = kWebuiResources[i].name; 46 const std::string resource_name = kWebuiResources[i].name;
47 const int resource_id = kWebuiResources[i].value; 47 const int resource_id = kWebuiResources[i].value;
48 AddResource(resource_name, resource_id, result); 48 AddResource(resource_name, resource_id, result);
49 for (const char* (&alias)[2]: kPathAliases) { 49 for (const char* (&alias)[2]: kPathAliases) {
50 if (base::StartsWithASCII(resource_name, alias[0], true)) { 50 if (base::StartsWith(resource_name, alias[0],
51 base::CompareCase::SENSITIVE)) {
51 AddResource(alias[1] + resource_name.substr(strlen(alias[0])), 52 AddResource(alias[1] + resource_name.substr(strlen(alias[0])),
52 resource_id, result); 53 resource_id, result);
53 } 54 }
54 } 55 }
55 } 56 }
56 57
57 return result; 58 return result;
58 } 59 }
59 60
60 const ResourcesMap& GetResourcesMap() { 61 const ResourcesMap& GetResourcesMap() {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // wildcards, so we need to set its value explicitly by passing the |origin| 116 // wildcards, so we need to set its value explicitly by passing the |origin|
116 // back. 117 // back.
117 std::string allowed_origin_prefix = kChromeUIScheme; 118 std::string allowed_origin_prefix = kChromeUIScheme;
118 allowed_origin_prefix += "://"; 119 allowed_origin_prefix += "://";
119 if (origin.find(allowed_origin_prefix) != 0) 120 if (origin.find(allowed_origin_prefix) != 0)
120 return "null"; 121 return "null";
121 return origin; 122 return origin;
122 } 123 }
123 124
124 } // namespace content 125 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/tracing/tracing_ui.cc ('k') | content/child/blink_platform_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698