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 "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/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 252 } |
253 | 253 |
254 int newstate = statemachine[state][input]; | 254 int newstate = statemachine[state][input]; |
255 | 255 |
256 // Take action based on the new state. | 256 // Take action based on the new state. |
257 if (state != newstate) { | 257 if (state != newstate) { |
258 switch (newstate) { | 258 switch (newstate) { |
259 case GETNAME: | 259 case GETNAME: |
260 // Got a value. | 260 // Got a value. |
261 value = std::string(start, ptr - start); | 261 value = std::string(start, ptr - start); |
262 base::TrimWhitespace(value, base::TRIM_ALL, &value); | 262 base::TrimWhitespaceASCII(value, base::TRIM_ALL, &value); |
263 // If the name field is empty, we'll skip this header | 263 // If the name field is empty, we'll skip this header |
264 // but we won't error out. | 264 // but we won't error out. |
265 if (!name.empty() && name != "content-length") { | 265 if (!name.empty() && name != "content-length") { |
266 names->push_back(name); | 266 names->push_back(name); |
267 values->push_back(value); | 267 values->push_back(value); |
268 } | 268 } |
269 start = ptr + 1; | 269 start = ptr + 1; |
270 break; | 270 break; |
271 case GETVALUE: | 271 case GETVALUE: |
272 // Got a header. | 272 // Got a header. |
273 name = base::ToLowerASCII(base::StringPiece(start, ptr - start)); | 273 name = base::ToLowerASCII(base::StringPiece(start, ptr - start)); |
274 base::TrimWhitespace(name, base::TRIM_ALL, &name); | 274 base::TrimWhitespaceASCII(name, base::TRIM_ALL, &name); |
275 start = ptr + 1; | 275 start = ptr + 1; |
276 break; | 276 break; |
277 case GETDATA: { | 277 case GETDATA: { |
278 // Finished headers, now get body | 278 // Finished headers, now get body |
279 if (*ptr) | 279 if (*ptr) |
280 start = ptr + 1; | 280 start = ptr + 1; |
281 size_t previous_size = body->size(); | 281 size_t previous_size = body->size(); |
282 size_t new_body_size = length - static_cast<int>(start - buf); | 282 size_t new_body_size = length - static_cast<int>(start - buf); |
283 body->resize(previous_size + new_body_size); | 283 body->resize(previous_size + new_body_size); |
284 if (!body->empty()) | 284 if (!body->empty()) |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { | 926 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { |
927 // TODO: Implement advanced key handling: http://crbug.com/46578 | 927 // TODO: Implement advanced key handling: http://crbug.com/46578 |
928 NOTIMPLEMENTED(); | 928 NOTIMPLEMENTED(); |
929 return false; | 929 return false; |
930 } | 930 } |
931 | 931 |
932 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 932 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
933 } | 933 } |
934 | 934 |
935 } // extern "C" | 935 } // extern "C" |
OLD | NEW |