Update to Chromium revision 170167.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@933 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
f53c281acd
commit
ea920a4d9e
|
@ -17,5 +17,5 @@
|
|||
|
||||
{
|
||||
'chromium_url': 'http://src.chromium.org/svn/trunk/src',
|
||||
'chromium_revision': '167921',
|
||||
'chromium_revision': '170167',
|
||||
}
|
||||
|
|
|
@ -183,10 +183,10 @@ CefBrowserContext::CefBrowserContext()
|
|||
}
|
||||
|
||||
CefBrowserContext::~CefBrowserContext() {
|
||||
// Clear the download manager delegate here because otherwise we'll crash
|
||||
// Delete the download manager delegate here because otherwise we'll crash
|
||||
// when it's accessed from the content::BrowserContext destructor.
|
||||
if (download_manager_delegate_.get())
|
||||
BrowserContext::GetDownloadManager(this)->SetDelegate(NULL);
|
||||
download_manager_delegate_.reset(NULL);
|
||||
|
||||
if (resource_context_.get()) {
|
||||
BrowserThread::DeleteSoon(
|
||||
|
@ -206,7 +206,8 @@ content::DownloadManagerDelegate*
|
|||
CefBrowserContext::GetDownloadManagerDelegate() {
|
||||
DCHECK(!download_manager_delegate_.get());
|
||||
|
||||
download_manager_delegate_ = new CefDownloadManagerDelegate();
|
||||
content::DownloadManager* manager = BrowserContext::GetDownloadManager(this);
|
||||
download_manager_delegate_.reset(new CefDownloadManagerDelegate(manager));
|
||||
return download_manager_delegate_.get();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class CefBrowserContext : public content::BrowserContext {
|
|||
private:
|
||||
|
||||
scoped_ptr<CefResourceContext> resource_context_;
|
||||
scoped_refptr<CefDownloadManagerDelegate> download_manager_delegate_;
|
||||
scoped_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
|
||||
scoped_refptr<net::URLRequestContextGetter> url_request_getter_;
|
||||
scoped_refptr<content::GeolocationPermissionContext>
|
||||
geolocation_permission_context_;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "base/string_util.h"
|
||||
#include "content/public/common/url_fetcher.h"
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/http/http_request_headers.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/url_request/url_fetcher.h"
|
||||
#include "net/url_request/url_fetcher_delegate.h"
|
||||
|
|
|
@ -233,6 +233,10 @@ class CefMediaObserver : public content::MediaObserver {
|
|||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevices& devices) OVERRIDE {}
|
||||
virtual void OnAudioCaptureDevicesChanged(
|
||||
const content::MediaStreamDevices& devices) OVERRIDE {}
|
||||
virtual void OnVideoCaptureDevicesChanged(
|
||||
const content::MediaStreamDevices& devices) OVERRIDE {}
|
||||
virtual void OnMediaRequestStateChanged(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
#include "base/atomic_sequence_num.h"
|
||||
#include "base/file_path.h"
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/scoped_temp_dir.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
|
||||
namespace base {
|
||||
|
@ -93,7 +93,7 @@ class CefContext : public CefBase {
|
|||
|
||||
CefSettings settings_;
|
||||
FilePath cache_path_;
|
||||
ScopedTempDir cache_temp_dir_;
|
||||
base::ScopedTempDir cache_temp_dir_;
|
||||
|
||||
// Map of browsers that currently exist.
|
||||
BrowserList browserlist_;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "base/string_util.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/file_chooser_params.h"
|
||||
#include "net/base/net_util.h"
|
||||
|
@ -48,20 +47,17 @@ CefRefPtr<CefDownloadHandler> GetDownloadHandler(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// Helper function to retrieve the DownloadManager.
|
||||
scoped_refptr<content::DownloadManager> GetDownloadManager() {
|
||||
return content::BrowserContext::GetDownloadManager(
|
||||
_Context->browser_context());
|
||||
}
|
||||
|
||||
|
||||
// CefBeforeDownloadCallback implementation.
|
||||
class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
public:
|
||||
CefBeforeDownloadCallbackImpl(int32 download_id,
|
||||
CefBeforeDownloadCallbackImpl(
|
||||
const base::WeakPtr<DownloadManager>& manager,
|
||||
int32 download_id,
|
||||
const FilePath& suggested_name,
|
||||
const content::DownloadTargetCallback& callback)
|
||||
: download_id_(download_id),
|
||||
: manager_(manager),
|
||||
download_id_(download_id),
|
||||
suggested_name_(suggested_name),
|
||||
callback_(callback) {
|
||||
}
|
||||
|
@ -72,13 +68,12 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
|||
if (download_id_ <= 0)
|
||||
return;
|
||||
|
||||
scoped_refptr<content::DownloadManager> manager = GetDownloadManager();
|
||||
if (manager) {
|
||||
if (manager_) {
|
||||
FilePath path = FilePath(download_path);
|
||||
CEF_POST_TASK(CEF_FILET,
|
||||
base::Bind(&CefBeforeDownloadCallbackImpl::GenerateFilename,
|
||||
download_id_, suggested_name_, path, show_dialog,
|
||||
callback_));
|
||||
manager_, download_id_, suggested_name_, path,
|
||||
show_dialog, callback_));
|
||||
}
|
||||
|
||||
download_id_ = 0;
|
||||
|
@ -92,6 +87,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
|||
|
||||
private:
|
||||
static void GenerateFilename(
|
||||
base::WeakPtr<DownloadManager> manager,
|
||||
int32 download_id,
|
||||
const FilePath& suggested_name,
|
||||
const FilePath& download_path,
|
||||
|
@ -120,15 +116,16 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
|||
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBeforeDownloadCallbackImpl::ChooseDownloadPath,
|
||||
download_id, suggested_path, show_dialog, callback));
|
||||
manager, download_id, suggested_path, show_dialog,
|
||||
callback));
|
||||
}
|
||||
|
||||
static void ChooseDownloadPath(
|
||||
base::WeakPtr<DownloadManager> manager,
|
||||
int32 download_id,
|
||||
const FilePath& suggested_path,
|
||||
bool show_dialog,
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
scoped_refptr<content::DownloadManager> manager = GetDownloadManager();
|
||||
if (!manager)
|
||||
return;
|
||||
|
||||
|
@ -186,6 +183,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
|||
path);
|
||||
}
|
||||
|
||||
base::WeakPtr<DownloadManager> manager_;
|
||||
int32 download_id_;
|
||||
FilePath suggested_name_;
|
||||
content::DownloadTargetCallback callback_;
|
||||
|
@ -198,8 +196,11 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
|||
// CefDownloadItemCallback implementation.
|
||||
class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
|
||||
public:
|
||||
explicit CefDownloadItemCallbackImpl(int32 download_id)
|
||||
: download_id_(download_id) {
|
||||
explicit CefDownloadItemCallbackImpl(
|
||||
const base::WeakPtr<DownloadManager>& manager,
|
||||
int32 download_id)
|
||||
: manager_(manager),
|
||||
download_id_(download_id) {
|
||||
}
|
||||
|
||||
virtual void Cancel() OVERRIDE {
|
||||
|
@ -212,9 +213,8 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
|
|||
if (download_id_ <= 0)
|
||||
return;
|
||||
|
||||
scoped_refptr<content::DownloadManager> manager = GetDownloadManager();
|
||||
if (manager) {
|
||||
DownloadItem* item = manager->GetDownload(download_id_);
|
||||
if (manager_) {
|
||||
DownloadItem* item = manager_->GetDownload(download_id_);
|
||||
if (item && item->IsInProgress())
|
||||
item->Cancel(true);
|
||||
}
|
||||
|
@ -222,6 +222,7 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
|
|||
download_id_ = 0;
|
||||
}
|
||||
|
||||
base::WeakPtr<DownloadManager> manager_;
|
||||
int32 download_id_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefDownloadItemCallbackImpl);
|
||||
|
@ -231,20 +232,78 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
|
|||
} // namespace
|
||||
|
||||
|
||||
CefDownloadManagerDelegate::CefDownloadManagerDelegate() {
|
||||
// Balanced in Shutdown();
|
||||
AddRef();
|
||||
CefDownloadManagerDelegate::CefDownloadManagerDelegate(
|
||||
DownloadManager* manager)
|
||||
: manager_(manager),
|
||||
manager_ptr_factory_(manager) {
|
||||
DCHECK(manager);
|
||||
manager->AddObserver(this);
|
||||
|
||||
DownloadManager::DownloadVector items;
|
||||
manager->GetAllDownloads(&items);
|
||||
DownloadManager::DownloadVector::const_iterator it = items.begin();
|
||||
for (; it != items.end(); ++it) {
|
||||
(*it)->AddObserver(this);
|
||||
observing_.insert(*it);
|
||||
}
|
||||
}
|
||||
|
||||
CefDownloadManagerDelegate::~CefDownloadManagerDelegate() {
|
||||
if (manager_) {
|
||||
manager_->SetDelegate(NULL);
|
||||
manager_->RemoveObserver(this);
|
||||
}
|
||||
|
||||
std::set<DownloadItem*>::const_iterator it = observing_.begin();
|
||||
for (; it != observing_.end(); ++it)
|
||||
(*it)->RemoveObserver(this);
|
||||
observing_.clear();
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::Shutdown() {
|
||||
Release();
|
||||
void CefDownloadManagerDelegate::OnDownloadUpdated(
|
||||
DownloadItem* download) {
|
||||
CefRefPtr<CefBrowserHostImpl> browser = GetBrowser(download);
|
||||
CefRefPtr<CefDownloadHandler> handler;
|
||||
if (browser.get())
|
||||
handler = GetDownloadHandler(browser);
|
||||
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefDownloadItemImpl> download_item(
|
||||
new CefDownloadItemImpl(download));
|
||||
CefRefPtr<CefDownloadItemCallback> callback(
|
||||
new CefDownloadItemCallbackImpl(manager_ptr_factory_.GetWeakPtr(),
|
||||
download->GetId()));
|
||||
|
||||
handler->OnDownloadUpdated(browser.get(), download_item.get(), callback);
|
||||
|
||||
download_item->Detach(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::OnDownloadDestroyed(
|
||||
DownloadItem* download) {
|
||||
download->RemoveObserver(this);
|
||||
observing_.erase(download);
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::OnDownloadCreated(
|
||||
DownloadManager* manager,
|
||||
DownloadItem* item) {
|
||||
item->AddObserver(this);
|
||||
observing_.insert(item);
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::ManagerGoingDown(
|
||||
DownloadManager* manager) {
|
||||
DCHECK_EQ(manager, manager_);
|
||||
manager->SetDelegate(NULL);
|
||||
manager->RemoveObserver(this);
|
||||
manager_ptr_factory_.InvalidateWeakPtrs();
|
||||
manager_ = NULL;
|
||||
}
|
||||
|
||||
bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
||||
content::DownloadItem* item,
|
||||
DownloadItem* item,
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
if (!item->GetForcedFilePath().empty()) {
|
||||
callback.Run(item->GetForcedFilePath(),
|
||||
|
@ -270,7 +329,8 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
|||
|
||||
CefRefPtr<CefDownloadItemImpl> download_item(new CefDownloadItemImpl(item));
|
||||
CefRefPtr<CefBeforeDownloadCallback> callbackObj(
|
||||
new CefBeforeDownloadCallbackImpl(item->GetId(), suggested_name,
|
||||
new CefBeforeDownloadCallbackImpl(manager_ptr_factory_.GetWeakPtr(),
|
||||
item->GetId(), suggested_name,
|
||||
callback));
|
||||
|
||||
handler->OnBeforeDownload(browser.get(), download_item.get(),
|
||||
|
@ -281,28 +341,3 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::AddItemToPersistentStore(
|
||||
DownloadItem* item) {
|
||||
static int next_id;
|
||||
scoped_refptr<content::DownloadManager> manager = GetDownloadManager();
|
||||
manager->OnItemAddedToPersistentStore(item->GetId(), ++next_id);
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::UpdateItemInPersistentStore(
|
||||
DownloadItem* item) {
|
||||
CefRefPtr<CefBrowserHostImpl> browser = GetBrowser(item);
|
||||
CefRefPtr<CefDownloadHandler> handler;
|
||||
if (browser.get())
|
||||
handler = GetDownloadHandler(browser);
|
||||
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefDownloadItemImpl> download_item(new CefDownloadItemImpl(item));
|
||||
CefRefPtr<CefDownloadItemCallback> callback(
|
||||
new CefDownloadItemCallbackImpl(item->GetId()));
|
||||
|
||||
handler->OnDownloadUpdated(browser.get(), download_item.get(), callback);
|
||||
|
||||
download_item->Detach(NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,35 +6,40 @@
|
|||
#define CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "content/public/browser/download_item.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/download_manager_delegate.h"
|
||||
|
||||
struct DownloadStateInfo;
|
||||
|
||||
namespace content {
|
||||
class DownloadManager;
|
||||
}
|
||||
|
||||
class CefDownloadManagerDelegate
|
||||
: public content::DownloadManagerDelegate,
|
||||
public base::RefCountedThreadSafe<CefDownloadManagerDelegate> {
|
||||
: public content::DownloadItem::Observer,
|
||||
public content::DownloadManager::Observer,
|
||||
public content::DownloadManagerDelegate {
|
||||
public:
|
||||
CefDownloadManagerDelegate();
|
||||
explicit CefDownloadManagerDelegate(content::DownloadManager* manager);
|
||||
~CefDownloadManagerDelegate();
|
||||
|
||||
private:
|
||||
// DownloadItem::Observer methods.
|
||||
virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE;
|
||||
virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE;
|
||||
|
||||
// DownloadManager::Observer methods.
|
||||
virtual void OnDownloadCreated(content::DownloadManager* manager,
|
||||
content::DownloadItem* item) OVERRIDE;
|
||||
virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE;
|
||||
|
||||
// DownloadManagerDelegate methods.
|
||||
virtual void Shutdown() OVERRIDE;
|
||||
virtual bool DetermineDownloadTarget(
|
||||
content::DownloadItem* item,
|
||||
const content::DownloadTargetCallback& callback) OVERRIDE;
|
||||
virtual void AddItemToPersistentStore(content::DownloadItem* item) OVERRIDE;
|
||||
virtual void UpdateItemInPersistentStore(
|
||||
content::DownloadItem* item) OVERRIDE;
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<CefDownloadManagerDelegate>;
|
||||
|
||||
virtual ~CefDownloadManagerDelegate();
|
||||
content::DownloadManager* manager_;
|
||||
base::WeakPtrFactory<content::DownloadManager> manager_ptr_factory_;
|
||||
std::set<content::DownloadItem*> observing_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate);
|
||||
};
|
||||
|
|
|
@ -151,6 +151,10 @@ class CefSimpleMenuModel : public ui::MenuModel {
|
|||
menu_model_delegate_ = menu_model_delegate;
|
||||
}
|
||||
|
||||
virtual ui::MenuModelDelegate* GetMenuModelDelegate() const OVERRIDE {
|
||||
return menu_model_delegate_;
|
||||
}
|
||||
|
||||
private:
|
||||
CefMenuModelImpl* impl_;
|
||||
ui::MenuModelDelegate* menu_model_delegate_;
|
||||
|
|
|
@ -73,9 +73,11 @@ net::URLRequestJob* CefRequestInterceptor::MaybeInterceptRedirect(
|
|||
newUrlStr);
|
||||
if (newUrlStr != location.spec()) {
|
||||
GURL new_url = GURL(std::string(newUrlStr));
|
||||
if (!new_url.is_empty() && new_url.is_valid())
|
||||
return new net::URLRequestRedirectJob(request, network_delegate,
|
||||
new_url);
|
||||
if (!new_url.is_empty() && new_url.is_valid()) {
|
||||
return new net::URLRequestRedirectJob(
|
||||
request, network_delegate, new_url,
|
||||
net::URLRequestRedirectJob::REDIRECT_302_FOUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,10 @@ content::RenderWidgetHostView* CefWebContentsViewOSR::CreateViewForWidget(
|
|||
return view_;
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::SetView(content::RenderWidgetHostView* view) {
|
||||
view_ = view;
|
||||
}
|
||||
|
||||
gfx::NativeView CefWebContentsViewOSR::GetNativeView() const {
|
||||
return gfx::NativeView();
|
||||
}
|
||||
|
|
|
@ -12,12 +12,11 @@
|
|||
#include "content/public/browser/web_contents_view.h"
|
||||
|
||||
namespace content {
|
||||
class WebContents;
|
||||
class WebContentsViewDelegate;
|
||||
class WebContents;
|
||||
class WebContentsViewDelegate;
|
||||
}
|
||||
|
||||
class CefBrowserHostImpl;
|
||||
class CefRenderWidgetHostViewOSR;
|
||||
|
||||
// An implementation of WebContentsView for off-screen rendering.
|
||||
class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
|
@ -31,6 +30,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
|||
virtual void CreateView(const gfx::Size& initial_size) OVERRIDE;
|
||||
virtual content::RenderWidgetHostView* CreateViewForWidget(
|
||||
content::RenderWidgetHost* render_widget_host) OVERRIDE;
|
||||
virtual void SetView(content::RenderWidgetHostView* view) OVERRIDE;
|
||||
virtual gfx::NativeView GetNativeView() const OVERRIDE;
|
||||
virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
|
||||
virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
|
||||
|
@ -65,7 +65,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
|||
|
||||
private:
|
||||
content::WebContents* web_contents_;
|
||||
CefRenderWidgetHostViewOSR* view_;
|
||||
content::RenderWidgetHostView* view_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefWebContentsViewOSR);
|
||||
};
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
#include "libcef/common/request_impl.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "net/base/upload_data.h"
|
||||
#include "net/base/upload_data_stream.h"
|
||||
#include "net/base/upload_element_reader.h"
|
||||
#include "net/base/upload_bytes_element_reader.h"
|
||||
#include "net/base/upload_file_element_reader.h"
|
||||
#include "net/http/http_request_headers.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
||||
|
@ -155,7 +161,7 @@ void CefRequestImpl::Set(net::URLRequest* request) {
|
|||
GetHeaderMap(headers, headermap_);
|
||||
|
||||
// Transfer post data, if any
|
||||
const net::UploadData* data = request->get_upload();
|
||||
const net::UploadDataStream* data = request->get_upload();
|
||||
if (data) {
|
||||
postdata_ = CefPostData::Create();
|
||||
static_cast<CefPostDataImpl*>(postdata_.get())->Set(*data);
|
||||
|
@ -416,6 +422,22 @@ void CefPostDataImpl::Set(const net::UploadData& data) {
|
|||
}
|
||||
}
|
||||
|
||||
void CefPostDataImpl::Set(const net::UploadDataStream& data_stream) {
|
||||
AutoLock lock_scope(this);
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
|
||||
CefRefPtr<CefPostDataElement> postelem;
|
||||
|
||||
const ScopedVector<net::UploadElementReader>& elements =
|
||||
data_stream.element_readers();
|
||||
ScopedVector<net::UploadElementReader>::const_iterator it = elements.begin();
|
||||
for (; it != elements.end(); ++it) {
|
||||
postelem = CefPostDataElement::Create();
|
||||
static_cast<CefPostDataElementImpl*>(postelem.get())->Set(**it);
|
||||
AddElement(postelem);
|
||||
}
|
||||
}
|
||||
|
||||
void CefPostDataImpl::Get(net::UploadData& data) {
|
||||
AutoLock lock_scope(this);
|
||||
|
||||
|
@ -587,6 +609,28 @@ void CefPostDataElementImpl::Set(const net::UploadElement& element) {
|
|||
}
|
||||
}
|
||||
|
||||
void CefPostDataElementImpl::Set(
|
||||
const net::UploadElementReader& element_reader) {
|
||||
AutoLock lock_scope(this);
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
|
||||
const net::UploadBytesElementReader* bytes_reader =
|
||||
element_reader.AsBytesReader();
|
||||
if (bytes_reader) {
|
||||
SetToBytes(bytes_reader->length(), bytes_reader->bytes());
|
||||
return;
|
||||
}
|
||||
|
||||
const net::UploadFileElementReader* file_reader =
|
||||
element_reader.AsFileReader();
|
||||
if (file_reader) {
|
||||
SetToFile(file_reader->path().value());
|
||||
return;
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void CefPostDataElementImpl::Get(net::UploadElement& element) {
|
||||
AutoLock lock_scope(this);
|
||||
|
||||
|
|
|
@ -7,11 +7,14 @@
|
|||
#pragma once
|
||||
|
||||
#include "include/cef_request.h"
|
||||
#include "net/base/upload_data.h"
|
||||
#include "net/http/http_request_headers.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody.h"
|
||||
|
||||
namespace net {
|
||||
class HttpRequestHeaders;
|
||||
class UploadData;
|
||||
class UploadDataStream;
|
||||
class UploadElement;
|
||||
class UploadElementReader;
|
||||
class URLRequest;
|
||||
};
|
||||
|
||||
|
@ -95,6 +98,7 @@ class CefPostDataImpl : public CefPostData {
|
|||
virtual void RemoveElements();
|
||||
|
||||
void Set(const net::UploadData& data);
|
||||
void Set(const net::UploadDataStream& data_stream);
|
||||
void Get(net::UploadData& data);
|
||||
void Set(const WebKit::WebHTTPBody& data);
|
||||
void Get(WebKit::WebHTTPBody& data);
|
||||
|
@ -129,6 +133,7 @@ class CefPostDataElementImpl : public CefPostDataElement {
|
|||
void* GetBytes() { return data_.bytes.bytes; }
|
||||
|
||||
void Set(const net::UploadElement& element);
|
||||
void Set(const net::UploadElementReader& element_reader);
|
||||
void Get(net::UploadElement& element);
|
||||
void Set(const WebKit::WebHTTPBody::Element& element);
|
||||
void Get(WebKit::WebHTTPBody::Element& element);
|
||||
|
|
|
@ -88,8 +88,10 @@ class CefV8TrackManager {
|
|||
|
||||
v8::Handle<v8::Object> object = context->Global();
|
||||
v8::Handle<v8::Value> value = object->GetHiddenValue(context_state_key_);
|
||||
if (!value.IsEmpty())
|
||||
return static_cast<CefV8ContextState*>(v8::External::Unwrap(value));
|
||||
if (!value.IsEmpty()) {
|
||||
return static_cast<CefV8ContextState*>(
|
||||
v8::External::Cast(*value)->Value());
|
||||
}
|
||||
|
||||
scoped_refptr<CefV8ContextState> state = new CefV8ContextState();
|
||||
object->SetHiddenValue(context_state_key_,
|
||||
|
@ -123,7 +125,7 @@ class CefV8TrackManager {
|
|||
return;
|
||||
|
||||
scoped_refptr<CefV8ContextState> state =
|
||||
static_cast<CefV8ContextState*>(v8::External::Unwrap(value));
|
||||
static_cast<CefV8ContextState*>(v8::External::Cast(*value)->Value());
|
||||
state->Detach();
|
||||
object->DeleteHiddenValue(context_state_key_);
|
||||
|
||||
|
@ -220,7 +222,7 @@ class V8TrackObject : public CefTrackNode {
|
|||
// Attach this track object to the specified V8 object.
|
||||
void AttachTo(v8::Handle<v8::Object> object) {
|
||||
object->SetHiddenValue(v8::String::New(kCefTrackObject),
|
||||
v8::External::Wrap(this));
|
||||
v8::External::New(this));
|
||||
}
|
||||
|
||||
// Retrieve the track object for the specified V8 object.
|
||||
|
@ -228,7 +230,7 @@ class V8TrackObject : public CefTrackNode {
|
|||
v8::Local<v8::Value> value =
|
||||
object->GetHiddenValue(v8::String::New(kCefTrackObject));
|
||||
if (!value.IsEmpty())
|
||||
return static_cast<V8TrackObject*>(v8::External::Unwrap(value));
|
||||
return static_cast<V8TrackObject*>(v8::External::Cast(*value)->Value());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -383,7 +385,7 @@ v8::Handle<v8::Value> FunctionCallbackImpl(const v8::Arguments& args) {
|
|||
WebCore::toScriptExecutionContext(v8::Context::GetCurrent()));
|
||||
|
||||
CefV8Handler* handler =
|
||||
static_cast<CefV8Handler*>(v8::External::Unwrap(args.Data()));
|
||||
static_cast<CefV8Handler*>(v8::External::Cast(*args.Data())->Value());
|
||||
|
||||
CefV8ValueList params;
|
||||
for (int i = 0; i < args.Length(); i++)
|
||||
|
@ -494,7 +496,7 @@ class ExtensionWrapper : public v8::Extension {
|
|||
return v8::Handle<v8::FunctionTemplate>();
|
||||
|
||||
return v8::FunctionTemplate::New(FunctionCallbackImpl,
|
||||
v8::External::Wrap(handler_));
|
||||
v8::External::New(handler_));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -952,7 +954,7 @@ CefRefPtr<CefV8Value> CefV8Value::CreateFunction(
|
|||
// Create a new V8 function template.
|
||||
v8::Local<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
|
||||
|
||||
v8::Local<v8::Value> data = v8::External::Wrap(handler.get());
|
||||
v8::Local<v8::Value> data = v8::External::New(handler.get());
|
||||
|
||||
// Set the function handler callback.
|
||||
tmpl->SetCallHandler(FunctionCallbackImpl, data);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "include/cef_scheme.h"
|
||||
#include "tests/unittests/test_handler.h"
|
||||
#include "tests/unittests/test_suite.h"
|
||||
#include "base/scoped_temp_dir.h"
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
|
@ -379,7 +379,7 @@ void TestChangeDirectory(CefRefPtr<CefCookieManager> manager,
|
|||
base::WaitableEvent event(false, false);
|
||||
CefCookie cookie;
|
||||
|
||||
ScopedTempDir temp_dir;
|
||||
base::ScopedTempDir temp_dir;
|
||||
|
||||
// Create a new temporary directory.
|
||||
EXPECT_TRUE(temp_dir.CreateUniqueTempDir());
|
||||
|
@ -448,7 +448,7 @@ TEST(CookieTest, DomainCookieInMemory) {
|
|||
|
||||
// Test creation of a domain cookie.
|
||||
TEST(CookieTest, DomainCookieOnDisk) {
|
||||
ScopedTempDir temp_dir;
|
||||
base::ScopedTempDir temp_dir;
|
||||
|
||||
// Create a new temporary directory.
|
||||
EXPECT_TRUE(temp_dir.CreateUniqueTempDir());
|
||||
|
@ -479,7 +479,7 @@ TEST(CookieTest, HostCookieInMemory) {
|
|||
|
||||
// Test creation of a host cookie.
|
||||
TEST(CookieTest, HostCookieOnDisk) {
|
||||
ScopedTempDir temp_dir;
|
||||
base::ScopedTempDir temp_dir;
|
||||
|
||||
// Create a new temporary directory.
|
||||
EXPECT_TRUE(temp_dir.CreateUniqueTempDir());
|
||||
|
@ -510,7 +510,7 @@ TEST(CookieTest, MultipleCookiesInMemory) {
|
|||
|
||||
// Test creation of multiple cookies.
|
||||
TEST(CookieTest, MultipleCookiesOnDisk) {
|
||||
ScopedTempDir temp_dir;
|
||||
base::ScopedTempDir temp_dir;
|
||||
|
||||
// Create a new temporary directory.
|
||||
EXPECT_TRUE(temp_dir.CreateUniqueTempDir());
|
||||
|
@ -538,7 +538,7 @@ TEST(CookieTest, AllCookiesInMemory) {
|
|||
}
|
||||
|
||||
TEST(CookieTest, AllCookiesOnDisk) {
|
||||
ScopedTempDir temp_dir;
|
||||
base::ScopedTempDir temp_dir;
|
||||
|
||||
// Create a new temporary directory.
|
||||
EXPECT_TRUE(temp_dir.CreateUniqueTempDir());
|
||||
|
|
Loading…
Reference in New Issue