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 <algorithm> | 5 #include <algorithm> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 } | 352 } |
353 | 353 |
354 static std::string PathWithoutParams(const std::string& path) { | 354 static std::string PathWithoutParams(const std::string& path) { |
355 size_t query_position = path.find("?"); | 355 size_t query_position = path.find("?"); |
356 if (query_position != std::string::npos) | 356 if (query_position != std::string::npos) |
357 return path.substr(0, query_position); | 357 return path.substr(0, query_position); |
358 return path; | 358 return path; |
359 } | 359 } |
360 | 360 |
361 static std::string GetMimeType(const std::string& filename) { | 361 static std::string GetMimeType(const std::string& filename) { |
362 if (base::EndsWith(filename, ".html", false)) { | 362 if (base::EndsWith(filename, ".html", base::CompareCase::INSENSITIVE_ASCII)) { |
363 return "text/html"; | 363 return "text/html"; |
364 } else if (base::EndsWith(filename, ".css", false)) { | 364 } else if (base::EndsWith(filename, ".css", |
| 365 base::CompareCase::INSENSITIVE_ASCII)) { |
365 return "text/css"; | 366 return "text/css"; |
366 } else if (base::EndsWith(filename, ".js", false)) { | 367 } else if (base::EndsWith(filename, ".js", |
| 368 base::CompareCase::INSENSITIVE_ASCII)) { |
367 return "application/javascript"; | 369 return "application/javascript"; |
368 } else if (base::EndsWith(filename, ".png", false)) { | 370 } else if (base::EndsWith(filename, ".png", |
| 371 base::CompareCase::INSENSITIVE_ASCII)) { |
369 return "image/png"; | 372 return "image/png"; |
370 } else if (base::EndsWith(filename, ".gif", false)) { | 373 } else if (base::EndsWith(filename, ".gif", |
| 374 base::CompareCase::INSENSITIVE_ASCII)) { |
371 return "image/gif"; | 375 return "image/gif"; |
372 } else if (base::EndsWith(filename, ".json", false)) { | 376 } else if (base::EndsWith(filename, ".json", |
| 377 base::CompareCase::INSENSITIVE_ASCII)) { |
373 return "application/json"; | 378 return "application/json"; |
374 } | 379 } |
375 LOG(ERROR) << "GetMimeType doesn't know mime type for: " | 380 LOG(ERROR) << "GetMimeType doesn't know mime type for: " |
376 << filename | 381 << filename |
377 << " text/plain will be returned"; | 382 << " text/plain will be returned"; |
378 NOTREACHED(); | 383 NOTREACHED(); |
379 return "text/plain"; | 384 return "text/plain"; |
380 } | 385 } |
381 | 386 |
382 void ServerWrapper::OnHttpRequest(int connection_id, | 387 void ServerWrapper::OnHttpRequest(int connection_id, |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 id.c_str(), | 910 id.c_str(), |
906 host); | 911 host); |
907 dictionary->SetString( | 912 dictionary->SetString( |
908 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); | 913 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); |
909 } | 914 } |
910 | 915 |
911 return dictionary; | 916 return dictionary; |
912 } | 917 } |
913 | 918 |
914 } // namespace devtools_http_handler | 919 } // namespace devtools_http_handler |
OLD | NEW |