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

Side by Side Diff: chrome/browser/ui/webui/devtools_ui.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 "chrome/browser/ui/webui/devtools_ui.h" 5 #include "chrome/browser/ui/webui/devtools_ui.h"
6 6
7 #include "base/memory/ref_counted_memory.h" 7 #include "base/memory/ref_counted_memory.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #else 42 #else
43 // URL causing the DevTools window to display a plain text warning. 43 // URL causing the DevTools window to display a plain text warning.
44 const char kFallbackFrontendURL[] = 44 const char kFallbackFrontendURL[] =
45 "data:text/plain,Cannot load DevTools frontend from an untrusted origin"; 45 "data:text/plain,Cannot load DevTools frontend from an untrusted origin";
46 #endif // defined(DEBUG_DEVTOOLS) 46 #endif // defined(DEBUG_DEVTOOLS)
47 47
48 // DevToolsDataSource --------------------------------------------------------- 48 // DevToolsDataSource ---------------------------------------------------------
49 49
50 std::string GetMimeTypeForPath(const std::string& path) { 50 std::string GetMimeTypeForPath(const std::string& path) {
51 std::string filename = PathWithoutParams(path); 51 std::string filename = PathWithoutParams(path);
52 if (EndsWith(filename, ".html", false)) { 52 if (base::EndsWith(filename, ".html", false)) {
53 return "text/html"; 53 return "text/html";
54 } else if (EndsWith(filename, ".css", false)) { 54 } else if (base::EndsWith(filename, ".css", false)) {
55 return "text/css"; 55 return "text/css";
56 } else if (EndsWith(filename, ".js", false)) { 56 } else if (base::EndsWith(filename, ".js", false)) {
57 return "application/javascript"; 57 return "application/javascript";
58 } else if (EndsWith(filename, ".png", false)) { 58 } else if (base::EndsWith(filename, ".png", false)) {
59 return "image/png"; 59 return "image/png";
60 } else if (EndsWith(filename, ".gif", false)) { 60 } else if (base::EndsWith(filename, ".gif", false)) {
61 return "image/gif"; 61 return "image/gif";
62 } else if (EndsWith(filename, ".svg", false)) { 62 } else if (base::EndsWith(filename, ".svg", false)) {
63 return "image/svg+xml"; 63 return "image/svg+xml";
64 } else if (EndsWith(filename, ".manifest", false)) { 64 } else if (base::EndsWith(filename, ".manifest", false)) {
65 return "text/cache-manifest"; 65 return "text/cache-manifest";
66 } 66 }
67 return "text/html"; 67 return "text/html";
68 } 68 }
69 69
70 // An URLDataSource implementation that handles chrome-devtools://devtools/ 70 // An URLDataSource implementation that handles chrome-devtools://devtools/
71 // requests. Three types of requests could be handled based on the URL path: 71 // requests. Three types of requests could be handled based on the URL path:
72 // 1. /bundled/: bundled DevTools frontend is served. 72 // 1. /bundled/: bundled DevTools frontend is served.
73 // 2. /remote/: remote DevTools frontend is served from App Engine. 73 // 2. /remote/: remote DevTools frontend is served from App Engine.
74 class DevToolsDataSource : public content::URLDataSource, 74 class DevToolsDataSource : public content::URLDataSource,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 bindings_(web_ui->GetWebContents()) { 255 bindings_(web_ui->GetWebContents()) {
256 web_ui->SetBindings(0); 256 web_ui->SetBindings(0);
257 Profile* profile = Profile::FromWebUI(web_ui); 257 Profile* profile = Profile::FromWebUI(web_ui);
258 content::URLDataSource::Add( 258 content::URLDataSource::Add(
259 profile, 259 profile,
260 new DevToolsDataSource(profile->GetRequestContext())); 260 new DevToolsDataSource(profile->GetRequestContext()));
261 } 261 }
262 262
263 DevToolsUI::~DevToolsUI() { 263 DevToolsUI::~DevToolsUI() {
264 } 264 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc ('k') | chrome/browser/ui/webui/print_preview/print_preview_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698