| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "webkit/glue/plugins/plugin_host.h" | 5 #include "webkit/glue/plugins/plugin_host.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 194 } |
| 195 | 195 |
| 196 int newstate = statemachine[state][input]; | 196 int newstate = statemachine[state][input]; |
| 197 | 197 |
| 198 // Take action based on the new state. | 198 // Take action based on the new state. |
| 199 if (state != newstate) { | 199 if (state != newstate) { |
| 200 switch (newstate) { | 200 switch (newstate) { |
| 201 case GETNAME: | 201 case GETNAME: |
| 202 // Got a value. | 202 // Got a value. |
| 203 value = std::string(start, ptr - start); | 203 value = std::string(start, ptr - start); |
| 204 TrimWhitespace(value, TRIM_ALL, &value); | 204 TrimWhitespaceASCII(value, TRIM_ALL, &value); |
| 205 // If the name field is empty, we'll skip this header | 205 // If the name field is empty, we'll skip this header |
| 206 // but we won't error out. | 206 // but we won't error out. |
| 207 if (!name.empty() && name != "content-length") { | 207 if (!name.empty() && name != "content-length") { |
| 208 names->push_back(name); | 208 names->push_back(name); |
| 209 values->push_back(value); | 209 values->push_back(value); |
| 210 } | 210 } |
| 211 start = ptr + 1; | 211 start = ptr + 1; |
| 212 break; | 212 break; |
| 213 case GETVALUE: | 213 case GETVALUE: |
| 214 // Got a header. | 214 // Got a header. |
| 215 name = StringToLowerASCII(std::string(start, ptr - start)); | 215 name = StringToLowerASCII(std::string(start, ptr - start)); |
| 216 TrimWhitespace(name, TRIM_ALL, &name); | 216 TrimWhitespaceASCII(name, TRIM_ALL, &name); |
| 217 start = ptr + 1; | 217 start = ptr + 1; |
| 218 break; | 218 break; |
| 219 case GETDATA: | 219 case GETDATA: |
| 220 { | 220 { |
| 221 // Finished headers, now get body | 221 // Finished headers, now get body |
| 222 if (*ptr) | 222 if (*ptr) |
| 223 start = ptr + 1; | 223 start = ptr + 1; |
| 224 size_t previous_size = body->size(); | 224 size_t previous_size = body->size(); |
| 225 size_t new_body_size = length - static_cast<int>(start - buf); | 225 size_t new_body_size = length - static_cast<int>(start - buf); |
| 226 body->resize(previous_size + new_body_size); | 226 body->resize(previous_size + new_body_size); |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 void NPN_PluginThreadAsyncCall(NPP id, | 896 void NPN_PluginThreadAsyncCall(NPP id, |
| 897 void (*func)(void *), | 897 void (*func)(void *), |
| 898 void *userData) { | 898 void *userData) { |
| 899 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); | 899 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
| 900 if (plugin) { | 900 if (plugin) { |
| 901 plugin->PluginThreadAsyncCall(func, userData); | 901 plugin->PluginThreadAsyncCall(func, userData); |
| 902 } | 902 } |
| 903 } | 903 } |
| 904 | 904 |
| 905 } // extern "C" | 905 } // extern "C" |
| OLD | NEW |