| 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 (EndsWith(path, ".js", false)) | 193 if (base::EndsWith(path, ".js", false)) |
| 194 return "application/javascript"; | 194 return "application/javascript"; |
| 195 | 195 |
| 196 if (EndsWith(path, ".json", false)) | 196 if (base::EndsWith(path, ".json", false)) |
| 197 return "application/json"; | 197 return "application/json"; |
| 198 | 198 |
| 199 if (EndsWith(path, ".pdf", false)) | 199 if (base::EndsWith(path, ".pdf", false)) |
| 200 return "application/pdf"; | 200 return "application/pdf"; |
| 201 | 201 |
| 202 if (EndsWith(path, ".svg", false)) | 202 if (base::EndsWith(path, ".svg", false)) |
| 203 return "image/svg+xml"; | 203 return "image/svg+xml"; |
| 204 | 204 |
| 205 return "text/html"; | 205 return "text/html"; |
| 206 } | 206 } |
| 207 | 207 |
| 208 void WebUIDataSourceImpl::StartDataRequest( | 208 void WebUIDataSourceImpl::StartDataRequest( |
| 209 const std::string& path, | 209 const std::string& path, |
| 210 int render_process_id, | 210 int render_process_id, |
| 211 int render_frame_id, | 211 int render_frame_id, |
| 212 const URLDataSource::GotDataCallback& callback) { | 212 const URLDataSource::GotDataCallback& callback) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 242 } | 242 } |
| 243 | 243 |
| 244 void WebUIDataSourceImpl::SendFromResourceBundle( | 244 void WebUIDataSourceImpl::SendFromResourceBundle( |
| 245 const URLDataSource::GotDataCallback& callback, int idr) { | 245 const URLDataSource::GotDataCallback& callback, int idr) { |
| 246 scoped_refptr<base::RefCountedStaticMemory> response( | 246 scoped_refptr<base::RefCountedStaticMemory> response( |
| 247 GetContentClient()->GetDataResourceBytes(idr)); | 247 GetContentClient()->GetDataResourceBytes(idr)); |
| 248 callback.Run(response.get()); | 248 callback.Run(response.get()); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace content | 251 } // namespace content |
| OLD | NEW |