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

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

Issue 1516233003: Incognito NTP style tweaks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reinstate Roboto and add text_defaults_md.css Created 4 years, 11 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const URLDataSource::GotDataCallback& callback) { 85 const URLDataSource::GotDataCallback& callback) {
86 const ResourcesMap& resources_map = GetResourcesMap(); 86 const ResourcesMap& resources_map = GetResourcesMap();
87 auto it = resources_map.find(path); 87 auto it = resources_map.find(path);
88 int idr = (it != resources_map.end()) ? it->second : -1; 88 int idr = (it != resources_map.end()) ? it->second : -1;
89 DCHECK_NE(-1, idr) << " path: " << path; 89 DCHECK_NE(-1, idr) << " path: " << path;
90 scoped_refptr<base::RefCountedMemory> bytes; 90 scoped_refptr<base::RefCountedMemory> bytes;
91 91
92 if (idr == IDR_WEBUI_CSS_TEXT_DEFAULTS) { 92 if (idr == IDR_WEBUI_CSS_TEXT_DEFAULTS) {
93 std::string css = webui::GetWebUiCssTextDefaults(); 93 std::string css = webui::GetWebUiCssTextDefaults();
94 bytes = base::RefCountedString::TakeString(&css); 94 bytes = base::RefCountedString::TakeString(&css);
95 } else if (idr == IDR_WEBUI_CSS_TEXT_DEFAULTS_MD) {
96 std::string css = webui::GetWebUiCssTextDefaultsMD();
97 bytes = base::RefCountedString::TakeString(&css);
95 } else { 98 } else {
96 bytes = GetContentClient()->GetDataResourceBytes(idr); 99 bytes = GetContentClient()->GetDataResourceBytes(idr);
97 } 100 }
98 101
99 callback.Run(bytes.get()); 102 callback.Run(bytes.get());
100 } 103 }
101 104
102 std::string SharedResourcesDataSource::GetMimeType( 105 std::string SharedResourcesDataSource::GetMimeType(
103 const std::string& path) const { 106 const std::string& path) const {
104 // Requests should not block on the disk! On POSIX this goes to disk. 107 // Requests should not block on the disk! On POSIX this goes to disk.
(...skipping 13 matching lines...) Expand all
118 // wildcards, so we need to set its value explicitly by passing the |origin| 121 // wildcards, so we need to set its value explicitly by passing the |origin|
119 // back. 122 // back.
120 std::string allowed_origin_prefix = kChromeUIScheme; 123 std::string allowed_origin_prefix = kChromeUIScheme;
121 allowed_origin_prefix += "://"; 124 allowed_origin_prefix += "://";
122 if (origin.find(allowed_origin_prefix) != 0) 125 if (origin.find(allowed_origin_prefix) != 0)
123 return "null"; 126 return "null";
124 return origin; 127 return origin;
125 } 128 }
126 129
127 } // namespace content 130 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698