OLD | NEW |
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/web_ui_data_source_impl.h" | 5 #include "content/browser/webui/web_ui_data_source_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 void WebUIDataSourceImpl::DisableDenyXFrameOptions() { | 184 void WebUIDataSourceImpl::DisableDenyXFrameOptions() { |
185 deny_xframe_options_ = false; | 185 deny_xframe_options_ = false; |
186 } | 186 } |
187 | 187 |
188 std::string WebUIDataSourceImpl::GetSource() const { | 188 std::string WebUIDataSourceImpl::GetSource() const { |
189 return source_name_; | 189 return source_name_; |
190 } | 190 } |
191 | 191 |
192 std::string WebUIDataSourceImpl::GetMimeType(const std::string& path) const { | 192 std::string WebUIDataSourceImpl::GetMimeType(const std::string& path) const { |
193 if (base::EndsWith(path, ".css", false)) | 193 if (base::EndsWith(path, ".css", base::CompareCase::INSENSITIVE_ASCII)) |
194 return "text/css"; | 194 return "text/css"; |
195 | 195 |
196 if (base::EndsWith(path, ".js", false)) | 196 if (base::EndsWith(path, ".js", base::CompareCase::INSENSITIVE_ASCII)) |
197 return "application/javascript"; | 197 return "application/javascript"; |
198 | 198 |
199 if (base::EndsWith(path, ".json", false)) | 199 if (base::EndsWith(path, ".json", base::CompareCase::INSENSITIVE_ASCII)) |
200 return "application/json"; | 200 return "application/json"; |
201 | 201 |
202 if (base::EndsWith(path, ".pdf", false)) | 202 if (base::EndsWith(path, ".pdf", base::CompareCase::INSENSITIVE_ASCII)) |
203 return "application/pdf"; | 203 return "application/pdf"; |
204 | 204 |
205 if (base::EndsWith(path, ".svg", false)) | 205 if (base::EndsWith(path, ".svg", base::CompareCase::INSENSITIVE_ASCII)) |
206 return "image/svg+xml"; | 206 return "image/svg+xml"; |
207 | 207 |
208 return "text/html"; | 208 return "text/html"; |
209 } | 209 } |
210 | 210 |
211 void WebUIDataSourceImpl::StartDataRequest( | 211 void WebUIDataSourceImpl::StartDataRequest( |
212 const std::string& path, | 212 const std::string& path, |
213 int render_process_id, | 213 int render_process_id, |
214 int render_frame_id, | 214 int render_frame_id, |
215 const URLDataSource::GotDataCallback& callback) { | 215 const URLDataSource::GotDataCallback& callback) { |
(...skipping 29 matching lines...) Expand all Loading... |
245 } | 245 } |
246 | 246 |
247 void WebUIDataSourceImpl::SendFromResourceBundle( | 247 void WebUIDataSourceImpl::SendFromResourceBundle( |
248 const URLDataSource::GotDataCallback& callback, int idr) { | 248 const URLDataSource::GotDataCallback& callback, int idr) { |
249 scoped_refptr<base::RefCountedStaticMemory> response( | 249 scoped_refptr<base::RefCountedStaticMemory> response( |
250 GetContentClient()->GetDataResourceBytes(idr)); | 250 GetContentClient()->GetDataResourceBytes(idr)); |
251 callback.Run(response.get()); | 251 callback.Run(response.get()); |
252 } | 252 } |
253 | 253 |
254 } // namespace content | 254 } // namespace content |
OLD | NEW |