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", base::CompareCase::INSENSITIVE_ASCII)) { | 362 if (base::EndsWith(filename, ".html", false)) { |
363 return "text/html"; | 363 return "text/html"; |
364 } else if (base::EndsWith(filename, ".css", | 364 } else if (base::EndsWith(filename, ".css", false)) { |
365 base::CompareCase::INSENSITIVE_ASCII)) { | |
366 return "text/css"; | 365 return "text/css"; |
367 } else if (base::EndsWith(filename, ".js", | 366 } else if (base::EndsWith(filename, ".js", false)) { |
368 base::CompareCase::INSENSITIVE_ASCII)) { | |
369 return "application/javascript"; | 367 return "application/javascript"; |
370 } else if (base::EndsWith(filename, ".png", | 368 } else if (base::EndsWith(filename, ".png", false)) { |
371 base::CompareCase::INSENSITIVE_ASCII)) { | |
372 return "image/png"; | 369 return "image/png"; |
373 } else if (base::EndsWith(filename, ".gif", | 370 } else if (base::EndsWith(filename, ".gif", false)) { |
374 base::CompareCase::INSENSITIVE_ASCII)) { | |
375 return "image/gif"; | 371 return "image/gif"; |
376 } else if (base::EndsWith(filename, ".json", | 372 } else if (base::EndsWith(filename, ".json", false)) { |
377 base::CompareCase::INSENSITIVE_ASCII)) { | |
378 return "application/json"; | 373 return "application/json"; |
379 } | 374 } |
380 LOG(ERROR) << "GetMimeType doesn't know mime type for: " | 375 LOG(ERROR) << "GetMimeType doesn't know mime type for: " |
381 << filename | 376 << filename |
382 << " text/plain will be returned"; | 377 << " text/plain will be returned"; |
383 NOTREACHED(); | 378 NOTREACHED(); |
384 return "text/plain"; | 379 return "text/plain"; |
385 } | 380 } |
386 | 381 |
387 void ServerWrapper::OnHttpRequest(int connection_id, | 382 void ServerWrapper::OnHttpRequest(int connection_id, |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 id.c_str(), | 905 id.c_str(), |
911 host); | 906 host); |
912 dictionary->SetString( | 907 dictionary->SetString( |
913 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); | 908 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); |
914 } | 909 } |
915 | 910 |
916 return dictionary; | 911 return dictionary; |
917 } | 912 } |
918 | 913 |
919 } // namespace devtools_http_handler | 914 } // namespace devtools_http_handler |
OLD | NEW |