Remove unused string_util.h and string_util.cpp

This commit is contained in:
Kevin Sawicki
2012-06-07 13:55:50 -07:00
parent 2e5afb509b
commit 6e1b8dc3f0
6 changed files with 1 additions and 99 deletions

View File

@@ -61,7 +61,7 @@ LIBS := -lX11 \
-lcef \
-lcef_dll_wrapper
SOURCES=atom.cpp cefclient.cpp string_util.cpp native_handler.cpp cefclient_switches.cpp client_handler.cpp client_handler_gtk.cpp
SOURCES=atom.cpp cefclient.cpp native_handler.cpp cefclient_switches.cpp client_handler.cpp client_handler_gtk.cpp
OBJECTS=$(SOURCES:.cpp=.o)
all:

View File

@@ -16,7 +16,6 @@
#include "include/cef_web_urlrequest.h"
#include "cefclient_switches.h"
#include "client_handler.h"
#include "string_util.h"
#include "util.h"
namespace {

View File

@@ -9,7 +9,6 @@
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "cefclient.h"
#include "string_util.h"
#include "native_handler.h"
ClientHandler::ClientHandler() :

View File

@@ -7,7 +7,6 @@
#include "client_handler.h"
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "string_util.h"
// ClientHandler::ClientLifeSpanHandler implementation
bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,

View File

@@ -1,74 +0,0 @@
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
// 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 <sstream>
#include <string>
#include "include/cef_request.h"
void DumpRequestContents(CefRefPtr<CefRequest> request, std::string& str) {
std::stringstream ss;
ss << "URL: " << std::string(request->GetURL());
ss << "\nMethod: " << std::string(request->GetMethod());
CefRequest::HeaderMap headerMap;
request->GetHeaderMap(headerMap);
if (headerMap.size() > 0) {
ss << "\nHeaders:";
CefRequest::HeaderMap::const_iterator it = headerMap.begin();
for (; it != headerMap.end(); ++it) {
ss << "\n\t" << std::string((*it).first) << ": " <<
std::string((*it).second);
}
}
CefRefPtr<CefPostData> postData = request->GetPostData();
if (postData.get()) {
CefPostData::ElementVector elements;
postData->GetElements(elements);
if (elements.size() > 0) {
ss << "\nPost Data:";
CefRefPtr<CefPostDataElement> element;
CefPostData::ElementVector::const_iterator it = elements.begin();
for (; it != elements.end(); ++it) {
element = (*it);
if (element->GetType() == PDE_TYPE_BYTES) {
// the element is composed of bytes
ss << "\n\tBytes: ";
if (element->GetBytesCount() == 0) {
ss << "(empty)";
} else {
// retrieve the data.
size_t size = element->GetBytesCount();
char* bytes = new char[size];
element->GetBytes(size, bytes);
ss << std::string(bytes, size);
delete [] bytes;
}
} else if (element->GetType() == PDE_TYPE_FILE) {
ss << "\n\tFile: " << std::string(element->GetFile());
}
}
}
}
str = ss.str();
}
std::string StringReplace(const std::string& str, const std::string& from,
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) {
result.replace(pos, from_len, to);
pos += to_len;
}
} while (pos != std::string::npos);
return result;
}

View File

@@ -1,21 +0,0 @@
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_STRING_UTIL_H_
#define CEF_TESTS_CEFCLIENT_STRING_UTIL_H_
#pragma once
#include <string>
#include "include/cef_base.h"
class CefRequest;
// Dump the contents of the request into a string.
void DumpRequestContents(CefRefPtr<CefRequest> request, std::string& str);
// Replace all instances of |from| with |to| in |str|.
std::string StringReplace(const std::string& str, const std::string& from,
const std::string& to);
#endif // CEF_TESTS_CEFCLIENT_STRING_UTIL_H_