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 #ifndef CHROME_COMMON_CHROME_PLUGIN_UTIL_H__ | 5 #ifndef CHROME_COMMON_CHROME_PLUGIN_UTIL_H__ |
6 #define CHROME_COMMON_CHROME_PLUGIN_UTIL_H__ | 6 #define CHROME_COMMON_CHROME_PLUGIN_UTIL_H__ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/non_thread_safe.h" | 9 #include "base/non_thread_safe.h" |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // A class of utility functions for dealing with request responses. | 57 // A class of utility functions for dealing with request responses. |
58 class PluginResponseUtils { | 58 class PluginResponseUtils { |
59 public: | 59 public: |
60 // Helper to convert request load flags from the plugin API to the net API | 60 // Helper to convert request load flags from the plugin API to the net API |
61 // versions. | 61 // versions. |
62 static uint32 CPLoadFlagsToNetFlags(uint32 flags); | 62 static uint32 CPLoadFlagsToNetFlags(uint32 flags); |
63 | 63 |
64 // Common implementation of a CPR_GetResponseInfo call. | 64 // Common implementation of a CPR_GetResponseInfo call. |
65 static int GetResponseInfo( | 65 static int GetResponseInfo( |
66 const net::HttpResponseHeaders* response_headers, | 66 const net::HttpResponseHeaders* response_headers, |
67 CPResponseInfoType type, void* buf, uint32 buf_size); | 67 CPResponseInfoType type, void* buf, size_t buf_size); |
68 }; | 68 }; |
69 | 69 |
70 // Helper to allocate a string using the given CPB_Alloc function. | 70 // Helper to allocate a string using the given CPB_Alloc function. |
71 inline char* CPB_StringDup(CPB_AllocFunc alloc, const std::string& str) { | 71 inline char* CPB_StringDup(CPB_AllocFunc alloc, const std::string& str) { |
72 char* cstr = static_cast<char*>(alloc(static_cast<uint32>(str.length() + 1))); | 72 char* cstr = static_cast<char*>(alloc(static_cast<uint32>(str.length() + 1))); |
73 memcpy(cstr, str.c_str(), str.length() + 1); // Include null terminator. | 73 memcpy(cstr, str.c_str(), str.length() + 1); // Include null terminator. |
74 return cstr; | 74 return cstr; |
75 } | 75 } |
76 | 76 |
77 CPError CPB_GetCommandLineArgumentsCommon(const char* url, | 77 CPError CPB_GetCommandLineArgumentsCommon(const char* url, |
78 std::string* arguments); | 78 std::string* arguments); |
79 | 79 |
80 void* STDCALL CPB_Alloc(uint32 size); | 80 void* STDCALL CPB_Alloc(uint32 size); |
81 void STDCALL CPB_Free(void* memory); | 81 void STDCALL CPB_Free(void* memory); |
82 | 82 |
83 #endif // CHROME_COMMON_CHROME_PLUGIN_UTIL_H__ | 83 #endif // CHROME_COMMON_CHROME_PLUGIN_UTIL_H__ |
84 | 84 |
OLD | NEW |