Update to Chromium revision 153668.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@750 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-08-29 20:11:26 +00:00
parent e99d9c86a6
commit 30ecc8a4db
20 changed files with 231 additions and 199 deletions

View File

@ -17,5 +17,5 @@
{ {
'chromium_url': 'http://src.chromium.org/svn/trunk/src', 'chromium_url': 'http://src.chromium.org/svn/trunk/src',
'chromium_revision': '149431', 'chromium_revision': '153668',
} }

View File

@ -19,12 +19,15 @@
#include "libcef/web_drop_target_win.h" #include "libcef/web_drop_target_win.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/pickle.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "net/base/file_stream.h" #include "net/base/file_stream.h"
#include "net/base/net_util.h" #include "net/base/net_util.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/base/clipboard/clipboard_util_win.h"
#include "ui/base/clipboard/custom_data_helper.h"
#include "ui/base/dragdrop/drag_utils.h" #include "ui/base/dragdrop/drag_utils.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
#include "webkit/glue/webdropdata.h" #include "webkit/glue/webdropdata.h"
@ -101,8 +104,7 @@ class DragDropThread : public base::Thread {
BrowserDragDelegate::BrowserDragDelegate(BrowserWebViewDelegate* view) BrowserDragDelegate::BrowserDragDelegate(BrowserWebViewDelegate* view)
: drag_drop_thread_id_(0), : drag_drop_thread_id_(0),
view_(view), view_(view),
drag_ended_(false), drag_ended_(false) {
old_drop_target_suspended_state_(false) {
} }
BrowserDragDelegate::~BrowserDragDelegate() { BrowserDragDelegate::~BrowserDragDelegate() {
@ -130,14 +132,10 @@ void BrowserDragDelegate::StartDragging(const WebDropData& drop_data,
DoDragging(drop_data, ops, page_url, page_encoding, image, image_offset); DoDragging(drop_data, ops, page_url, page_encoding, image, image_offset);
CefThread::PostTask( CefThread::PostTask(
CefThread::UI, FROM_HERE, CefThread::UI, FROM_HERE,
base::Bind(&BrowserDragDelegate::EndDragging, this, false)); base::Bind(&BrowserDragDelegate::EndDragging, this));
return; return;
} }
// We do not want to drag and drop the download to itself.
old_drop_target_suspended_state_ = view_->drop_target()->suspended();
view_->drop_target()->set_suspended(true);
// Start a background thread to do the drag-and-drop. // Start a background thread to do the drag-and-drop.
DCHECK(!drag_drop_thread_.get()); DCHECK(!drag_drop_thread_.get());
drag_drop_thread_.reset(new DragDropThread(this)); drag_drop_thread_.reset(new DragDropThread(this));
@ -183,7 +181,7 @@ void BrowserDragDelegate::StartBackgroundDragging(
DoDragging(drop_data, ops, page_url, page_encoding, image, image_offset); DoDragging(drop_data, ops, page_url, page_encoding, image, image_offset);
CefThread::PostTask( CefThread::PostTask(
CefThread::UI, FROM_HERE, CefThread::UI, FROM_HERE,
base::Bind(&BrowserDragDelegate::EndDragging, this, true)); base::Bind(&BrowserDragDelegate::EndDragging, this));
} }
void BrowserDragDelegate::PrepareDragForDownload( void BrowserDragDelegate::PrepareDragForDownload(
@ -273,20 +271,26 @@ void BrowserDragDelegate::DoDragging(const WebDropData& drop_data,
// Set the observer. // Set the observer.
ui::OSExchangeDataProviderWin::GetDataObjectImpl(data)->set_observer(this); ui::OSExchangeDataProviderWin::GetDataObjectImpl(data)->set_observer(this);
} else { }
// We set the file contents before the URL because the URL also sets file
// contents (to a .URL shortcut). We want to prefer file content data over // We set the file contents before the URL because the URL also sets file
// a shortcut so we add it first. // contents (to a .URL shortcut). We want to prefer file content data over
if (!drop_data.file_contents.empty()) // a shortcut so we add it first.
PrepareDragForFileContents(drop_data, &data); if (!drop_data.file_contents.empty())
if (!drop_data.html.is_null() && !drop_data.html.string().empty()) PrepareDragForFileContents(drop_data, &data);
data.SetHtml(drop_data.html.string(), drop_data.html_base_url); if (!drop_data.html.string().empty())
// We set the text contents before the URL because the URL also sets text data.SetHtml(drop_data.html.string(), drop_data.html_base_url);
// content. // We set the text contents before the URL because the URL also sets text
if (!drop_data.text.is_null() && !drop_data.text.string().empty()) // content.
data.SetString(drop_data.text.string()); if (!drop_data.text.string().empty())
if (drop_data.url.is_valid()) data.SetString(drop_data.text.string());
PrepareDragForUrl(drop_data, &data); if (drop_data.url.is_valid())
PrepareDragForUrl(drop_data, &data);
if (!drop_data.custom_data.empty()) {
Pickle pickle;
ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle);
data.SetPickledData(ui::ClipboardUtil::GetWebCustomDataFormat()->cfFormat,
pickle);
} }
// Set drag image. // Set drag image.
@ -298,28 +302,31 @@ void BrowserDragDelegate::DoDragging(const WebDropData& drop_data,
// We need to enable recursive tasks on the message loop so we can get // We need to enable recursive tasks on the message loop so we can get
// updates while in the system DoDragDrop loop. // updates while in the system DoDragDrop loop.
bool old_state = MessageLoop::current()->NestableTasksAllowed();
MessageLoop::current()->SetNestableTasksAllowed(true);
DWORD effect; DWORD effect;
DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), drag_source_, {
web_drag_utils_win::WebDragOpMaskToWinDragOpMask(ops), &effect); MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
MessageLoop::current()->SetNestableTasksAllowed(old_state); DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data),
drag_source_,
web_drag_utils_win::WebDragOpMaskToWinDragOpMask(ops),
&effect);
}
// This works because WebDragSource::OnDragSourceDrop uses PostTask to // Normally, the drop and dragend events get dispatched in the system
// dispatch the actual event. // DoDragDrop message loop so it'd be too late to set the effect to send back
// to the renderer here. However, we use PostTask to delay the execution of
// WebDragSource::OnDragSourceDrop, which means that the delayed dragend
// callback to the renderer doesn't run until this has been set to the correct
// value.
drag_source_->set_effect(effect); drag_source_->set_effect(effect);
} }
void BrowserDragDelegate::EndDragging(bool restore_suspended_state) { void BrowserDragDelegate::EndDragging() {
DCHECK(CefThread::CurrentlyOn(CefThread::UI)); DCHECK(CefThread::CurrentlyOn(CefThread::UI));
if (drag_ended_) if (drag_ended_)
return; return;
drag_ended_ = true; drag_ended_ = true;
if (restore_suspended_state)
view_->drop_target()->set_suspended(old_drop_target_suspended_state_);
if (msg_hook) { if (msg_hook) {
AttachThreadInput(drag_out_thread_id, GetCurrentThreadId(), FALSE); AttachThreadInput(drag_out_thread_id, GetCurrentThreadId(), FALSE);
UnhookWindowsHookEx(msg_hook); UnhookWindowsHookEx(msg_hook);
@ -349,7 +356,7 @@ void BrowserDragDelegate::OnWaitForData() {
// mode so that it can start to process the normal input events. // mode so that it can start to process the normal input events.
CefThread::PostTask( CefThread::PostTask(
CefThread::UI, FROM_HERE, CefThread::UI, FROM_HERE,
base::Bind(&BrowserDragDelegate::EndDragging, this, true)); base::Bind(&BrowserDragDelegate::EndDragging, this));
} }
void BrowserDragDelegate::OnDataObjectDisposed() { void BrowserDragDelegate::OnDataObjectDisposed() {

View File

@ -71,7 +71,7 @@ class BrowserDragDelegate
const SkBitmap& image, const SkBitmap& image,
const gfx::Point& image_offset); const gfx::Point& image_offset);
// Called on UI thread. // Called on UI thread.
void EndDragging(bool restore_suspended_state); void EndDragging();
void CloseThread(); void CloseThread();
// For debug check only. Access only on drag-and-drop thread. // For debug check only. Access only on drag-and-drop thread.
@ -94,9 +94,6 @@ class BrowserDragDelegate
// The flag to guard that EndDragging is not called twice. // The flag to guard that EndDragging is not called twice.
bool drag_ended_; bool drag_ended_;
// Keep track of the old suspended state of the drop target.
bool old_drop_target_suspended_state_;
DISALLOW_COPY_AND_ASSIGN(BrowserDragDelegate); DISALLOW_COPY_AND_ASSIGN(BrowserDragDelegate);
}; };

View File

@ -23,6 +23,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
#include "webkit/blob/blob_storage_controller.h" #include "webkit/blob/blob_storage_controller.h"
#include "webkit/fileapi/file_system_task_runners.h"
#include "webkit/fileapi/file_system_url.h" #include "webkit/fileapi/file_system_url.h"
#include "webkit/fileapi/file_system_util.h" #include "webkit/fileapi/file_system_util.h"
#include "webkit/fileapi/mock_file_system_options.h" #include "webkit/fileapi/mock_file_system_options.h"
@ -44,9 +45,10 @@ using WebKit::WebVector;
using webkit_blob::BlobData; using webkit_blob::BlobData;
using webkit_blob::BlobStorageController; using webkit_blob::BlobStorageController;
using fileapi::FileSystemURL;
using fileapi::FileSystemContext; using fileapi::FileSystemContext;
using fileapi::FileSystemOperationInterface; using fileapi::FileSystemOperation;
using fileapi::FileSystemTaskRunners;
using fileapi::FileSystemURL;
namespace { namespace {
MessageLoop* g_io_thread; MessageLoop* g_io_thread;
@ -64,7 +66,7 @@ void RegisterBlob(const GURL& blob_url, const FilePath& file_path) {
net::GetWellKnownMimeTypeFromExtension(extension, &mime_type); net::GetWellKnownMimeTypeFromExtension(extension, &mime_type);
BlobData::Item item; BlobData::Item item;
item.SetToFile(file_path, 0, -1, base::Time()); item.SetToFilePathRange(file_path, 0, -1, base::Time());
g_blob_storage_controller->StartBuildingBlob(blob_url); g_blob_storage_controller->StartBuildingBlob(blob_url);
g_blob_storage_controller->AppendBlobDataItem(blob_url, item); g_blob_storage_controller->AppendBlobDataItem(blob_url, item);
g_blob_storage_controller->FinishBuildingBlob(blob_url, mime_type); g_blob_storage_controller->FinishBuildingBlob(blob_url, mime_type);
@ -83,8 +85,10 @@ void BrowserFileSystem::CreateContext() {
additional_allowed_schemes.push_back("file"); additional_allowed_schemes.push_back("file");
file_system_context_ = new FileSystemContext( file_system_context_ = new FileSystemContext(
CefThread::GetMessageLoopProxyForThread(CefThread::FILE), make_scoped_ptr(new FileSystemTaskRunners(
CefThread::GetMessageLoopProxyForThread(CefThread::IO), CefThread::GetMessageLoopProxyForThread(CefThread::IO),
CefThread::GetMessageLoopProxyForThread(CefThread::FILE),
CefThread::GetMessageLoopProxyForThread(CefThread::FILE))),
NULL /* special storage policy */, NULL /* special storage policy */,
NULL /* quota manager */, NULL /* quota manager */,
file_system_dir_.path(), file_system_dir_.path(),
@ -101,7 +105,7 @@ BrowserFileSystem::~BrowserFileSystem() {
} }
void BrowserFileSystem::OpenFileSystem( void BrowserFileSystem::OpenFileSystem(
WebFrame* frame, WebFileSystem::Type web_filesystem_type, WebFrame* frame, WebFileSystem::Type type,
long long, bool create, // NOLINT(runtime/int) long long, bool create, // NOLINT(runtime/int)
WebFileSystemCallbacks* callbacks) { WebFileSystemCallbacks* callbacks) {
if (!frame || !file_system_context_.get()) { if (!frame || !file_system_context_.get()) {
@ -110,22 +114,24 @@ void BrowserFileSystem::OpenFileSystem(
return; return;
} }
fileapi::FileSystemType type; GURL origin_url(frame->document().securityOrigin().toString());
if (web_filesystem_type == WebFileSystem::TypeTemporary) file_system_context_->OpenFileSystem(
type = fileapi::kFileSystemTypeTemporary; origin_url, static_cast<fileapi::FileSystemType>(type), create,
else if (web_filesystem_type == WebFileSystem::TypePersistent) OpenFileSystemHandler(callbacks));
type = fileapi::kFileSystemTypePersistent; }
else if (web_filesystem_type == WebFileSystem::TypeExternal)
type = fileapi::kFileSystemTypeExternal; void BrowserFileSystem::DeleteFileSystem(
else { WebFrame* frame, WebFileSystem::Type type,
// Unknown type filesystem is requested. WebFileSystemCallbacks* callbacks) {
if (!frame || !file_system_context_.get()) {
callbacks->didFail(WebKit::WebFileErrorSecurity); callbacks->didFail(WebKit::WebFileErrorSecurity);
return; return;
} }
GURL origin_url(frame->document().securityOrigin().toString()); GURL origin_url(frame->document().securityOrigin().toString());
file_system_context_->OpenFileSystem( file_system_context_->DeleteFileSystem(
origin_url, type, create, OpenFileSystemHandler(callbacks)); origin_url, static_cast<fileapi::FileSystemType>(type),
DeleteFileSystemHandler(callbacks));
} }
void BrowserFileSystem::move( void BrowserFileSystem::move(
@ -272,29 +278,29 @@ void BrowserFileSystem::CleanupOnIOThread() {
bool BrowserFileSystem::HasFilePermission( bool BrowserFileSystem::HasFilePermission(
const fileapi::FileSystemURL& url, FilePermission permission) { const fileapi::FileSystemURL& url, FilePermission permission) {
// Disallow writing on isolated file system, otherwise return ok. // Disallow writing on dragged file system, otherwise return ok.
return (url.type() != fileapi::kFileSystemTypeIsolated || return (url.type() != fileapi::kFileSystemTypeDragged ||
permission == FILE_PERMISSION_READ); permission == FILE_PERMISSION_READ);
} }
FileSystemOperationInterface* BrowserFileSystem::GetNewOperation( FileSystemOperation* BrowserFileSystem::GetNewOperation(
const fileapi::FileSystemURL& url) { const fileapi::FileSystemURL& url) {
return file_system_context_->CreateFileSystemOperation(url); return file_system_context_->CreateFileSystemOperation(url);
} }
FileSystemOperationInterface::StatusCallback FileSystemOperation::StatusCallback
BrowserFileSystem::FinishHandler(WebFileSystemCallbacks* callbacks) { BrowserFileSystem::FinishHandler(WebFileSystemCallbacks* callbacks) {
return base::Bind(&BrowserFileSystem::DidFinish, return base::Bind(&BrowserFileSystem::DidFinish,
AsWeakPtr(), base::Unretained(callbacks)); AsWeakPtr(), base::Unretained(callbacks));
} }
FileSystemOperationInterface::ReadDirectoryCallback FileSystemOperation::ReadDirectoryCallback
BrowserFileSystem::ReadDirectoryHandler(WebFileSystemCallbacks* callbacks) { BrowserFileSystem::ReadDirectoryHandler(WebFileSystemCallbacks* callbacks) {
return base::Bind(&BrowserFileSystem::DidReadDirectory, return base::Bind(&BrowserFileSystem::DidReadDirectory,
AsWeakPtr(), base::Unretained(callbacks)); AsWeakPtr(), base::Unretained(callbacks));
} }
FileSystemOperationInterface::GetMetadataCallback FileSystemOperation::GetMetadataCallback
BrowserFileSystem::GetMetadataHandler(WebFileSystemCallbacks* callbacks) { BrowserFileSystem::GetMetadataHandler(WebFileSystemCallbacks* callbacks) {
return base::Bind(&BrowserFileSystem::DidGetMetadata, return base::Bind(&BrowserFileSystem::DidGetMetadata,
AsWeakPtr(), base::Unretained(callbacks)); AsWeakPtr(), base::Unretained(callbacks));
@ -306,7 +312,13 @@ BrowserFileSystem::OpenFileSystemHandler(WebFileSystemCallbacks* callbacks) {
AsWeakPtr(), base::Unretained(callbacks)); AsWeakPtr(), base::Unretained(callbacks));
} }
FileSystemOperationInterface::SnapshotFileCallback FileSystemContext::DeleteFileSystemCallback
BrowserFileSystem::DeleteFileSystemHandler(WebFileSystemCallbacks* callbacks) {
return base::Bind(&BrowserFileSystem::DidDeleteFileSystem,
AsWeakPtr(), callbacks);
}
FileSystemOperation::SnapshotFileCallback
BrowserFileSystem::SnapshotFileHandler(const GURL& blob_url, BrowserFileSystem::SnapshotFileHandler(const GURL& blob_url,
WebFileSystemCallbacks* callbacks) { WebFileSystemCallbacks* callbacks) {
return base::Bind(&BrowserFileSystem::DidCreateSnapshotFile, return base::Bind(&BrowserFileSystem::DidCreateSnapshotFile,
@ -374,6 +386,15 @@ void BrowserFileSystem::DidOpenFileSystem(
} }
} }
void BrowserFileSystem::DidDeleteFileSystem(
WebFileSystemCallbacks* callbacks,
base::PlatformFileError result) {
if (result == base::PLATFORM_FILE_OK)
callbacks->didSucceed();
else
callbacks->didFail(fileapi::PlatformFileErrorToWebFileError(result));
}
void BrowserFileSystem::DidCreateSnapshotFile( void BrowserFileSystem::DidCreateSnapshotFile(
const GURL& blob_url, const GURL& blob_url,
WebFileSystemCallbacks* callbacks, WebFileSystemCallbacks* callbacks,

View File

@ -14,7 +14,7 @@
#include "base/scoped_temp_dir.h" #include "base/scoped_temp_dir.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h"
#include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/file_system_operation_interface.h" #include "webkit/fileapi/file_system_operation.h"
#include "webkit/fileapi/file_system_types.h" #include "webkit/fileapi/file_system_types.h"
namespace WebKit { namespace WebKit {
@ -46,6 +46,9 @@ class BrowserFileSystem
long long size, // NOLINT(runtime/int) long long size, // NOLINT(runtime/int)
bool create, bool create,
WebKit::WebFileSystemCallbacks* callbacks); WebKit::WebFileSystemCallbacks* callbacks);
void DeleteFileSystem(WebKit::WebFrame* frame,
WebKit::WebFileSystem::Type type,
WebKit::WebFileSystemCallbacks* callbacks);
fileapi::FileSystemContext* file_system_context() { fileapi::FileSystemContext* file_system_context() {
return file_system_context_.get(); return file_system_context_.get();
@ -107,19 +110,21 @@ class BrowserFileSystem
// Helpers. // Helpers.
bool HasFilePermission(const fileapi::FileSystemURL& url, bool HasFilePermission(const fileapi::FileSystemURL& url,
FilePermission permission); FilePermission permission);
fileapi::FileSystemOperationInterface* GetNewOperation( fileapi::FileSystemOperation* GetNewOperation(
const fileapi::FileSystemURL& url); const fileapi::FileSystemURL& url);
// Callback Handlers // Callback Handlers
fileapi::FileSystemOperationInterface::StatusCallback FinishHandler( fileapi::FileSystemOperation::StatusCallback FinishHandler(
WebKit::WebFileSystemCallbacks* callbacks); WebKit::WebFileSystemCallbacks* callbacks);
fileapi::FileSystemOperationInterface::GetMetadataCallback GetMetadataHandler( fileapi::FileSystemOperation::GetMetadataCallback GetMetadataHandler(
WebKit::WebFileSystemCallbacks* callbacks); WebKit::WebFileSystemCallbacks* callbacks);
fileapi::FileSystemOperationInterface::ReadDirectoryCallback fileapi::FileSystemOperation::ReadDirectoryCallback
ReadDirectoryHandler(WebKit::WebFileSystemCallbacks* callbacks); ReadDirectoryHandler(WebKit::WebFileSystemCallbacks* callbacks);
fileapi::FileSystemContext::OpenFileSystemCallback OpenFileSystemHandler( fileapi::FileSystemContext::OpenFileSystemCallback OpenFileSystemHandler(
WebKit::WebFileSystemCallbacks* callbacks); WebKit::WebFileSystemCallbacks* callbacks);
fileapi::FileSystemOperationInterface::SnapshotFileCallback fileapi::FileSystemContext::DeleteFileSystemCallback DeleteFileSystemHandler(
WebKit::WebFileSystemCallbacks* callbacks);
fileapi::FileSystemOperation::SnapshotFileCallback
SnapshotFileHandler(const GURL& blob_url, SnapshotFileHandler(const GURL& blob_url,
WebKit::WebFileSystemCallbacks* callbacks); WebKit::WebFileSystemCallbacks* callbacks);
void DidFinish(WebKit::WebFileSystemCallbacks* callbacks, void DidFinish(WebKit::WebFileSystemCallbacks* callbacks,
@ -136,6 +141,8 @@ class BrowserFileSystem
void DidOpenFileSystem(WebKit::WebFileSystemCallbacks* callbacks, void DidOpenFileSystem(WebKit::WebFileSystemCallbacks* callbacks,
base::PlatformFileError result, base::PlatformFileError result,
const std::string& name, const GURL& root); const std::string& name, const GURL& root);
void DidDeleteFileSystem(WebKit::WebFileSystemCallbacks* callbacks,
base::PlatformFileError result);
void DidCreateSnapshotFile( void DidCreateSnapshotFile(
const GURL& blob_url, const GURL& blob_url,
WebKit::WebFileSystemCallbacks* callbacks, WebKit::WebFileSystemCallbacks* callbacks,

View File

@ -11,14 +11,14 @@
#include "base/message_loop_proxy.h" #include "base/message_loop_proxy.h"
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
#include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/file_system_operation_interface.h" #include "webkit/fileapi/file_system_operation.h"
#include "webkit/fileapi/file_system_types.h" #include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/file_system_url.h" #include "webkit/fileapi/file_system_url.h"
#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkit_glue.h"
using fileapi::FileSystemURL; using fileapi::FileSystemURL;
using fileapi::FileSystemContext; using fileapi::FileSystemContext;
using fileapi::FileSystemOperationInterface; using fileapi::FileSystemOperation;
using fileapi::WebFileWriterBase; using fileapi::WebFileWriterBase;
using WebKit::WebFileWriterClient; using WebKit::WebFileWriterClient;
using WebKit::WebString; using WebKit::WebString;
@ -90,13 +90,13 @@ class BrowserFileWriter::IOThreadProxy
friend class base::RefCountedThreadSafe<IOThreadProxy>; friend class base::RefCountedThreadSafe<IOThreadProxy>;
virtual ~IOThreadProxy() {} virtual ~IOThreadProxy() {}
FileSystemOperationInterface* GetNewOperation( const FileSystemURL& url) { FileSystemOperation* GetNewOperation( const FileSystemURL& url) {
return file_system_context_->CreateFileSystemOperation(url); return file_system_context_->CreateFileSystemOperation(url);
} }
// Returns true if it is not writable. // Returns true if it is not writable.
bool FailIfNotWritable(const FileSystemURL& url) { bool FailIfNotWritable(const FileSystemURL& url) {
if (url.type() == fileapi::kFileSystemTypeIsolated) { if (url.type() == fileapi::kFileSystemTypeDragged) {
// Write is not allowed in isolate file system in BrowserFileWriter. // Write is not allowed in isolate file system in BrowserFileWriter.
DidFailOnMainThread(base::PLATFORM_FILE_ERROR_SECURITY); DidFailOnMainThread(base::PLATFORM_FILE_ERROR_SECURITY);
return true; return true;
@ -169,7 +169,7 @@ class BrowserFileWriter::IOThreadProxy
base::WeakPtr<BrowserFileWriter> simple_writer_; base::WeakPtr<BrowserFileWriter> simple_writer_;
// Only used on the io thread. // Only used on the io thread.
FileSystemOperationInterface* operation_; FileSystemOperation* operation_;
scoped_refptr<FileSystemContext> file_system_context_; scoped_refptr<FileSystemContext> file_system_context_;
}; };

View File

@ -116,7 +116,7 @@ int BrowserNetworkDelegate::OnBeforeSocketStreamConnect(
return net::OK; return net::OK;
} }
void BrowserNetworkDelegate::OnCacheWaitStateChange( void BrowserNetworkDelegate::OnRequestWaitStateChange(
const net::URLRequest& request, const net::URLRequest& request,
CacheWaitState state) { RequestWaitState state) {
} }

View File

@ -56,8 +56,8 @@ class BrowserNetworkDelegate : public net::NetworkDelegate {
virtual int OnBeforeSocketStreamConnect( virtual int OnBeforeSocketStreamConnect(
net::SocketStream* stream, net::SocketStream* stream,
const net::CompletionCallback& callback) OVERRIDE; const net::CompletionCallback& callback) OVERRIDE;
virtual void OnCacheWaitStateChange(const net::URLRequest& request, virtual void OnRequestWaitStateChange(const net::URLRequest& request,
CacheWaitState state) OVERRIDE; RequestWaitState state) OVERRIDE;
bool accept_all_cookies_; bool accept_all_cookies_;
}; };

View File

@ -34,7 +34,7 @@
#include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_config_service_fixed.h"
#include "net/proxy/proxy_resolver.h" #include "net/proxy/proxy_resolver.h"
#include "net/proxy/proxy_service.h" #include "net/proxy/proxy_service.h"
#include "net/url_request/url_request_job_factory.h" #include "net/url_request/url_request_job_factory_impl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h"
#include "webkit/blob/blob_storage_controller.h" #include "webkit/blob/blob_storage_controller.h"
@ -254,7 +254,7 @@ void BrowserRequestContext::Init(
storage_.set_ftp_transaction_factory( storage_.set_ftp_transaction_factory(
new net::FtpNetworkLayer(host_resolver())); new net::FtpNetworkLayer(host_resolver()));
net::URLRequestJobFactory* job_factory = new net::URLRequestJobFactory; net::URLRequestJobFactory* job_factory = new net::URLRequestJobFactoryImpl();
blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); blob_storage_controller_.reset(new webkit_blob::BlobStorageController());
job_factory->SetProtocolHandler( job_factory->SetProtocolHandler(

View File

@ -73,6 +73,7 @@
#include "webkit/fileapi/file_system_dir_url_request_job.h" #include "webkit/fileapi/file_system_dir_url_request_job.h"
#include "webkit/fileapi/file_system_url_request_job.h" #include "webkit/fileapi/file_system_url_request_job.h"
#include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/resource_loader_bridge.h"
#include "webkit/glue/resource_request_body.h"
#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkit_glue.h"
#if defined(OS_MACOSX) || defined(OS_WIN) #if defined(OS_MACOSX) || defined(OS_WIN)
@ -84,6 +85,7 @@ using net::StaticCookiePolicy;
using net::URLRequestStatus; using net::URLRequestStatus;
using webkit_blob::ShareableFileReference; using webkit_blob::ShareableFileReference;
using webkit_glue::ResourceLoaderBridge; using webkit_glue::ResourceLoaderBridge;
using webkit_glue::ResourceRequestBody;
using webkit_glue::ResourceResponseInfo; using webkit_glue::ResourceResponseInfo;
@ -102,7 +104,7 @@ struct RequestParams {
ResourceType::Type request_type; ResourceType::Type request_type;
int appcache_host_id; int appcache_host_id;
bool download_to_file; bool download_to_file;
scoped_refptr<net::UploadData> upload; scoped_refptr<ResourceRequestBody> request_body;
net::RequestPriority priority; net::RequestPriority priority;
}; };
@ -146,12 +148,16 @@ class RequestInterceptor : public net::URLRequest::Interceptor {
UnregisterRequestInterceptor(this); UnregisterRequestInterceptor(this);
} }
virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) virtual net::URLRequestJob* MaybeIntercept(
net::URLRequest* request,
net::NetworkDelegate* network_delegate)
OVERRIDE { OVERRIDE {
return NULL; return NULL;
} }
virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request, virtual net::URLRequestJob* MaybeInterceptRedirect(
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const GURL& location) OVERRIDE { const GURL& location) OVERRIDE {
REQUIRE_IOT(); REQUIRE_IOT();
@ -175,7 +181,9 @@ class RequestInterceptor : public net::URLRequest::Interceptor {
if (newUrlStr != location.spec()) { if (newUrlStr != location.spec()) {
GURL new_url = GURL(std::string(newUrlStr)); GURL new_url = GURL(std::string(newUrlStr));
if (!new_url.is_empty() && new_url.is_valid()) if (!new_url.is_empty() && new_url.is_valid())
return new net::URLRequestRedirectJob(request, new_url); return new net::URLRequestRedirectJob(request,
network_delegate,
new_url);
} }
return NULL; return NULL;
@ -443,6 +451,12 @@ class RequestProxy : public net::URLRequest::Delegate,
bool handled = false; bool handled = false;
scoped_refptr<net::UploadData> upload_data;
if (params->request_body) {
upload_data = params->request_body->ResolveElementsAndCreateUploadData(
_Context->request_context()->blob_storage_controller());
}
if (browser_.get()) { if (browser_.get()) {
CefRefPtr<CefClient> client = browser_->GetClient(); CefRefPtr<CefClient> client = browser_->GetClient();
CefRefPtr<CefRequestHandler> handler; CefRefPtr<CefRequestHandler> handler;
@ -466,10 +480,10 @@ class RequestProxy : public net::URLRequest::Delegate,
requestimpl->SetHeaderMap(headerMap); requestimpl->SetHeaderMap(headerMap);
// Transfer post data, if any // Transfer post data, if any
scoped_refptr<net::UploadData> upload = params->upload; if (upload_data.get()) {
if (upload.get()) {
CefRefPtr<CefPostData> postdata(new CefPostDataImpl()); CefRefPtr<CefPostData> postdata(new CefPostDataImpl());
static_cast<CefPostDataImpl*>(postdata.get())->Set(*upload.get()); static_cast<CefPostDataImpl*>(postdata.get())->Set(
*upload_data.get());
requestimpl->SetPostData(postdata); requestimpl->SetPostData(postdata);
} }
@ -510,8 +524,8 @@ class RequestProxy : public net::URLRequest::Delegate,
// Observe post data from request. // Observe post data from request.
CefRefPtr<CefPostData> postData = request->GetPostData(); CefRefPtr<CefPostData> postData = request->GetPostData();
if (postData.get()) { if (postData.get()) {
params->upload = new net::UploadData(); upload_data = new net::UploadData();
static_cast<CefPostDataImpl*>(postData.get())->Get(*params->upload); static_cast<CefPostDataImpl*>(postData.get())->Get(*upload_data);
} }
} }
@ -574,12 +588,6 @@ class RequestProxy : public net::URLRequest::Delegate,
} }
if (!handled) { if (!handled) {
// Might need to resolve the blob references in the upload data.
if (params->upload) {
_Context->request_context()->blob_storage_controller()->
ResolveBlobReferencesInUploadData(params->upload.get());
}
net::URLRequestContext* context = browser_.get() ? net::URLRequestContext* context = browser_.get() ?
browser_->request_context_proxy() : _Context->request_context(); browser_->request_context_proxy() : _Context->request_context();
@ -594,7 +602,7 @@ class RequestProxy : public net::URLRequest::Delegate,
headers.AddHeadersFromString(params->headers); headers.AddHeadersFromString(params->headers);
request_->SetExtraRequestHeaders(headers); request_->SetExtraRequestHeaders(headers);
request_->set_load_flags(params->load_flags); request_->set_load_flags(params->load_flags);
request_->set_upload(params->upload.get()); request_->set_upload(upload_data);
request_->SetUserData(kCefUserData, request_->SetUserData(kCefUserData,
new ExtraRequestInfo(browser_.get(), params->request_type)); new ExtraRequestInfo(browser_.get(), params->request_type));
BrowserAppCacheSystem::SetExtraRequestInfo( BrowserAppCacheSystem::SetExtraRequestInfo(
@ -1067,41 +1075,11 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge,
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// ResourceLoaderBridge implementation: // ResourceLoaderBridge implementation:
virtual void AppendDataToUpload(const char* data, int data_len) OVERRIDE { virtual void SetRequestBody(ResourceRequestBody* request_body) OVERRIDE {
DCHECK(CalledOnValidThread()); DCHECK(CalledOnValidThread());
DCHECK(params_.get()); DCHECK(params_.get());
if (!params_->upload) DCHECK(!params_->request_body);
params_->upload = new net::UploadData(); params_->request_body = request_body;
params_->upload->AppendBytes(data, data_len);
}
virtual void AppendFileRangeToUpload(
const FilePath& file_path,
uint64 offset,
uint64 length,
const base::Time& expected_modification_time) OVERRIDE {
DCHECK(CalledOnValidThread());
DCHECK(params_.get());
if (!params_->upload)
params_->upload = new net::UploadData();
params_->upload->AppendFileRange(file_path, offset, length,
expected_modification_time);
}
virtual void AppendBlobToUpload(const GURL& blob_url) OVERRIDE {
DCHECK(CalledOnValidThread());
DCHECK(params_.get());
if (!params_->upload)
params_->upload = new net::UploadData();
params_->upload->AppendBlob(blob_url);
}
virtual void SetUploadIdentifier(int64 identifier) OVERRIDE {
DCHECK(CalledOnValidThread());
DCHECK(params_.get());
if (!params_->upload)
params_->upload = new net::UploadData();
params_->upload->set_identifier(identifier);
} }
virtual bool Start(Peer* peer) OVERRIDE { virtual bool Start(Peer* peer) OVERRIDE {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@ -11,6 +11,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
#include "webkit/blob/blob_data.h" #include "webkit/blob/blob_data.h"
#include "webkit/blob/blob_storage_controller.h" #include "webkit/blob/blob_storage_controller.h"
#include "webkit/glue/webkit_glue.h"
using WebKit::WebBlobData; using WebKit::WebBlobData;
using WebKit::WebURL; using WebKit::WebURL;
@ -21,6 +22,46 @@ namespace {
MessageLoop* g_io_thread; MessageLoop* g_io_thread;
webkit_blob::BlobStorageController* g_blob_storage_controller; webkit_blob::BlobStorageController* g_blob_storage_controller;
// Creates a new BlobData from WebBlobData.
BlobData* NewBlobData(const WebBlobData& data) {
BlobData* blob = new BlobData;
size_t i = 0;
WebBlobData::Item item;
while (data.itemAt(i++, item)) {
switch (item.type) {
case WebBlobData::Item::TypeData:
if (!item.data.isEmpty()) {
// WebBlobData does not allow partial data.
DCHECK(!item.offset && item.length == -1);
blob->AppendData(item.data);
}
break;
case WebBlobData::Item::TypeFile:
if (item.length) {
blob->AppendFile(
webkit_glue::WebStringToFilePath(item.filePath),
static_cast<uint64>(item.offset),
static_cast<uint64>(item.length),
base::Time::FromDoubleT(item.expectedModificationTime));
}
break;
case WebBlobData::Item::TypeBlob:
if (item.length) {
blob->AppendBlob(
item.blobURL,
static_cast<uint64>(item.offset),
static_cast<uint64>(item.length));
}
break;
default:
NOTREACHED();
}
}
blob->set_content_type(data.contentType().utf8().data());
blob->set_content_disposition(data.contentDisposition().utf8().data());
return blob;
}
} // namespace } // namespace
/* static */ /* static */
@ -45,7 +86,7 @@ void BrowserWebBlobRegistryImpl::registerBlobURL(
GURL thread_safe_url = url; // WebURL uses refcounted strings. GURL thread_safe_url = url; // WebURL uses refcounted strings.
g_io_thread->PostTask(FROM_HERE, base::Bind( g_io_thread->PostTask(FROM_HERE, base::Bind(
&BrowserWebBlobRegistryImpl::AddFinishedBlob, this, &BrowserWebBlobRegistryImpl::AddFinishedBlob, this,
thread_safe_url, make_scoped_refptr(new BlobData(data)))); thread_safe_url, make_scoped_refptr(NewBlobData(data))));
} }
void BrowserWebBlobRegistryImpl::registerBlobURL( void BrowserWebBlobRegistryImpl::registerBlobURL(

View File

@ -11,6 +11,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "CrossOriginPreflightResultCache.h" // NOLINT(build/include) #include "CrossOriginPreflightResultCache.h" // NOLINT(build/include)
#include "DocumentLoader.h" // NOLINT(build/include) #include "DocumentLoader.h" // NOLINT(build/include)
#include "MemoryCache.h" // NOLINT(build/include) #include "MemoryCache.h" // NOLINT(build/include)
#include "ScriptController.h" // NOLINT(build/include)
#include "TextEncoding.h" // NOLINT(build/include) #include "TextEncoding.h" // NOLINT(build/include)
#include "third_party/WebKit/Source/WebKit/chromium/src/WebFrameImpl.h" #include "third_party/WebKit/Source/WebKit/chromium/src/WebFrameImpl.h"
MSVC_POP_WARNING(); MSVC_POP_WARNING();
@ -44,9 +45,8 @@ void InitializeTextEncoding() {
} }
v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame) { v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame) {
WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(frame); WebFrameImpl* impl = static_cast<WebFrameImpl*>(frame);
WebCore::Frame* core_frame = webFrameImpl->frame(); return WebCore::ScriptController::mainWorldContext(impl->frame());
return WebCore::V8Proxy::context(core_frame);
} }
void ClearCache() { void ClearCache() {

View File

@ -18,8 +18,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h"
#include "v8/include/v8.h" #include "v8/include/v8.h"
#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/npapi/plugin_list.h"
@ -221,25 +219,6 @@ WebKit::WebIDBFactory* BrowserWebKitInit::idbFactory() {
return WebKit::WebIDBFactory::create(); return WebKit::WebIDBFactory::create();
} }
void BrowserWebKitInit::createIDBKeysFromSerializedValuesAndKeyPath(
const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values,
const WebKit::WebIDBKeyPath& keyPath,
WebKit::WebVector<WebKit::WebIDBKey>& keys_out) {
WebKit::WebVector<WebKit::WebIDBKey> keys(values.size());
for (size_t i = 0; i < values.size(); ++i)
keys[i] = WebKit::WebIDBKey::createFromValueAndKeyPath(values[i], keyPath);
keys_out.swap(keys);
}
WebKit::WebSerializedScriptValue
BrowserWebKitInit::injectIDBKeyIntoSerializedValue(
const WebKit::WebIDBKey& key,
const WebKit::WebSerializedScriptValue& value,
const WebKit::WebIDBKeyPath& keyPath) {
return WebKit::WebIDBKey::injectIDBKeyIntoSerializedValue(
key, value, keyPath);
}
WebKit::WebGraphicsContext3D* WebKit::WebGraphicsContext3D*
BrowserWebKitInit::createOffscreenGraphicsContext3D( BrowserWebKitInit::createOffscreenGraphicsContext3D(
const WebKit::WebGraphicsContext3D::Attributes& attributes) { const WebKit::WebGraphicsContext3D::Attributes& attributes) {

View File

@ -67,14 +67,6 @@ class BrowserWebKitInit : public webkit_glue::WebKitPlatformSupportImpl {
virtual WebKit::WebStorageNamespace* createLocalStorageNamespace( virtual WebKit::WebStorageNamespace* createLocalStorageNamespace(
const WebKit::WebString& path, unsigned quota) OVERRIDE; const WebKit::WebString& path, unsigned quota) OVERRIDE;
virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE; virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE;
virtual void createIDBKeysFromSerializedValuesAndKeyPath(
const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values,
const WebKit::WebIDBKeyPath& keyPath,
WebKit::WebVector<WebKit::WebIDBKey>& keys_out) OVERRIDE;
virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue(
const WebKit::WebIDBKey& key,
const WebKit::WebSerializedScriptValue& value,
const WebKit::WebIDBKeyPath& keyPath) OVERRIDE;
virtual WebKit::WebGraphicsContext3D* createOffscreenGraphicsContext3D( virtual WebKit::WebGraphicsContext3D* createOffscreenGraphicsContext3D(
const WebKit::WebGraphicsContext3D::Attributes& attributes) OVERRIDE; const WebKit::WebGraphicsContext3D::Attributes& attributes) OVERRIDE;
virtual string16 GetLocalizedString(int message_id) OVERRIDE; virtual string16 GetLocalizedString(int message_id) OVERRIDE;

View File

@ -688,7 +688,7 @@ WebPlugin* BrowserWebViewDelegate::createPlugin(
} }
WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer( WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer(
WebFrame* frame, WebMediaPlayerClient* client) { WebFrame* frame, const WebKit::WebURL&, WebMediaPlayerClient* client) {
scoped_ptr<media::MessageLoopFactory> message_loop_factory( scoped_ptr<media::MessageLoopFactory> message_loop_factory(
new media::MessageLoopFactory()); new media::MessageLoopFactory());

View File

@ -156,7 +156,7 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
virtual WebKit::WebPlugin* createPlugin( virtual WebKit::WebPlugin* createPlugin(
WebKit::WebFrame*, const WebKit::WebPluginParams&) OVERRIDE; WebKit::WebFrame*, const WebKit::WebPluginParams&) OVERRIDE;
virtual WebKit::WebMediaPlayer* createMediaPlayer( virtual WebKit::WebMediaPlayer* createMediaPlayer(
WebKit::WebFrame*, WebKit::WebMediaPlayerClient*) OVERRIDE; WebKit::WebFrame*, const WebKit::WebURL&, WebKit::WebMediaPlayerClient*) OVERRIDE;
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost( virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
WebKit::WebFrame* frame, WebKit::WebApplicationCacheHostClient* client) WebKit::WebFrame* frame, WebKit::WebApplicationCacheHostClient* client)
OVERRIDE; OVERRIDE;

View File

@ -296,8 +296,8 @@ void CefPostDataImpl::Set(const net::UploadData& data) {
CefRefPtr<CefPostDataElement> postelem; CefRefPtr<CefPostDataElement> postelem;
const std::vector<net::UploadData::Element>* elements = data.elements(); const std::vector<net::UploadElement>* elements = data.elements();
std::vector<net::UploadData::Element>::const_iterator it = elements->begin(); std::vector<net::UploadElement>::const_iterator it = elements->begin();
for (; it != elements->end(); ++it) { for (; it != elements->end(); ++it) {
postelem = CefPostDataElement::CreatePostDataElement(); postelem = CefPostDataElement::CreatePostDataElement();
static_cast<CefPostDataElementImpl*>(postelem.get())->Set(*it); static_cast<CefPostDataElementImpl*>(postelem.get())->Set(*it);
@ -308,8 +308,8 @@ void CefPostDataImpl::Set(const net::UploadData& data) {
void CefPostDataImpl::Get(net::UploadData& data) { void CefPostDataImpl::Get(net::UploadData& data) {
AutoLock lock_scope(this); AutoLock lock_scope(this);
net::UploadData::Element element; net::UploadElement element;
std::vector<net::UploadData::Element> data_elements; std::vector<net::UploadElement> data_elements;
ElementVector::iterator it = elements_.begin(); ElementVector::iterator it = elements_.begin();
for (; it != elements_.end(); ++it) { for (; it != elements_.end(); ++it) {
static_cast<CefPostDataElementImpl*>(it->get())->Get(element); static_cast<CefPostDataElementImpl*>(it->get())->Get(element);
@ -436,22 +436,19 @@ size_t CefPostDataElementImpl::GetBytes(size_t size, void* bytes) {
return rv; return rv;
} }
void CefPostDataElementImpl::Set(const net::UploadData::Element& element) { void CefPostDataElementImpl::Set(const net::UploadElement& element) {
AutoLock lock_scope(this); AutoLock lock_scope(this);
if (element.type() == net::UploadData::TYPE_BYTES) { if (element.type() == net::UploadElement::TYPE_BYTES) {
SetToBytes(element.bytes().size(), SetToBytes(element.bytes_length(), element.bytes());
static_cast<const void*>( } else if (element.type() == net::UploadElement::TYPE_FILE) {
std::string(element.bytes().begin(),
element.bytes().end()).c_str()));
} else if (element.type() == net::UploadData::TYPE_FILE) {
SetToFile(element.file_path().value()); SetToFile(element.file_path().value());
} else { } else {
NOTREACHED(); NOTREACHED();
} }
} }
void CefPostDataElementImpl::Get(net::UploadData::Element& element) { void CefPostDataElementImpl::Get(net::UploadElement& element) {
AutoLock lock_scope(this); AutoLock lock_scope(this);
if (type_ == PDE_TYPE_BYTES) { if (type_ == PDE_TYPE_BYTES) {

View File

@ -104,8 +104,8 @@ class CefPostDataElementImpl : public CefPostDataElement {
void* GetBytes() { return data_.bytes.bytes; } void* GetBytes() { return data_.bytes.bytes; }
void Set(const net::UploadData::Element& element); void Set(const net::UploadElement& element);
void Get(net::UploadData::Element& element); void Get(net::UploadElement& element);
void Set(const WebKit::WebHTTPBody::Element& element); void Set(const WebKit::WebHTTPBody::Element& element);
void Get(WebKit::WebHTTPBody::Element& element); void Get(WebKit::WebHTTPBody::Element& element);

View File

@ -80,12 +80,15 @@ bool IsBuiltinScheme(const std::string& scheme) {
return false; return false;
} }
net::URLRequestJob* GetBuiltinSchemeRequestJob(net::URLRequest* request, net::URLRequestJob* GetBuiltinSchemeRequestJob(
const std::string& scheme) { net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const std::string& scheme) {
// See if the request should be handled by a built-in protocol factory. // See if the request should be handled by a built-in protocol factory.
for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i) { for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i) {
if (scheme == kBuiltinFactories[i].scheme) { if (scheme == kBuiltinFactories[i].scheme) {
net::URLRequestJob* job = (kBuiltinFactories[i].factory)(request, scheme); net::URLRequestJob* job =
(kBuiltinFactories[i].factory)(request, network_delegate, scheme);
DCHECK(job); // The built-in factories are not expected to fail! DCHECK(job); // The built-in factories are not expected to fail!
return job; return job;
} }
@ -106,8 +109,9 @@ std::string ToLower(const std::string& str) {
class CefUrlRequestJob : public net::URLRequestJob { class CefUrlRequestJob : public net::URLRequestJob {
public: public:
CefUrlRequestJob(net::URLRequest* request, CefUrlRequestJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate,
CefRefPtr<CefSchemeHandler> handler) CefRefPtr<CefSchemeHandler> handler)
: net::URLRequestJob(request, request->context()->network_delegate()), : net::URLRequestJob(request, network_delegate),
handler_(handler), handler_(handler),
remaining_bytes_(0), remaining_bytes_(0),
response_cookies_save_index_(0), response_cookies_save_index_(0),
@ -574,10 +578,11 @@ class CefUrlRequestManager {
// From net::URLRequestJobFactory::ProtocolHandler // From net::URLRequestJobFactory::ProtocolHandler
virtual net::URLRequestJob* MaybeCreateJob( virtual net::URLRequestJob* MaybeCreateJob(
net::URLRequest* request) const OVERRIDE { net::URLRequest* request,
net::NetworkDelegate* network_delegate) const OVERRIDE {
REQUIRE_IOT(); REQUIRE_IOT();
return CefUrlRequestManager::GetInstance()->GetRequestJob(request, return CefUrlRequestManager::GetInstance()->GetRequestJob(
scheme_); request, network_delegate, scheme_);
} }
private: private:
@ -732,6 +737,7 @@ class CefUrlRequestManager {
// Create the job that will handle the request. |scheme| will already be in // Create the job that will handle the request. |scheme| will already be in
// lower case. // lower case.
net::URLRequestJob* GetRequestJob(net::URLRequest* request, net::URLRequestJob* GetRequestJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const std::string& scheme) { const std::string& scheme) {
net::URLRequestJob* job = NULL; net::URLRequestJob* job = NULL;
CefRefPtr<CefSchemeHandlerFactory> factory = CefRefPtr<CefSchemeHandlerFactory> factory =
@ -745,12 +751,12 @@ class CefUrlRequestManager {
CefRefPtr<CefSchemeHandler> handler = CefRefPtr<CefSchemeHandler> handler =
factory->Create(browser.get(), scheme, requestPtr); factory->Create(browser.get(), scheme, requestPtr);
if (handler.get()) if (handler.get())
job = new CefUrlRequestJob(request, handler); job = new CefUrlRequestJob(request, network_delegate, handler);
} }
if (!job && IsBuiltinScheme(scheme)) { if (!job && IsBuiltinScheme(scheme)) {
// Give the built-in scheme handler a chance to handle the request. // Give the built-in scheme handler a chance to handle the request.
job = GetBuiltinSchemeRequestJob(request, scheme); job = GetBuiltinSchemeRequestJob(request, network_delegate, scheme);
} }
#ifndef NDEBUG #ifndef NDEBUG

View File

@ -8,7 +8,10 @@
#include "third_party/WebKit/Source/WebCore/config.h" #include "third_party/WebKit/Source/WebCore/config.h"
MSVC_PUSH_WARNING_LEVEL(0); MSVC_PUSH_WARNING_LEVEL(0);
#include "V8Proxy.h" // NOLINT(build/include) #include "Frame.h" // NOLINT(build/include)
#include "ScriptController.h" // NOLINT(build/include)
#include "ScriptControllerBase.h" // NOLINT(build/include)
#include "V8Binding.h" // NOLINT(build/include)
#include "V8RecursionScope.h" // NOLINT(build/include) #include "V8RecursionScope.h" // NOLINT(build/include)
MSVC_POP_WARNING(); MSVC_POP_WARNING();
#undef LOG #undef LOG
@ -597,12 +600,14 @@ bool CefV8ContextImpl::Eval(const CefString& code,
retval = NULL; retval = NULL;
exception = NULL; exception = NULL;
// Execute the function call using the V8Proxy so that inspector // Execute the function call using the ScriptController so that inspector
// instrumentation works. // instrumentation works.
WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(); RefPtr<WebCore::Frame> frame = WebCore::toFrameIfNotDetached(GetHandle());
DCHECK(proxy); DCHECK(frame);
if (proxy) if (frame &&
func_rv = proxy->callFunction(func, obj, 1, &code_val); frame->script()->canExecuteScripts(WebCore::AboutToExecuteScript)) {
func_rv = frame->script()->callFunction(func, obj, 1, &code_val);
}
if (try_catch.HasCaught()) { if (try_catch.HasCaught()) {
exception = new CefV8ExceptionImpl(try_catch.Message()); exception = new CefV8ExceptionImpl(try_catch.Message());
@ -1342,12 +1347,14 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::ExecuteFunctionWithContext(
try_catch.SetVerbose(true); try_catch.SetVerbose(true);
v8::Local<v8::Value> func_rv; v8::Local<v8::Value> func_rv;
// Execute the function call using the V8Proxy so that inspector // Execute the function call using the ScriptController so that inspector
// instrumentation works. // instrumentation works.
WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(); RefPtr<WebCore::Frame> frame = WebCore::toFrameIfNotDetached(context_local);
DCHECK(proxy); DCHECK(frame);
if (proxy) if (frame &&
func_rv = proxy->callFunction(func, recv, argc, argv); frame->script()->canExecuteScripts(WebCore::AboutToExecuteScript)) {
func_rv = frame->script()->callFunction(func, recv, argc, argv);
}
if (!HasCaught(try_catch) && !func_rv.IsEmpty()) if (!HasCaught(try_catch) && !func_rv.IsEmpty())
retval = new CefV8ValueImpl(func_rv); retval = new CefV8ValueImpl(func_rv);