mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-13 10:42:58 +01:00
Fix various Mac compile errors.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@115 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
4474199dba
commit
383168173a
@ -41,14 +41,16 @@ using WebKit::WebURL;
|
|||||||
using WebKit::WebURLRequest;
|
using WebKit::WebURLRequest;
|
||||||
using WebKit::WebView;
|
using WebKit::WebView;
|
||||||
using webkit_glue::StdStringToWebString;
|
using webkit_glue::StdStringToWebString;
|
||||||
|
using webkit_glue::StdWStringToWebString;
|
||||||
using webkit_glue::WebStringToStdString;
|
using webkit_glue::WebStringToStdString;
|
||||||
|
using webkit_glue::WebStringToStdWString;
|
||||||
|
|
||||||
|
|
||||||
CefBrowserImpl::CefBrowserImpl(CefWindowInfo& windowInfo, bool popup,
|
CefBrowserImpl::CefBrowserImpl(CefWindowInfo& windowInfo, bool popup,
|
||||||
CefRefPtr<CefHandler> handler)
|
CefRefPtr<CefHandler> handler)
|
||||||
: window_info_(windowInfo), is_popup_(popup), is_modal_(false),
|
: window_info_(windowInfo), is_popup_(popup), is_modal_(false),
|
||||||
handler_(handler), webviewhost_(NULL), popuphost_(NULL), unique_id_(0),
|
handler_(handler), webviewhost_(NULL), popuphost_(NULL),
|
||||||
frame_main_(NULL)
|
frame_main_(NULL), unique_id_(0)
|
||||||
{
|
{
|
||||||
delegate_.reset(new BrowserWebViewDelegate(this));
|
delegate_.reset(new BrowserWebViewDelegate(this));
|
||||||
popup_delegate_.reset(new BrowserWebViewDelegate(this));
|
popup_delegate_.reset(new BrowserWebViewDelegate(this));
|
||||||
@ -190,7 +192,7 @@ CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(const std::wstring& name)
|
|||||||
if (!view)
|
if (!view)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
WebFrame* frame = view->findFrameByName(name);
|
WebFrame* frame = view->findFrameByName(StdWStringToWebString(name));
|
||||||
if(frame)
|
if(frame)
|
||||||
return GetCefFrame(frame);
|
return GetCefFrame(frame);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -285,7 +287,7 @@ WebFrame* CefBrowserImpl::GetWebFrame(CefRefPtr<CefFrame> frame)
|
|||||||
std::wstring name = frame->GetName();
|
std::wstring name = frame->GetName();
|
||||||
if(name.empty())
|
if(name.empty())
|
||||||
return view ->mainFrame();
|
return view ->mainFrame();
|
||||||
return view ->findFrameByName(name);
|
return view ->findFrameByName(StdWStringToWebString(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::Undo(CefRefPtr<CefFrame> frame)
|
void CefBrowserImpl::Undo(CefRefPtr<CefFrame> frame)
|
||||||
@ -578,11 +580,12 @@ void CefBrowserImpl::UIT_LoadURLForRequest(CefFrame* frame,
|
|||||||
if (url.empty())
|
if (url.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GURL gurl(url);
|
GURL gurl(StdWStringToWebString(url));
|
||||||
|
|
||||||
if (!gurl.is_valid() && !gurl.has_scheme()) {
|
if (!gurl.is_valid() && !gurl.has_scheme()) {
|
||||||
// Try to add "http://" at the beginning
|
// Try to add "http://" at the beginning
|
||||||
gurl = GURL(std::wstring(L"http://") + url);
|
std::wstring new_url = std::wstring(L"http://") + url;
|
||||||
|
gurl = GURL(StdWStringToWebString(new_url));
|
||||||
if (!gurl.is_valid())
|
if (!gurl.is_valid())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -600,11 +603,12 @@ void CefBrowserImpl::UIT_LoadHTML(CefFrame* frame,
|
|||||||
{
|
{
|
||||||
REQUIRE_UIT();
|
REQUIRE_UIT();
|
||||||
|
|
||||||
GURL gurl(url);
|
GURL gurl(StdWStringToWebString(url));
|
||||||
|
|
||||||
if (!gurl.is_valid() && !gurl.has_scheme()) {
|
if (!gurl.is_valid() && !gurl.has_scheme()) {
|
||||||
// Try to add "http://" at the beginning
|
// Try to add "http://" at the beginning
|
||||||
gurl = GURL(std::wstring(L"http://") + url);
|
std::wstring new_url = std::wstring(L"http://") + url;
|
||||||
|
gurl = GURL(StdWStringToWebString(new_url));
|
||||||
if (!gurl.is_valid())
|
if (!gurl.is_valid())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -622,11 +626,12 @@ void CefBrowserImpl::UIT_LoadHTMLForStreamRef(CefFrame* frame,
|
|||||||
{
|
{
|
||||||
REQUIRE_UIT();
|
REQUIRE_UIT();
|
||||||
|
|
||||||
GURL gurl(url);
|
GURL gurl(StdWStringToWebString(url));
|
||||||
|
|
||||||
if (!gurl.is_valid() && !gurl.has_scheme()) {
|
if (!gurl.is_valid() && !gurl.has_scheme()) {
|
||||||
// Try to add "http://" at the beginning
|
// Try to add "http://" at the beginning
|
||||||
gurl = GURL(std::wstring(L"http://") + url);
|
std::wstring new_url = std::wstring(L"http://") + url;
|
||||||
|
gurl = GURL(StdWStringToWebString(new_url));
|
||||||
if (!gurl.is_valid())
|
if (!gurl.is_valid())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -662,7 +667,8 @@ void CefBrowserImpl::UIT_ExecuteJavaScript(CefFrame* frame,
|
|||||||
WebFrame* web_frame = GetWebFrame(frame);
|
WebFrame* web_frame = GetWebFrame(frame);
|
||||||
if(web_frame) {
|
if(web_frame) {
|
||||||
web_frame->executeScript(
|
web_frame->executeScript(
|
||||||
WebScriptSource(WebString(js_code), WebURL(GURL(script_url)),
|
WebScriptSource(StdWStringToWebString(js_code),
|
||||||
|
WebURL(GURL(StdWStringToWebString(script_url))),
|
||||||
start_line));
|
start_line));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,10 +699,13 @@ bool CefBrowserImpl::UIT_Navigate(const BrowserNavigationEntry& entry,
|
|||||||
|
|
||||||
// Get the right target frame for the entry.
|
// Get the right target frame for the entry.
|
||||||
WebFrame* frame;
|
WebFrame* frame;
|
||||||
if (!entry.GetTargetFrame().empty())
|
if (!entry.GetTargetFrame().empty()) {
|
||||||
frame = view->findFrameByName(entry.GetTargetFrame());
|
frame = view->findFrameByName(
|
||||||
else
|
StdWStringToWebString(entry.GetTargetFrame()));
|
||||||
|
} else {
|
||||||
frame = view->mainFrame();
|
frame = view->mainFrame();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(mpcomplete): should we clear the target frame, or should
|
// TODO(mpcomplete): should we clear the target frame, or should
|
||||||
// back/forward navigations maintain the target frame?
|
// back/forward navigations maintain the target frame?
|
||||||
|
|
||||||
@ -720,10 +729,8 @@ bool CefBrowserImpl::UIT_Navigate(const BrowserNavigationEntry& entry,
|
|||||||
DCHECK(entry.GetPageID() == -1);
|
DCHECK(entry.GetPageID() == -1);
|
||||||
WebURLRequest request(entry.GetURL());
|
WebURLRequest request(entry.GetURL());
|
||||||
|
|
||||||
if(entry.GetMethod().size() > 0) {
|
if(entry.GetMethod().size() > 0)
|
||||||
request.setHTTPMethod(
|
request.setHTTPMethod(StdWStringToWebString(entry.GetMethod()));
|
||||||
StdStringToWebString(WideToUTF8(entry.GetMethod())));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(entry.GetHeaders().size() > 0)
|
if(entry.GetHeaders().size() > 0)
|
||||||
CefRequestImpl::SetHeaderMap(entry.GetHeaders(), request);
|
CefRequestImpl::SetHeaderMap(entry.GetHeaders(), request);
|
||||||
@ -955,8 +962,8 @@ void CefBrowserImpl::UIT_Find(int identifier, const std::wstring& search_text,
|
|||||||
// Just navigate back/forward.
|
// Just navigate back/forward.
|
||||||
delegate->SelectFindResult(options.forward);
|
delegate->SelectFindResult(options.forward);
|
||||||
} else {
|
} else {
|
||||||
if (delegate->StartFind(search_text.c_str(), options.matchCase,
|
if (delegate->StartFind(StdWStringToWebString(search_text),
|
||||||
identifier)) {
|
options.matchCase, identifier)) {
|
||||||
} else {
|
} else {
|
||||||
// No find results.
|
// No find results.
|
||||||
UIT_NotifyFindStatus(identifier, 0, gfx::Rect(), 0, true);
|
UIT_NotifyFindStatus(identifier, 0, gfx::Rect(), 0, true);
|
||||||
@ -983,8 +990,8 @@ void CefBrowserImpl::UIT_Find(int identifier, const std::wstring& search_text,
|
|||||||
WebRange current_selection = focused_frame->selectionRange();
|
WebRange current_selection = focused_frame->selectionRange();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
result = search_frame->find(
|
result = search_frame->find(identifier, StdWStringToWebString(search_text),
|
||||||
identifier, search_text, options, wrap_within_frame, &selection_rect);
|
options, wrap_within_frame, &selection_rect);
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
// don't leave text selected as you move to the next frame.
|
// don't leave text selected as you move to the next frame.
|
||||||
@ -1010,7 +1017,8 @@ void CefBrowserImpl::UIT_Find(int identifier, const std::wstring& search_text,
|
|||||||
// match for the search word(s).
|
// match for the search word(s).
|
||||||
if (multi_frame && search_frame == focused_frame) {
|
if (multi_frame && search_frame == focused_frame) {
|
||||||
result = search_frame->find(
|
result = search_frame->find(
|
||||||
identifier, search_text, options, true, // Force wrapping.
|
identifier, StdWStringToWebString(search_text),
|
||||||
|
options, true, // Force wrapping.
|
||||||
&selection_rect);
|
&selection_rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1051,7 +1059,7 @@ void CefBrowserImpl::UIT_Find(int identifier, const std::wstring& search_text,
|
|||||||
// Start new scoping request. If the scoping function determines that it
|
// Start new scoping request. If the scoping function determines that it
|
||||||
// needs to scope, it will defer until later.
|
// needs to scope, it will defer until later.
|
||||||
search_frame->scopeStringMatches(identifier,
|
search_frame->scopeStringMatches(identifier,
|
||||||
search_text,
|
StdWStringToWebString(search_text),
|
||||||
options,
|
options,
|
||||||
true); // reset the tickmarks
|
true); // reset the tickmarks
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,9 @@ BrowserNavigationEntry::BrowserNavigationEntry(int page_id,
|
|||||||
: page_id_(page_id),
|
: page_id_(page_id),
|
||||||
url_(url),
|
url_(url),
|
||||||
title_(title),
|
title_(title),
|
||||||
target_frame_(target_frame),
|
|
||||||
method_(method),
|
method_(method),
|
||||||
headers_(headers) {
|
headers_(headers),
|
||||||
|
target_frame_(target_frame) {
|
||||||
if(!upload.isNull())
|
if(!upload.isNull())
|
||||||
upload_ = upload;
|
upload_ = upload;
|
||||||
}
|
}
|
||||||
|
@ -107,9 +107,9 @@ class RequestProxy : public URLRequest::Delegate,
|
|||||||
public:
|
public:
|
||||||
// Takes ownership of the params.
|
// Takes ownership of the params.
|
||||||
RequestProxy(CefRefPtr<CefBrowser> browser)
|
RequestProxy(CefRefPtr<CefBrowser> browser)
|
||||||
: browser_(browser),
|
: download_to_file_(false),
|
||||||
download_to_file_(false),
|
|
||||||
buf_(new net::IOBuffer(kDataSize)),
|
buf_(new net::IOBuffer(kDataSize)),
|
||||||
|
browser_(browser),
|
||||||
last_upload_position_(0)
|
last_upload_position_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -814,9 +814,9 @@ namespace webkit_glue {
|
|||||||
// Factory function.
|
// Factory function.
|
||||||
ResourceLoaderBridge* ResourceLoaderBridge::Create(
|
ResourceLoaderBridge* ResourceLoaderBridge::Create(
|
||||||
const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
|
const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
|
||||||
CefRefPtr<CefBrowser> browser =
|
CefRefPtr<CefBrowserImpl> browser =
|
||||||
_Context->GetBrowserByID(request_info.routing_id);
|
_Context->GetBrowserByID(request_info.routing_id);
|
||||||
return new ResourceLoaderBridgeImpl(browser, request_info);
|
return new ResourceLoaderBridgeImpl(browser.get(), request_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue the proxy resolve request on the io thread, and wait
|
// Issue the proxy resolve request on the io thread, and wait
|
||||||
|
@ -113,6 +113,14 @@ std::string WebStringToStdString(const WebKit::WebString& str) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebKit::WebString StdWStringToWebString(const std::wstring& str) {
|
||||||
|
return StdStringToWebString(WideToUTF8(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring WebStringToStdWString(const WebKit::WebString& str) {
|
||||||
|
return UTF8ToWide(WebStringToStdString(str));
|
||||||
|
}
|
||||||
|
|
||||||
std::string GetProductVersion() {
|
std::string GetProductVersion() {
|
||||||
return std::string("Chrome/7.0.517.0");
|
return std::string("Chrome/7.0.517.0");
|
||||||
}
|
}
|
||||||
|
@ -43,4 +43,8 @@ WebKit::WebString StdStringToWebString(const std::string& str);
|
|||||||
|
|
||||||
std::string WebStringToStdString(const WebKit::WebString& str);
|
std::string WebStringToStdString(const WebKit::WebString& str);
|
||||||
|
|
||||||
|
WebKit::WebString StdWStringToWebString(const std::wstring& str);
|
||||||
|
|
||||||
|
std::wstring WebStringToStdWString(const WebKit::WebString& str);
|
||||||
|
|
||||||
} // namespace webkit_glue
|
} // namespace webkit_glue
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/trace_event.h"
|
#include "base/trace_event.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "gfx/gdi_util.h"
|
|
||||||
#include "gfx/native_widget_types.h"
|
|
||||||
#include "gfx/point.h"
|
#include "gfx/point.h"
|
||||||
#include "media/filters/audio_renderer_impl.h"
|
#include "media/filters/audio_renderer_impl.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
@ -296,6 +294,8 @@ bool BrowserWebViewDelegate::handleCurrentKeyboardEvent() {
|
|||||||
KEYEVENT_CHAR, event.windowsKeyCode,
|
KEYEVENT_CHAR, event.windowsKeyCode,
|
||||||
event.modifiers, event.isSystemKey?true:false);
|
event.modifiers, event.isSystemKey?true:false);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||||
#include "base/nss_util.h"
|
#include "base/nss_util.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "base/utf_string_conversions.h"
|
||||||
#include "webkit/glue/plugins/plugin_list.h"
|
#include "webkit/glue/plugins/plugin_list.h"
|
||||||
#include "webkit/glue/webpreferences.h"
|
#include "webkit/glue/webpreferences.h"
|
||||||
|
|
||||||
@ -61,7 +62,11 @@ static void UIT_RegisterPlugin(struct CefPluginInfo* plugin_info)
|
|||||||
|
|
||||||
NPAPI::PluginVersionInfo info;
|
NPAPI::PluginVersionInfo info;
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
info.path = FilePath(plugin_info->unique_name);
|
info.path = FilePath(plugin_info->unique_name);
|
||||||
|
#else
|
||||||
|
info.path = FilePath(WideToUTF8(plugin_info->unique_name));
|
||||||
|
#endif
|
||||||
info.product_name = plugin_info->display_name;
|
info.product_name = plugin_info->display_name;
|
||||||
info.file_description = plugin_info->description;
|
info.file_description = plugin_info->description;
|
||||||
info.file_version =plugin_info->version;
|
info.file_version =plugin_info->version;
|
||||||
|
@ -37,7 +37,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DoMessageLoopIteration() {
|
void DoMessageLoopIteration() {
|
||||||
|
#if defined(OS_MACOSX)
|
||||||
|
Run();
|
||||||
|
#else
|
||||||
Run(NULL);
|
Run(NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "browser_socket_stream_bridge.h"
|
#include "browser_socket_stream_bridge.h"
|
||||||
#include "browser_webblobregistry_impl.h"
|
#include "browser_webblobregistry_impl.h"
|
||||||
|
|
||||||
|
#include "base/utf_string_conversions.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
@ -34,7 +35,13 @@ void CefProcessIOThread::Init() {
|
|||||||
CoInitialize(NULL);
|
CoInitialize(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
request_context_ = new BrowserRequestContext(FilePath(_Context->cache_path()),
|
#if defined(OS_WIN)
|
||||||
|
FilePath cache_path(_Context->cache_path());
|
||||||
|
#else
|
||||||
|
FilePath cache_path(WideToUTF8(_Context->cache_path()));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
request_context_ = new BrowserRequestContext(cache_path,
|
||||||
net::HttpCache::NORMAL, false);
|
net::HttpCache::NORMAL, false);
|
||||||
_Context->set_request_context(request_context_);
|
_Context->set_request_context(request_context_);
|
||||||
|
|
||||||
|
@ -3,8 +3,14 @@
|
|||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "include/cef_string.h"
|
#include "include/cef_string.h"
|
||||||
|
#include "build/build_config.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#if defined(OS_MACOSX)
|
||||||
|
#include <stdlib.h>
|
||||||
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
typedef unsigned long dword_t;
|
typedef unsigned long dword_t;
|
||||||
|
@ -156,8 +156,8 @@ void CefRequestImpl::SetHeaderMap(const HeaderMap& map,
|
|||||||
HeaderMap::const_iterator it = map.begin();
|
HeaderMap::const_iterator it = map.begin();
|
||||||
for(; it != map.end(); ++it) {
|
for(; it != map.end(); ++it) {
|
||||||
request.setHTTPHeaderField(
|
request.setHTTPHeaderField(
|
||||||
webkit_glue::StdStringToWebString(WideToUTF8(it->first.c_str())),
|
webkit_glue::StdWStringToWebString(it->first.c_str()),
|
||||||
webkit_glue::StdStringToWebString(WideToUTF8(it->second.c_str())));
|
webkit_glue::StdWStringToWebString(it->second.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,7 +465,11 @@ void CefPostDataElementImpl::Set(const net::UploadData::Element& element)
|
|||||||
std::string(element.bytes().begin(),
|
std::string(element.bytes().begin(),
|
||||||
element.bytes().end()).c_str()));
|
element.bytes().end()).c_str()));
|
||||||
} else if (element.type() == net::UploadData::TYPE_FILE) {
|
} else if (element.type() == net::UploadData::TYPE_FILE) {
|
||||||
|
#if defined(OS_WIN)
|
||||||
SetToFile(element.file_path().value());
|
SetToFile(element.file_path().value());
|
||||||
|
#else
|
||||||
|
SetToFile(UTF8ToWide(element.file_path().value()));
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
@ -480,7 +484,11 @@ void CefPostDataElementImpl::Get(net::UploadData::Element& element)
|
|||||||
if(type_ == PDE_TYPE_BYTES) {
|
if(type_ == PDE_TYPE_BYTES) {
|
||||||
element.SetToBytes(static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
|
element.SetToBytes(static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
|
||||||
} else if(type_ == PDE_TYPE_FILE) {
|
} else if(type_ == PDE_TYPE_FILE) {
|
||||||
|
#if defined(OS_WIN)
|
||||||
element.SetToFilePath(FilePath(data_.filename));
|
element.SetToFilePath(FilePath(data_.filename));
|
||||||
|
#else
|
||||||
|
element.SetToFilePath(FilePath(WideToUTF8(data_.filename)));
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
@ -514,8 +522,7 @@ void CefPostDataElementImpl::Get(WebKit::WebHTTPBody::Element& element)
|
|||||||
static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
|
static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
|
||||||
} else if(type_ == PDE_TYPE_FILE) {
|
} else if(type_ == PDE_TYPE_FILE) {
|
||||||
element.type = WebKit::WebHTTPBody::Element::TypeFile;
|
element.type = WebKit::WebHTTPBody::Element::TypeFile;
|
||||||
element.filePath.assign(
|
element.filePath.assign(webkit_glue::StdWStringToWebString(data_.filename));
|
||||||
webkit_glue::StdStringToWebString(WideToUTF8(data_.filename)));
|
|
||||||
} else {
|
} else {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,6 @@ static void TrackAdd(CefTrackObject* object)
|
|||||||
g_scheme_tracker.Pointer()->Add(object);
|
g_scheme_tracker.Pointer()->Add(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TrackDelete(CefTrackObject* object)
|
|
||||||
{
|
|
||||||
g_scheme_tracker.Pointer()->Delete(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// URLRequestJob implementation.
|
// URLRequestJob implementation.
|
||||||
@ -54,9 +50,9 @@ class CefUrlRequestJob : public URLRequestJob {
|
|||||||
public:
|
public:
|
||||||
CefUrlRequestJob(URLRequest* request, CefRefPtr<CefSchemeHandler> handler)
|
CefUrlRequestJob(URLRequest* request, CefRefPtr<CefSchemeHandler> handler)
|
||||||
: URLRequestJob(request),
|
: URLRequestJob(request),
|
||||||
url_(request->url()),
|
|
||||||
handler_(handler),
|
handler_(handler),
|
||||||
response_length_(0),
|
response_length_(0),
|
||||||
|
url_(request->url()),
|
||||||
remaining_bytes_(0) { }
|
remaining_bytes_(0) { }
|
||||||
|
|
||||||
virtual ~CefUrlRequestJob(){}
|
virtual ~CefUrlRequestJob(){}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "stream_impl.h"
|
#include "stream_impl.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/utf_string_conversions.h"
|
||||||
|
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
@ -13,7 +14,11 @@ CefRefPtr<CefStreamReader> CefStreamReader::CreateForFile(
|
|||||||
const std::wstring& fileName)
|
const std::wstring& fileName)
|
||||||
{
|
{
|
||||||
CefRefPtr<CefStreamReader> reader;
|
CefRefPtr<CefStreamReader> reader;
|
||||||
|
#if defined(OS_WIN)
|
||||||
FILE *f = _wfopen(fileName.c_str(), L"rb");
|
FILE *f = _wfopen(fileName.c_str(), L"rb");
|
||||||
|
#else
|
||||||
|
FILE *f = fopen(WideToUTF8(fileName).c_str(), "rb");
|
||||||
|
#endif
|
||||||
if(f)
|
if(f)
|
||||||
reader = new CefFileReader(f, true);
|
reader = new CefFileReader(f, true);
|
||||||
return reader;
|
return reader;
|
||||||
@ -45,7 +50,11 @@ CefRefPtr<CefStreamWriter> CefStreamWriter::CreateForFile(
|
|||||||
{
|
{
|
||||||
DCHECK(!fileName.empty());
|
DCHECK(!fileName.empty());
|
||||||
CefRefPtr<CefStreamWriter> writer;
|
CefRefPtr<CefStreamWriter> writer;
|
||||||
|
#if defined(OS_WIN)
|
||||||
FILE* file = _wfopen(fileName.c_str(), L"wb");
|
FILE* file = _wfopen(fileName.c_str(), L"wb");
|
||||||
|
#else
|
||||||
|
FILE* file = fopen(WideToUTF8(fileName).c_str(), "wb");
|
||||||
|
#endif
|
||||||
if(file)
|
if(file)
|
||||||
writer = new CefFileWriter(file, true);
|
writer = new CefFileWriter(file, true);
|
||||||
return writer;
|
return writer;
|
||||||
@ -65,7 +74,7 @@ CefRefPtr<CefStreamWriter> CefStreamWriter::CreateForHandler(
|
|||||||
// CefFileReader
|
// CefFileReader
|
||||||
|
|
||||||
CefFileReader::CefFileReader(FILE* file, bool close)
|
CefFileReader::CefFileReader(FILE* file, bool close)
|
||||||
: file_(file), close_(close)
|
: close_(close), file_(file)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +264,7 @@ void CefBytesReader::SetData(void* data, long datasize, bool copy)
|
|||||||
// CefBytesWriter
|
// CefBytesWriter
|
||||||
|
|
||||||
CefBytesWriter::CefBytesWriter(size_t grow)
|
CefBytesWriter::CefBytesWriter(size_t grow)
|
||||||
: grow_(grow), offset_(0), datasize_(grow)
|
: grow_(grow), datasize_(grow), offset_(0)
|
||||||
{
|
{
|
||||||
DCHECK(grow > 0);
|
DCHECK(grow > 0);
|
||||||
data_ = malloc(grow);
|
data_ = malloc(grow);
|
||||||
|
@ -17,6 +17,13 @@ template <class ClassName, class BaseName, class StructName>
|
|||||||
class CefCppToC : public CefThreadSafeBase<CefBase>
|
class CefCppToC : public CefThreadSafeBase<CefBase>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// Structure representation with pointer to the C++ class.
|
||||||
|
struct Struct
|
||||||
|
{
|
||||||
|
StructName struct_;
|
||||||
|
CefCppToC<ClassName,BaseName,StructName>* class_;
|
||||||
|
};
|
||||||
|
|
||||||
// Use this method to retrieve the underlying class instance from our
|
// Use this method to retrieve the underlying class instance from our
|
||||||
// own structure when the structure is passed as the required first
|
// own structure when the structure is passed as the required first
|
||||||
// parameter of a C API function call. No explicit reference counting
|
// parameter of a C API function call. No explicit reference counting
|
||||||
@ -24,8 +31,7 @@ public:
|
|||||||
static CefRefPtr<BaseName> Get(StructName* s)
|
static CefRefPtr<BaseName> Get(StructName* s)
|
||||||
{
|
{
|
||||||
// Cast our structure to the wrapper structure type.
|
// Cast our structure to the wrapper structure type.
|
||||||
ClassName::Struct* wrapperStruct =
|
Struct* wrapperStruct = reinterpret_cast<Struct*>(s);
|
||||||
reinterpret_cast<ClassName::Struct*>(s);
|
|
||||||
// Return the underlying object instance.
|
// Return the underlying object instance.
|
||||||
return wrapperStruct->class_->GetClass();
|
return wrapperStruct->class_->GetClass();
|
||||||
}
|
}
|
||||||
@ -48,8 +54,7 @@ public:
|
|||||||
static CefRefPtr<BaseName> Unwrap(StructName* s)
|
static CefRefPtr<BaseName> Unwrap(StructName* s)
|
||||||
{
|
{
|
||||||
// Cast our structure to the wrapper structure type.
|
// Cast our structure to the wrapper structure type.
|
||||||
ClassName::Struct* wrapperStruct =
|
Struct* wrapperStruct = reinterpret_cast<Struct*>(s);
|
||||||
reinterpret_cast<ClassName::Struct*>(s);
|
|
||||||
// Add the underlying object instance to a smart pointer.
|
// Add the underlying object instance to a smart pointer.
|
||||||
CefRefPtr<BaseName> objectPtr(wrapperStruct->class_->GetClass());
|
CefRefPtr<BaseName> objectPtr(wrapperStruct->class_->GetClass());
|
||||||
// Release the reference to our wrapper object that was added before the
|
// Release the reference to our wrapper object that was added before the
|
||||||
@ -59,13 +64,6 @@ public:
|
|||||||
return objectPtr;
|
return objectPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Structure representation with pointer to the C++ class.
|
|
||||||
struct Struct
|
|
||||||
{
|
|
||||||
StructName struct_;
|
|
||||||
CefCppToC<ClassName,BaseName,StructName>* class_;
|
|
||||||
};
|
|
||||||
|
|
||||||
CefCppToC(BaseName* cls)
|
CefCppToC(BaseName* cls)
|
||||||
: class_(cls)
|
: class_(cls)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user