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

Side by Side Diff: content/child/npapi/plugin_host.cc

Issue 183853011: Move TrimWhitespace to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 "content/child/npapi/plugin_host.h" 5 #include "content/child/npapi/plugin_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 256
257 int newstate = statemachine[state][input]; 257 int newstate = statemachine[state][input];
258 258
259 // Take action based on the new state. 259 // Take action based on the new state.
260 if (state != newstate) { 260 if (state != newstate) {
261 switch (newstate) { 261 switch (newstate) {
262 case GETNAME: 262 case GETNAME:
263 // Got a value. 263 // Got a value.
264 value = std::string(start, ptr - start); 264 value = std::string(start, ptr - start);
265 TrimWhitespace(value, TRIM_ALL, &value); 265 base::TrimWhitespace(value, base::TRIM_ALL, &value);
266 // If the name field is empty, we'll skip this header 266 // If the name field is empty, we'll skip this header
267 // but we won't error out. 267 // but we won't error out.
268 if (!name.empty() && name != "content-length") { 268 if (!name.empty() && name != "content-length") {
269 names->push_back(name); 269 names->push_back(name);
270 values->push_back(value); 270 values->push_back(value);
271 } 271 }
272 start = ptr + 1; 272 start = ptr + 1;
273 break; 273 break;
274 case GETVALUE: 274 case GETVALUE:
275 // Got a header. 275 // Got a header.
276 name = StringToLowerASCII(std::string(start, ptr - start)); 276 name = StringToLowerASCII(std::string(start, ptr - start));
277 TrimWhitespace(name, TRIM_ALL, &name); 277 base::TrimWhitespace(name, base::TRIM_ALL, &name);
278 start = ptr + 1; 278 start = ptr + 1;
279 break; 279 break;
280 case GETDATA: { 280 case GETDATA: {
281 // Finished headers, now get body 281 // Finished headers, now get body
282 if (*ptr) 282 if (*ptr)
283 start = ptr + 1; 283 start = ptr + 1;
284 size_t previous_size = body->size(); 284 size_t previous_size = body->size();
285 size_t new_body_size = length - static_cast<int>(start - buf); 285 size_t new_body_size = length - static_cast<int>(start - buf);
286 body->resize(previous_size + new_body_size); 286 body->resize(previous_size + new_body_size);
287 if (!body->empty()) 287 if (!body->empty())
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 } 1105 }
1106 1106
1107 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { 1107 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) {
1108 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); 1108 scoped_refptr<PluginInstance> plugin(FindInstance(instance));
1109 if (plugin.get()) { 1109 if (plugin.get()) {
1110 plugin->URLRedirectResponse(!!allow, notify_data); 1110 plugin->URLRedirectResponse(!!allow, notify_data);
1111 } 1111 }
1112 } 1112 }
1113 1113
1114 } // extern "C" 1114 } // extern "C"
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/renderer/npapi/webplugin_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698