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

Side by Side Diff: ios/web/webui/web_ui_ios_data_source_impl.cc

Issue 1233453011: Revert of Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « gpu/command_buffer/service/program_manager.cc ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ios/web/webui/web_ui_ios_data_source_impl.h" 5 #include "ios/web/webui/web_ui_ios_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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 void WebUIIOSDataSourceImpl::DisableDenyXFrameOptions() { 103 void WebUIIOSDataSourceImpl::DisableDenyXFrameOptions() {
104 deny_xframe_options_ = false; 104 deny_xframe_options_ = false;
105 } 105 }
106 106
107 std::string WebUIIOSDataSourceImpl::GetSource() const { 107 std::string WebUIIOSDataSourceImpl::GetSource() const {
108 return source_name_; 108 return source_name_;
109 } 109 }
110 110
111 std::string WebUIIOSDataSourceImpl::GetMimeType(const std::string& path) const { 111 std::string WebUIIOSDataSourceImpl::GetMimeType(const std::string& path) const {
112 if (base::EndsWith(path, ".js", base::CompareCase::INSENSITIVE_ASCII)) 112 if (base::EndsWith(path, ".js", false))
113 return "application/javascript"; 113 return "application/javascript";
114 114
115 if (base::EndsWith(path, ".json", base::CompareCase::INSENSITIVE_ASCII)) 115 if (base::EndsWith(path, ".json", false))
116 return "application/json"; 116 return "application/json";
117 117
118 if (base::EndsWith(path, ".pdf", base::CompareCase::INSENSITIVE_ASCII)) 118 if (base::EndsWith(path, ".pdf", false))
119 return "application/pdf"; 119 return "application/pdf";
120 120
121 if (base::EndsWith(path, ".css", base::CompareCase::INSENSITIVE_ASCII)) 121 if (base::EndsWith(path, ".css", false))
122 return "text/css"; 122 return "text/css";
123 123
124 if (base::EndsWith(path, ".svg", base::CompareCase::INSENSITIVE_ASCII)) 124 if (base::EndsWith(path, ".svg", false))
125 return "image/svg+xml"; 125 return "image/svg+xml";
126 126
127 return "text/html"; 127 return "text/html";
128 } 128 }
129 129
130 void WebUIIOSDataSourceImpl::StartDataRequest( 130 void WebUIIOSDataSourceImpl::StartDataRequest(
131 const std::string& path, 131 const std::string& path,
132 const URLDataSourceIOS::GotDataCallback& callback) { 132 const URLDataSourceIOS::GotDataCallback& callback) {
133 if (!json_path_.empty() && path == json_path_) { 133 if (!json_path_.empty() && path == json_path_) {
134 SendLocalizedStringsAsJSON(callback); 134 SendLocalizedStringsAsJSON(callback);
(...skipping 23 matching lines...) Expand all
158 158
159 void WebUIIOSDataSourceImpl::SendFromResourceBundle( 159 void WebUIIOSDataSourceImpl::SendFromResourceBundle(
160 const URLDataSourceIOS::GotDataCallback& callback, 160 const URLDataSourceIOS::GotDataCallback& callback,
161 int idr) { 161 int idr) {
162 scoped_refptr<base::RefCountedStaticMemory> response( 162 scoped_refptr<base::RefCountedStaticMemory> response(
163 GetWebClient()->GetDataResourceBytes(idr)); 163 GetWebClient()->GetDataResourceBytes(idr));
164 callback.Run(response.get()); 164 callback.Run(response.get());
165 } 165 }
166 166
167 } // namespace web 167 } // namespace web
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/program_manager.cc ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698