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

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

Issue 1105743003: Add a 0.8 version of cr-checkbox with a demo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@polymer08
Patch Set: Remove the demo structure from cr_elements_resources.grdp" Created 5 years, 8 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 | « no previous file | ui/webui/resources/cr_elements/v0_8/cr_checkbox/cr_checkbox.css » ('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"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/threading/thread_restrictions.h" 12 #include "base/threading/thread_restrictions.h"
13 #include "content/public/common/content_client.h" 13 #include "content/public/common/content_client.h"
14 #include "content/public/common/url_constants.h" 14 #include "content/public/common/url_constants.h"
15 #include "net/base/mime_util.h" 15 #include "net/base/mime_util.h"
16 #include "ui/base/layout.h" 16 #include "ui/base/layout.h"
17 #include "ui/base/webui/web_ui_util.h" 17 #include "ui/base/webui/web_ui_util.h"
18 #include "ui/resources/grit/webui_resources.h" 18 #include "ui/resources/grit/webui_resources.h"
19 #include "ui/resources/grit/webui_resources_map.h" 19 #include "ui/resources/grit/webui_resources_map.h"
20 20
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 {"../../../third_party/polymer/components-chromium/", "polymer/"}, 29 {"../../../third_party/polymer/components-chromium/", "polymer/"},
30 {"../../../third_party/polymer/v0_8/components-chromium/", "polymer/v0_8/"},
30 {"../../../third_party/web-animations-js/sources/", 31 {"../../../third_party/web-animations-js/sources/",
31 "polymer/web-animations-js/"}, 32 "polymer/web-animations-js/"},
32 {"../../resources/default_100_percent/common/", "images/apps/"}, 33 {"../../resources/default_100_percent/common/", "images/apps/"},
33 {"../../resources/default_200_percent/common/", "images/2x/apps/"}, 34 {"../../resources/default_200_percent/common/", "images/2x/apps/"},
34 {"../../webui/resources/cr_elements/", "cr_elements/"}}; 35 {"../../webui/resources/cr_elements/", "cr_elements/"}};
35 36
36 void AddResource(const std::string& path, 37 void AddResource(const std::string& path,
37 int resource_id, 38 int resource_id,
38 ResourcesMap* resources_map) { 39 ResourcesMap* resources_map) {
39 if (!resources_map->insert(std::make_pair(path, resource_id)).second) 40 if (!resources_map->insert(std::make_pair(path, resource_id)).second)
(...skipping 75 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 | « no previous file | ui/webui/resources/cr_elements/v0_8/cr_checkbox/cr_checkbox.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698