mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Make CEF compliant with Google/Chromium style (issue #473).
- Add a new check_style tool based on Google's cpplint that can be used to verify compliance of pending changes and specific files/directories. - Update existing CEF source code to be compliant with the style requirements. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@463 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -2,12 +2,12 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "string_util.h"
|
||||
#include "include/cef_request.h"
|
||||
#include "cefclient/string_util.h"
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "include/cef_request.h"
|
||||
|
||||
void DumpRequestContents(CefRefPtr<CefRequest> request, std::string& str)
|
||||
{
|
||||
void DumpRequestContents(CefRefPtr<CefRequest> request, std::string& str) {
|
||||
std::stringstream ss;
|
||||
|
||||
ss << "URL: " << std::string(request->GetURL());
|
||||
@ -15,31 +15,31 @@ void DumpRequestContents(CefRefPtr<CefRequest> request, std::string& str)
|
||||
|
||||
CefRequest::HeaderMap headerMap;
|
||||
request->GetHeaderMap(headerMap);
|
||||
if(headerMap.size() > 0) {
|
||||
if (headerMap.size() > 0) {
|
||||
ss << "\nHeaders:";
|
||||
CefRequest::HeaderMap::const_iterator it = headerMap.begin();
|
||||
for(; it != headerMap.end(); ++it) {
|
||||
for (; it != headerMap.end(); ++it) {
|
||||
ss << "\n\t" << std::string((*it).first) << ": " <<
|
||||
std::string((*it).second);
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefPostData> postData = request->GetPostData();
|
||||
if(postData.get()) {
|
||||
if (postData.get()) {
|
||||
CefPostData::ElementVector elements;
|
||||
postData->GetElements(elements);
|
||||
if(elements.size() > 0) {
|
||||
if (elements.size() > 0) {
|
||||
ss << "\nPost Data:";
|
||||
CefRefPtr<CefPostDataElement> element;
|
||||
CefPostData::ElementVector::const_iterator it = elements.begin();
|
||||
for(; it != elements.end(); ++it) {
|
||||
for (; it != elements.end(); ++it) {
|
||||
element = (*it);
|
||||
if(element->GetType() == PDE_TYPE_BYTES) {
|
||||
if (element->GetType() == PDE_TYPE_BYTES) {
|
||||
// the element is composed of bytes
|
||||
ss << "\n\tBytes: ";
|
||||
if(element->GetBytesCount() == 0)
|
||||
if (element->GetBytesCount() == 0) {
|
||||
ss << "(empty)";
|
||||
else {
|
||||
} else {
|
||||
// retrieve the data.
|
||||
size_t size = element->GetBytesCount();
|
||||
char* bytes = new char[size];
|
||||
@ -47,7 +47,7 @@ void DumpRequestContents(CefRefPtr<CefRequest> request, std::string& str)
|
||||
ss << std::string(bytes, size);
|
||||
delete [] bytes;
|
||||
}
|
||||
} else if(element->GetType() == PDE_TYPE_FILE) {
|
||||
} else if (element->GetType() == PDE_TYPE_FILE) {
|
||||
ss << "\n\tFile: " << std::string(element->GetFile());
|
||||
}
|
||||
}
|
||||
@ -58,18 +58,17 @@ void DumpRequestContents(CefRefPtr<CefRequest> request, std::string& str)
|
||||
}
|
||||
|
||||
std::string StringReplace(const std::string& str, const std::string& from,
|
||||
const std::string& to)
|
||||
{
|
||||
const std::string& to) {
|
||||
std::string result = str;
|
||||
std::string::size_type pos = 0;
|
||||
std::string::size_type from_len = from.length();
|
||||
std::string::size_type to_len = to.length();
|
||||
do {
|
||||
pos = result.find(from, pos);
|
||||
if(pos != std::string::npos) {
|
||||
if (pos != std::string::npos) {
|
||||
result.replace(pos, from_len, to);
|
||||
pos += to_len;
|
||||
}
|
||||
} while(pos != std::string::npos);
|
||||
} while (pos != std::string::npos);
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user