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

Side by Side Diff: components/devtools_http_handler/devtools_http_handler.cc

Issue 1182183003: Move EndsWith to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 <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
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 (EndsWith(filename, ".html", false)) { 362 if (base::EndsWith(filename, ".html", false)) {
363 return "text/html"; 363 return "text/html";
364 } else if (EndsWith(filename, ".css", false)) { 364 } else if (base::EndsWith(filename, ".css", false)) {
365 return "text/css"; 365 return "text/css";
366 } else if (EndsWith(filename, ".js", false)) { 366 } else if (base::EndsWith(filename, ".js", false)) {
367 return "application/javascript"; 367 return "application/javascript";
368 } else if (EndsWith(filename, ".png", false)) { 368 } else if (base::EndsWith(filename, ".png", false)) {
369 return "image/png"; 369 return "image/png";
370 } else if (EndsWith(filename, ".gif", false)) { 370 } else if (base::EndsWith(filename, ".gif", false)) {
371 return "image/gif"; 371 return "image/gif";
372 } else if (EndsWith(filename, ".json", false)) { 372 } else if (base::EndsWith(filename, ".json", false)) {
373 return "application/json"; 373 return "application/json";
374 } 374 }
375 LOG(ERROR) << "GetMimeType doesn't know mime type for: " 375 LOG(ERROR) << "GetMimeType doesn't know mime type for: "
376 << filename 376 << filename
377 << " text/plain will be returned"; 377 << " text/plain will be returned";
378 NOTREACHED(); 378 NOTREACHED();
379 return "text/plain"; 379 return "text/plain";
380 } 380 }
381 381
382 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
905 id.c_str(), 905 id.c_str(),
906 host); 906 host);
907 dictionary->SetString( 907 dictionary->SetString(
908 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); 908 kTargetDevtoolsFrontendUrlField, devtools_frontend_url);
909 } 909 }
910 910
911 return dictionary; 911 return dictionary;
912 } 912 }
913 913
914 } // namespace devtools_http_handler 914 } // namespace devtools_http_handler
OLDNEW
« no previous file with comments | « chrome/renderer/content_settings_observer.cc ('k') | components/dom_distiller/core/page_features.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698