libcef: Update due to underlying chromium changes.
- webkit/webkit.gyp moved to webkit/support/webkit_support.gyp. - Classes moved from base/gfx moved to gfx. - Changes to plugin creation code path. - Changes to BrowserResourceLoaderBridge, BrowserAppCacheSystem and BrowserDatabaseSystem. - Enable push state, notifications, touch and indexed database. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@82 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
9f779533d1
commit
a113522344
|
@ -50,3 +50,4 @@ Date | CEF Revision | Chromium Revision
|
|||
2010-01-11 | /trunk@65 | /trunk@35902
|
||||
2010-02-11 | /trunk@71 | /trunk@38776
|
||||
2010-03-29 | /trunk@72 | /trunk@42941
|
||||
2010-06-21 | /trunk@82 | /trunk@50325
|
||||
|
|
21
cef.gyp
21
cef.gyp
|
@ -146,11 +146,11 @@
|
|||
'../third_party/WebKit/WebCore/WebCore.gyp/WebCore.gyp:webcore',
|
||||
'../third_party/WebKit/WebKit/chromium/WebKit.gyp:webkit',
|
||||
'../third_party/zlib/zlib.gyp:zlib',
|
||||
'../webkit/webkit.gyp:appcache',
|
||||
'../webkit/webkit.gyp:database',
|
||||
'../webkit/webkit.gyp:glue',
|
||||
'../webkit/webkit.gyp:webkit_resources',
|
||||
'../webkit/webkit.gyp:webkit_strings',
|
||||
'../webkit/support/webkit_support.gyp:appcache',
|
||||
'../webkit/support/webkit_support.gyp:database',
|
||||
'../webkit/support/webkit_support.gyp:glue',
|
||||
'../webkit/support/webkit_support.gyp:webkit_resources',
|
||||
'../webkit/support/webkit_support.gyp:webkit_strings',
|
||||
'libcef_static',
|
||||
],
|
||||
'defines': [
|
||||
|
@ -281,6 +281,7 @@
|
|||
'include_dirs': [
|
||||
'.',
|
||||
'..',
|
||||
'../third_party/WebKit/WebKit/chromium/public'
|
||||
],
|
||||
'dependencies': [
|
||||
'../app/app.gyp:app_base',
|
||||
|
@ -307,11 +308,11 @@
|
|||
'../third_party/WebKit/WebCore/WebCore.gyp/WebCore.gyp:webcore',
|
||||
'../third_party/WebKit/WebKit/chromium/WebKit.gyp:webkit',
|
||||
'../third_party/zlib/zlib.gyp:zlib',
|
||||
'../webkit/webkit.gyp:appcache',
|
||||
'../webkit/webkit.gyp:database',
|
||||
'../webkit/webkit.gyp:glue',
|
||||
'../webkit/webkit.gyp:webkit_resources',
|
||||
'../webkit/webkit.gyp:webkit_strings',
|
||||
'../webkit/support/webkit_support.gyp:appcache',
|
||||
'../webkit/support/webkit_support.gyp:database',
|
||||
'../webkit/support/webkit_support.gyp:glue',
|
||||
'../webkit/support/webkit_support.gyp:webkit_resources',
|
||||
'../webkit/support/webkit_support.gyp:webkit_strings',
|
||||
],
|
||||
'sources': [
|
||||
'include/cef.h',
|
||||
|
|
|
@ -99,6 +99,47 @@ class BrowserFrontendProxy
|
|||
NOTREACHED();
|
||||
}
|
||||
|
||||
virtual void OnProgressEventRaised(const std::vector<int>& host_ids,
|
||||
const GURL& url,
|
||||
int num_total, int num_complete) {
|
||||
if (!system_)
|
||||
return;
|
||||
if (system_->is_io_thread())
|
||||
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &BrowserFrontendProxy::OnProgressEventRaised, host_ids, url, num_total, num_complete));
|
||||
else if (system_->is_ui_thread())
|
||||
system_->frontend_impl_.OnProgressEventRaised(host_ids, url, num_total, num_complete);
|
||||
else
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
virtual void OnContentBlocked(int host_id){
|
||||
if (!system_)
|
||||
return;
|
||||
if (system_->is_io_thread())
|
||||
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &BrowserFrontendProxy::OnContentBlocked, host_id));
|
||||
else if (system_->is_ui_thread())
|
||||
system_->frontend_impl_.OnContentBlocked(host_id);
|
||||
else
|
||||
NOTREACHED();
|
||||
|
||||
}
|
||||
|
||||
virtual void OnLogMessage(int host_id, appcache::LogLevel log_level,
|
||||
const std::string& message) {
|
||||
|
||||
if (!system_)
|
||||
return;
|
||||
if (system_->is_io_thread())
|
||||
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &BrowserFrontendProxy::OnLogMessage, host_id, log_level, message));
|
||||
else if (system_->is_ui_thread())
|
||||
system_->frontend_impl_.OnLogMessage(host_id, log_level, message);
|
||||
else
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<BrowserFrontendProxy>;
|
||||
|
||||
|
@ -164,6 +205,36 @@ class BrowserBackendProxy
|
|||
}
|
||||
}
|
||||
|
||||
virtual void SelectCacheForWorker(
|
||||
int host_id,
|
||||
int parent_process_id,
|
||||
int parent_host_id) {
|
||||
|
||||
if (system_->is_ui_thread()) {
|
||||
system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &BrowserBackendProxy::SelectCacheForWorker, host_id, parent_process_id,
|
||||
parent_host_id));
|
||||
} else if (system_->is_io_thread()) {
|
||||
system_->backend_impl_->SelectCacheForWorker(host_id, parent_process_id,
|
||||
parent_host_id);
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SelectCacheForSharedWorker(
|
||||
int host_id,
|
||||
int64 appcache_id){
|
||||
if (system_->is_ui_thread()) {
|
||||
system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &BrowserBackendProxy::SelectCacheForSharedWorker, host_id, appcache_id));
|
||||
} else if (system_->is_io_thread()) {
|
||||
system_->backend_impl_->SelectCacheForSharedWorker(host_id, appcache_id);
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void MarkAsForeignEntry(int host_id, const GURL& document_url,
|
||||
int64 cache_document_was_loaded_from) {
|
||||
if (system_->is_ui_thread()) {
|
||||
|
@ -303,7 +374,7 @@ BrowserAppCacheSystem::~BrowserAppCacheSystem() {
|
|||
void BrowserAppCacheSystem::InitOnUIThread(
|
||||
const FilePath& cache_directory) {
|
||||
DCHECK(!ui_message_loop_);
|
||||
AppCacheThread::Init(DB_THREAD_ID, IO_THREAD_ID, NULL);
|
||||
AppCacheThread::Init(DB_THREAD_ID, IO_THREAD_ID);
|
||||
ui_message_loop_ = MessageLoop::current();
|
||||
cache_directory_ = cache_directory;
|
||||
}
|
||||
|
@ -322,7 +393,8 @@ void BrowserAppCacheSystem::InitOnIOThread(URLRequestContext* request_context) {
|
|||
// Recreate and initialize per each IO thread.
|
||||
service_ = new appcache::AppCacheService();
|
||||
backend_impl_ = new appcache::AppCacheBackendImpl();
|
||||
service_->Initialize(cache_directory_);
|
||||
service_->Initialize(cache_directory_,
|
||||
BrowserResourceLoaderBridge::GetCacheThread());
|
||||
service_->set_request_context(request_context);
|
||||
backend_impl_->Initialize(service_, frontend_proxy_.get(), kSingleProcessId);
|
||||
|
||||
|
@ -364,7 +436,6 @@ void BrowserAppCacheSystem::GetExtraResponseBits(
|
|||
|
||||
void BrowserAppCacheSystem::WillDestroyCurrentMessageLoop() {
|
||||
DCHECK(is_io_thread());
|
||||
DCHECK(backend_impl_->hosts().empty());
|
||||
|
||||
delete backend_impl_;
|
||||
delete service_;
|
||||
|
|
|
@ -34,7 +34,7 @@ BrowserDatabaseSystem* BrowserDatabaseSystem::GetInstance() {
|
|||
BrowserDatabaseSystem::BrowserDatabaseSystem()
|
||||
: waiting_for_dbs_to_close_(false) {
|
||||
temp_dir_.CreateUniqueTempDir();
|
||||
db_tracker_ = new DatabaseTracker(temp_dir_.path());
|
||||
db_tracker_ = new DatabaseTracker(temp_dir_.path(), false);
|
||||
db_tracker_->AddObserver(this);
|
||||
DCHECK(!instance_);
|
||||
instance_ = this;
|
||||
|
@ -46,18 +46,14 @@ BrowserDatabaseSystem::~BrowserDatabaseSystem() {
|
|||
}
|
||||
|
||||
base::PlatformFile BrowserDatabaseSystem::OpenFile(
|
||||
const string16& vfs_file_name, int desired_flags,
|
||||
base::PlatformFile* dir_handle) {
|
||||
const string16& vfs_file_name, int desired_flags) {
|
||||
base::PlatformFile file_handle = base::kInvalidPlatformFileValue;
|
||||
FilePath file_name = GetFullFilePathForVfsFile(vfs_file_name);
|
||||
if (file_name.empty()) {
|
||||
VfsBackend::OpenTempFileInDirectory(
|
||||
db_tracker_->DatabaseDirectory(), desired_flags,
|
||||
base::GetCurrentProcessHandle(), &file_handle, dir_handle);
|
||||
db_tracker_->DatabaseDirectory(), desired_flags, &file_handle);
|
||||
} else {
|
||||
VfsBackend::OpenFile(file_name, desired_flags,
|
||||
base::GetCurrentProcessHandle(), &file_handle,
|
||||
dir_handle);
|
||||
VfsBackend::OpenFile(file_name, desired_flags, &file_handle);
|
||||
}
|
||||
|
||||
return file_handle;
|
||||
|
@ -161,7 +157,7 @@ void BrowserDatabaseSystem::databaseClosed(const WebKit::WebDatabase& database)
|
|||
void BrowserDatabaseSystem::ClearAllDatabases() {
|
||||
// Wait for all databases to be closed.
|
||||
if (!database_connections_.IsEmpty()) {
|
||||
AutoReset waiting_for_dbs_auto_reset(&waiting_for_dbs_to_close_, true);
|
||||
AutoReset<bool> waiting_for_dbs_auto_reset(&waiting_for_dbs_to_close_, true);
|
||||
MessageLoop::ScopedNestableTaskAllower nestable(MessageLoop::current());
|
||||
MessageLoop::current()->Run();
|
||||
}
|
||||
|
|
|
@ -24,9 +24,7 @@ class BrowserDatabaseSystem : public webkit_database::DatabaseTracker::Observer,
|
|||
~BrowserDatabaseSystem();
|
||||
|
||||
// VFS functions
|
||||
base::PlatformFile OpenFile(const string16& vfs_file_name,
|
||||
int desired_flags,
|
||||
base::PlatformFile* dir_handle);
|
||||
base::PlatformFile OpenFile(const string16& vfs_file_name, int desired_flags);
|
||||
int DeleteFile(const string16& vfs_file_name, bool sync_dir);
|
||||
long GetFileAttributes(const string16& vfs_file_name);
|
||||
long long GetFileSize(const string16& vfs_file_name);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include "browser_request_context.h"
|
||||
|
||||
#include "browser_resource_loader_bridge.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
#include "base/file_path.h"
|
||||
|
@ -51,16 +51,15 @@ void BrowserRequestContext::Init(
|
|||
|
||||
http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault();
|
||||
|
||||
net::HttpCache *cache;
|
||||
if (cache_path.empty()) {
|
||||
cache = new net::HttpCache(NULL, host_resolver_, proxy_service_,
|
||||
ssl_config_service_, http_auth_handler_factory_,
|
||||
0);
|
||||
} else {
|
||||
cache = new net::HttpCache(NULL, host_resolver_, proxy_service_,
|
||||
ssl_config_service_, http_auth_handler_factory_,
|
||||
cache_path, 0);
|
||||
}
|
||||
net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend(
|
||||
cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE,
|
||||
cache_path, 0, BrowserResourceLoaderBridge::GetCacheThread());
|
||||
|
||||
net::HttpCache* cache =
|
||||
new net::HttpCache(NULL, host_resolver_, proxy_service_,
|
||||
ssl_config_service_, http_auth_handler_factory_,
|
||||
NULL, NULL, backend);
|
||||
|
||||
cache->set_mode(cache_mode);
|
||||
http_transaction_factory_ = cache;
|
||||
|
||||
|
@ -78,3 +77,4 @@ const std::string& BrowserRequestContext::GetUserAgent(
|
|||
const GURL& url) const {
|
||||
return webkit_glue::GetUserAgent(url);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2008 The Chromium Embedded Framework Authors.
|
||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
@ -38,26 +38,31 @@
|
|||
#include "browser_impl.h"
|
||||
#include "request_impl.h"
|
||||
|
||||
#include "base/file_path.h"
|
||||
#include "base/message_loop.h"
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#include "base/nss_util.h"
|
||||
#endif
|
||||
#include "base/ref_counted.h"
|
||||
#include "base/time.h"
|
||||
#include "base/timer.h"
|
||||
#include "base/thread.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
#include "base/waitable_event.h"
|
||||
#include "net/base/cookie_policy.h"
|
||||
#include "net/base/io_buffer.h"
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "net/base/net_util.h"
|
||||
#include "net/base/static_cookie_policy.h"
|
||||
#include "net/base/upload_data.h"
|
||||
#include "net/http/http_cache.h"
|
||||
#include "net/http/http_request_headers.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/http/http_util.h"
|
||||
#include "net/proxy/proxy_service.h"
|
||||
#if defined(OS_WIN)
|
||||
#include "net/socket/ssl_client_socket_nss_factory.h"
|
||||
#endif
|
||||
#include "net/url_request/url_request.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebView.h"
|
||||
#include "webkit/appcache/appcache_interfaces.h"
|
||||
#include "webkit/glue/resource_loader_bridge.h"
|
||||
|
||||
|
@ -65,12 +70,30 @@ using webkit_glue::ResourceLoaderBridge;
|
|||
using net::HttpResponseHeaders;
|
||||
using net::StaticCookiePolicy;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
struct BrowserRequestContextParams {
|
||||
BrowserRequestContextParams(
|
||||
const FilePath& in_cache_path,
|
||||
net::HttpCache::Mode in_cache_mode,
|
||||
bool in_no_proxy)
|
||||
: cache_path(in_cache_path),
|
||||
cache_mode(in_cache_mode),
|
||||
no_proxy(in_no_proxy),
|
||||
accept_all_cookies(false) {}
|
||||
|
||||
URLRequestContext* request_context = NULL;
|
||||
base::Thread* io_thread = NULL;
|
||||
FilePath cache_path;
|
||||
net::HttpCache::Mode cache_mode;
|
||||
bool no_proxy;
|
||||
bool accept_all_cookies;
|
||||
};
|
||||
|
||||
BrowserRequestContextParams* g_request_context_params = NULL;
|
||||
URLRequestContext* g_request_context = NULL;
|
||||
base::Thread* g_cache_thread = NULL;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class IOThread : public base::Thread {
|
||||
public:
|
||||
|
@ -84,19 +107,44 @@ class IOThread : public base::Thread {
|
|||
}
|
||||
|
||||
virtual void Init() {
|
||||
BrowserAppCacheSystem::InitializeOnIOThread(request_context);
|
||||
BrowserSocketStreamBridge::InitializeOnIOThread(request_context);
|
||||
if (g_request_context_params) {
|
||||
g_request_context = new BrowserRequestContext(
|
||||
g_request_context_params->cache_path,
|
||||
g_request_context_params->cache_mode,
|
||||
g_request_context_params->no_proxy);
|
||||
SetAcceptAllCookies(g_request_context_params->accept_all_cookies);
|
||||
delete g_request_context_params;
|
||||
g_request_context_params = NULL;
|
||||
} else {
|
||||
g_request_context = new BrowserRequestContext();
|
||||
SetAcceptAllCookies(false);
|
||||
}
|
||||
|
||||
g_request_context->AddRef();
|
||||
|
||||
BrowserAppCacheSystem::InitializeOnIOThread(g_request_context);
|
||||
BrowserSocketStreamBridge::InitializeOnIOThread(g_request_context);
|
||||
}
|
||||
|
||||
virtual void CleanUp() {
|
||||
BrowserSocketStreamBridge::Cleanup();
|
||||
if (request_context) {
|
||||
request_context->Release();
|
||||
request_context = NULL;
|
||||
if (g_request_context) {
|
||||
g_request_context->Release();
|
||||
g_request_context = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void SetAcceptAllCookies(bool accept_all_cookies) {
|
||||
StaticCookiePolicy::Type policy_type = accept_all_cookies ?
|
||||
StaticCookiePolicy::ALLOW_ALL_COOKIES :
|
||||
StaticCookiePolicy::BLOCK_THIRD_PARTY_COOKIES;
|
||||
static_cast<StaticCookiePolicy*>(g_request_context->cookie_policy())->
|
||||
set_type(policy_type);
|
||||
}
|
||||
};
|
||||
|
||||
IOThread* g_io_thread = NULL;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct RequestParams {
|
||||
|
@ -137,13 +185,13 @@ class RequestProxy : public URLRequest::Delegate,
|
|||
owner_loop_ = MessageLoop::current();
|
||||
|
||||
// proxy over to the io thread
|
||||
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &RequestProxy::AsyncStart, params));
|
||||
}
|
||||
|
||||
void Cancel() {
|
||||
// proxy over to the io thread
|
||||
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &RequestProxy::AsyncCancel));
|
||||
}
|
||||
|
||||
|
@ -153,7 +201,7 @@ class RequestProxy : public URLRequest::Delegate,
|
|||
virtual ~RequestProxy() {
|
||||
// If we have a request, then we'd better be on the io thread!
|
||||
DCHECK(!request_.get() ||
|
||||
MessageLoop::current() == io_thread->message_loop());
|
||||
MessageLoop::current() == g_io_thread->message_loop());
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
@ -161,11 +209,6 @@ class RequestProxy : public URLRequest::Delegate,
|
|||
// various URLRequest callbacks. The event hooks, defined below, trigger
|
||||
// these methods asynchronously.
|
||||
|
||||
void NotifyUploadProgress(uint64 position, uint64 size) {
|
||||
if (peer_)
|
||||
peer_->OnUploadProgress(position, size);
|
||||
}
|
||||
|
||||
void NotifyReceivedRedirect(const GURL& new_url,
|
||||
const ResourceLoaderBridge::ResponseInfo& info) {
|
||||
bool has_new_first_party_for_cookies = false;
|
||||
|
@ -173,7 +216,7 @@ class RequestProxy : public URLRequest::Delegate,
|
|||
if (peer_ && peer_->OnReceivedRedirect(new_url, info,
|
||||
&has_new_first_party_for_cookies,
|
||||
&new_first_party_for_cookies)) {
|
||||
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &RequestProxy::AsyncFollowDeferredRedirect,
|
||||
has_new_first_party_for_cookies, new_first_party_for_cookies));
|
||||
} else {
|
||||
|
@ -202,7 +245,7 @@ class RequestProxy : public URLRequest::Delegate,
|
|||
// peer could generate new requests in reponse to the received data, which
|
||||
// when run on the io thread, could race against this function in doing
|
||||
// another InvokeLater. See bug 769249.
|
||||
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &RequestProxy::AsyncReadData));
|
||||
|
||||
peer_->OnReceivedData(buf_copy.get(), bytes_read);
|
||||
|
@ -216,6 +259,11 @@ class RequestProxy : public URLRequest::Delegate,
|
|||
}
|
||||
}
|
||||
|
||||
void NotifyUploadProgress(uint64 position, uint64 size) {
|
||||
if (peer_)
|
||||
peer_->OnUploadProgress(position, size);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// The following methods are called on the io thread. They correspond to
|
||||
// actions performed on the owner's thread.
|
||||
|
@ -295,10 +343,12 @@ class RequestProxy : public URLRequest::Delegate,
|
|||
request_->set_method(params->method);
|
||||
request_->set_first_party_for_cookies(params->first_party_for_cookies);
|
||||
request_->set_referrer(params->referrer.spec());
|
||||
request_->SetExtraRequestHeaders(params->headers);
|
||||
net::HttpRequestHeaders headers;
|
||||
headers.AddHeadersFromString(params->headers);
|
||||
request_->SetExtraRequestHeaders(headers);
|
||||
request_->set_load_flags(params->load_flags);
|
||||
request_->set_upload(params->upload.get());
|
||||
request_->set_context(request_context);
|
||||
request_->set_context(g_request_context);
|
||||
BrowserAppCacheSystem::SetExtraRequestInfo(
|
||||
request_.get(), params->appcache_host_id, params->request_type);
|
||||
|
||||
|
@ -448,7 +498,7 @@ class RequestProxy : public URLRequest::Delegate,
|
|||
MaybeUpdateUploadProgress();
|
||||
upload_progress_timer_.Stop();
|
||||
}
|
||||
|
||||
DCHECK(request_.get());
|
||||
OnCompletedRequest(request_->status(), std::string());
|
||||
request_.reset(); // destroy on the io thread
|
||||
}
|
||||
|
@ -606,7 +656,7 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge {
|
|||
if (proxy_) {
|
||||
proxy_->DropPeer();
|
||||
// Let the proxy die on the IO thread
|
||||
io_thread->message_loop()->ReleaseSoon(FROM_HERE, proxy_);
|
||||
g_io_thread->message_loop()->ReleaseSoon(FROM_HERE, proxy_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -695,8 +745,8 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge {
|
|||
class CookieSetter : public base::RefCountedThreadSafe<CookieSetter> {
|
||||
public:
|
||||
void Set(const GURL& url, const std::string& cookie) {
|
||||
DCHECK(MessageLoop::current() == io_thread->message_loop());
|
||||
request_context->cookie_store()->SetCookie(url, cookie);
|
||||
DCHECK(MessageLoop::current() == g_io_thread->message_loop());
|
||||
g_request_context->cookie_store()->SetCookie(url, cookie);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -711,7 +761,7 @@ class CookieGetter : public base::RefCountedThreadSafe<CookieGetter> {
|
|||
}
|
||||
|
||||
void Get(const GURL& url) {
|
||||
result_ = request_context->cookie_store()->GetCookies(url);
|
||||
result_ = g_request_context->cookie_store()->GetCookies(url);
|
||||
event_.Signal();
|
||||
}
|
||||
|
||||
|
@ -747,14 +797,15 @@ ResourceLoaderBridge* ResourceLoaderBridge::Create(
|
|||
// Issue the proxy resolve request on the io thread, and wait
|
||||
// for the result.
|
||||
bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
|
||||
DCHECK(request_context);
|
||||
DCHECK(g_request_context);
|
||||
|
||||
scoped_refptr<net::SyncProxyServiceHelper> sync_proxy_service(
|
||||
new net::SyncProxyServiceHelper(io_thread->message_loop(),
|
||||
request_context->proxy_service()));
|
||||
new net::SyncProxyServiceHelper(g_io_thread->message_loop(),
|
||||
g_request_context->proxy_service()));
|
||||
|
||||
net::ProxyInfo proxy_info;
|
||||
int rv = sync_proxy_service->ResolveProxy(url, &proxy_info, NULL);
|
||||
int rv = sync_proxy_service->ResolveProxy(url, &proxy_info,
|
||||
net::BoundNetLog());
|
||||
if (rv == net::OK) {
|
||||
*proxy_list = proxy_info.ToPacString();
|
||||
}
|
||||
|
@ -767,34 +818,43 @@ bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
// static
|
||||
void BrowserResourceLoaderBridge::Init(BrowserRequestContext* context) {
|
||||
void BrowserResourceLoaderBridge::Init(
|
||||
const FilePath& cache_path,
|
||||
net::HttpCache::Mode cache_mode,
|
||||
bool no_proxy) {
|
||||
// Make sure to stop any existing IO thread since it may be using the
|
||||
// current request context.
|
||||
Shutdown();
|
||||
|
||||
if (context) {
|
||||
request_context = context;
|
||||
} else {
|
||||
request_context = new BrowserRequestContext();
|
||||
}
|
||||
request_context->AddRef();
|
||||
BrowserResourceLoaderBridge::SetAcceptAllCookies(false);
|
||||
DCHECK(!g_request_context_params);
|
||||
DCHECK(!g_request_context);
|
||||
DCHECK(!g_io_thread);
|
||||
|
||||
g_request_context_params = new BrowserRequestContextParams(
|
||||
cache_path, cache_mode, no_proxy);
|
||||
}
|
||||
|
||||
// static
|
||||
void BrowserResourceLoaderBridge::Shutdown() {
|
||||
if (io_thread) {
|
||||
delete io_thread;
|
||||
io_thread = NULL;
|
||||
if (g_io_thread) {
|
||||
delete g_io_thread;
|
||||
g_io_thread = NULL;
|
||||
|
||||
DCHECK(!request_context) << "should have been nulled by thread dtor";
|
||||
DCHECK(g_cache_thread);
|
||||
delete g_cache_thread;
|
||||
g_cache_thread = NULL;
|
||||
|
||||
DCHECK(!g_request_context) << "should have been nulled by thread dtor";
|
||||
} else {
|
||||
delete g_request_context_params;
|
||||
g_request_context_params = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void BrowserResourceLoaderBridge::SetCookie(const GURL& url,
|
||||
const GURL& first_party_for_cookies,
|
||||
const std::string& cookie) {
|
||||
const GURL& first_party_for_cookies,
|
||||
const std::string& cookie) {
|
||||
// Proxy to IO thread to synchronize w/ network loading.
|
||||
|
||||
if (!EnsureIOThread()) {
|
||||
|
@ -803,7 +863,7 @@ void BrowserResourceLoaderBridge::SetCookie(const GURL& url,
|
|||
}
|
||||
|
||||
scoped_refptr<CookieSetter> cookie_setter = new CookieSetter();
|
||||
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
cookie_setter.get(), &CookieSetter::Set, url, cookie));
|
||||
}
|
||||
|
||||
|
@ -819,7 +879,7 @@ std::string BrowserResourceLoaderBridge::GetCookies(
|
|||
|
||||
scoped_refptr<CookieGetter> getter = new CookieGetter();
|
||||
|
||||
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
getter.get(), &CookieGetter::Get, url));
|
||||
|
||||
return getter->GetResult();
|
||||
|
@ -827,23 +887,46 @@ std::string BrowserResourceLoaderBridge::GetCookies(
|
|||
|
||||
// static
|
||||
bool BrowserResourceLoaderBridge::EnsureIOThread() {
|
||||
if (io_thread)
|
||||
if (g_io_thread)
|
||||
return true;
|
||||
|
||||
if (!request_context)
|
||||
BrowserResourceLoaderBridge::Init(NULL);
|
||||
#if defined(OS_WIN)
|
||||
// Use NSS for SSL on Windows. TODO(wtc): this should eventually be hidden
|
||||
// inside DefaultClientSocketFactory::CreateSSLClientSocket.
|
||||
net::ClientSocketFactory::SetSSLClientSocketFactory(
|
||||
net::SSLClientSocketNSSFactory);
|
||||
#endif
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
// We want to be sure to init NSPR on the main thread.
|
||||
base::EnsureNSPRInit();
|
||||
#endif
|
||||
|
||||
io_thread = new IOThread();
|
||||
// Create the cache thread. We want the cache thread to outlive the IO thread,
|
||||
// so its lifetime is bonded to the IO thread lifetime.
|
||||
DCHECK(!g_cache_thread);
|
||||
g_cache_thread = new base::Thread("cache");
|
||||
CHECK(g_cache_thread->StartWithOptions(
|
||||
base::Thread::Options(MessageLoop::TYPE_IO, 0)));
|
||||
|
||||
g_io_thread = new IOThread();
|
||||
base::Thread::Options options;
|
||||
options.message_loop_type = MessageLoop::TYPE_IO;
|
||||
return io_thread->StartWithOptions(options);
|
||||
return g_io_thread->StartWithOptions(options);
|
||||
}
|
||||
|
||||
// static
|
||||
void BrowserResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) {
|
||||
StaticCookiePolicy::Type policy_type = accept_all_cookies ?
|
||||
StaticCookiePolicy::ALLOW_ALL_COOKIES :
|
||||
StaticCookiePolicy::BLOCK_THIRD_PARTY_COOKIES;
|
||||
static_cast<StaticCookiePolicy*>(request_context->cookie_policy())->
|
||||
set_type(policy_type);
|
||||
if (g_request_context_params) {
|
||||
g_request_context_params->accept_all_cookies = accept_all_cookies;
|
||||
DCHECK(!g_request_context);
|
||||
DCHECK(!g_io_thread);
|
||||
} else {
|
||||
g_io_thread->SetAcceptAllCookies(accept_all_cookies);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
scoped_refptr<base::MessageLoopProxy>
|
||||
BrowserResourceLoaderBridge::GetCacheThread() {
|
||||
return g_cache_thread->message_loop_proxy();
|
||||
}
|
||||
|
|
|
@ -7,23 +7,23 @@
|
|||
#define _BROWSER_RESOURCE_LOADER_BRIDGE_H
|
||||
|
||||
#include <string>
|
||||
#include "base/message_loop_proxy.h"
|
||||
#include "base/file_path.h"
|
||||
#include "net/http/http_cache.h"
|
||||
|
||||
class GURL;
|
||||
class BrowserRequestContext;
|
||||
|
||||
class BrowserResourceLoaderBridge {
|
||||
public:
|
||||
// Call this function to initialize the simple resource loader bridge. If
|
||||
// the given context is null, then a default BrowserRequestContext will be
|
||||
// instantiated. Otherwise, a reference is taken to the given request
|
||||
// context, which will be released when Shutdown is called. The caller
|
||||
// should not hold another reference to the request context! It is safe to
|
||||
// call this function multiple times.
|
||||
// Call this function to initialize the simple resource loader bridge.
|
||||
// It is safe to call this function multiple times.
|
||||
//
|
||||
// NOTE: If this function is not called, then a default request context will
|
||||
// be initialized lazily.
|
||||
//
|
||||
static void Init(BrowserRequestContext* context);
|
||||
static void Init(const FilePath& cache_path,
|
||||
net::HttpCache::Mode cache_mode,
|
||||
bool no_proxy);
|
||||
|
||||
// Call this function to shutdown the simple resource loader bridge.
|
||||
static void Shutdown();
|
||||
|
@ -36,6 +36,9 @@ class BrowserResourceLoaderBridge {
|
|||
const GURL& first_party_for_cookies);
|
||||
static bool EnsureIOThread();
|
||||
static void SetAcceptAllCookies(bool accept_all_cookies);
|
||||
|
||||
// This method should only be called after Init(), and before Shutdown().
|
||||
static scoped_refptr<base::MessageLoopProxy> GetCacheThread();
|
||||
};
|
||||
|
||||
#endif // _BROWSER_RESOURCE_LOADER_BRIDGE_H
|
||||
|
|
|
@ -98,12 +98,6 @@ base::StringPiece GetDataResource(int resource_id) {
|
|||
static_cast<base::StringPiece::size_type>(
|
||||
sizeof(broken_image_data) / sizeof(unsigned char)));
|
||||
}
|
||||
case IDR_FEED_PREVIEW:
|
||||
// It is necessary to return a feed preview template that contains
|
||||
// a {{URL}} substring where the feed URL should go; see the code
|
||||
// that computes feed previews in feed_preview.cc:MakeFeedPreview.
|
||||
// This fixes issue #932714.
|
||||
return "Feed preview for {{URL}}";
|
||||
case IDR_TEXTAREA_RESIZER: {
|
||||
// Use webkit's text area resizer image.
|
||||
static unsigned char area_resizer_data[] = {
|
||||
|
@ -209,4 +203,9 @@ std::string WebStringToStdString(const WebKit::WebString& str) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::string GetProductVersion() {
|
||||
return std::string("CEF/0.0.0.0");
|
||||
}
|
||||
|
||||
|
||||
} // namespace webkit_glue
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "webkit/database/vfs_backend.h"
|
||||
#include "webkit/extensions/v8/gears_extension.h"
|
||||
#include "webkit/extensions/v8/interval_extension.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebCString.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebData.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
|
||||
|
@ -25,11 +24,12 @@
|
|||
#include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebIndexedDatabase.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
|
||||
#include "webkit/glue/simple_webmimeregistry_impl.h"
|
||||
#include "webkit/glue/webclipboard_impl.h"
|
||||
#include "webkit/glue/webfilesystem_impl.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
#include "webkit/glue/webkitclient_impl.h"
|
||||
#include "browser_appcache_system.h"
|
||||
|
@ -53,6 +53,10 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
WebKit::WebRuntimeFeatures::enableApplicationCache(true);
|
||||
WebKit::WebRuntimeFeatures::enableDatabase(true);
|
||||
WebKit::WebRuntimeFeatures::enableWebGL(true);
|
||||
WebKit::WebRuntimeFeatures::enablePushState(true);
|
||||
WebKit::WebRuntimeFeatures::enableNotifications(true);
|
||||
WebKit::WebRuntimeFeatures::enableTouch(true);
|
||||
WebKit::WebRuntimeFeatures::enableIndexedDatabase(true);
|
||||
WebKit::WebRuntimeFeatures::enableGeolocation(false);
|
||||
|
||||
// Load libraries for media and enable the media player.
|
||||
|
@ -73,6 +77,8 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
BrowserAppCacheSystem::InitializeOnUIThread(appcache_dir_.path());
|
||||
|
||||
WebKit::WebDatabase::setObserver(&database_system_);
|
||||
|
||||
file_system_.set_sandbox_enabled(false);
|
||||
}
|
||||
|
||||
~BrowserWebKitInit() {
|
||||
|
@ -87,6 +93,10 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
return &clipboard_;
|
||||
}
|
||||
|
||||
virtual WebKit::WebFileSystem* fileSystem() {
|
||||
return &file_system_;
|
||||
}
|
||||
|
||||
virtual WebKit::WebSandboxSupport* sandboxSupport() {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -100,10 +110,9 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
}
|
||||
|
||||
virtual WebKit::WebKitClient::FileHandle databaseOpenFile(
|
||||
const WebKit::WebString& vfs_file_name, int desired_flags,
|
||||
WebKit::WebKitClient::FileHandle* dir_handle) {
|
||||
const WebKit::WebString& vfs_file_name, int desired_flags) {
|
||||
return BrowserDatabaseSystem::GetInstance()->OpenFile(
|
||||
vfs_file_name, desired_flags, dir_handle);
|
||||
vfs_file_name, desired_flags);
|
||||
}
|
||||
|
||||
virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
|
||||
|
@ -123,12 +132,6 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
return BrowserDatabaseSystem::GetInstance()->GetFileSize(vfs_file_name);
|
||||
}
|
||||
|
||||
virtual bool getFileSize(const WebKit::WebString& path, long long& result) {
|
||||
return file_util::GetFileSize(
|
||||
webkit_glue::WebStringToFilePath(path),
|
||||
reinterpret_cast<int64*>(&result));
|
||||
}
|
||||
|
||||
virtual unsigned long long visitedLinkHash(const char* canonicalURL,
|
||||
size_t length) {
|
||||
return 0;
|
||||
|
@ -172,28 +175,17 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
virtual WebKit::WebStorageNamespace* createLocalStorageNamespace(
|
||||
const WebKit::WebString& path, unsigned quota) {
|
||||
return WebKit::WebStorageNamespace::createLocalStorageNamespace(path,
|
||||
quota);
|
||||
WebKit::WebStorageNamespace::m_localStorageQuota);
|
||||
}
|
||||
|
||||
void dispatchStorageEvent(const WebKit::WebString& key,
|
||||
const WebKit::WebString& old_value, const WebKit::WebString& new_value,
|
||||
const WebKit::WebString& origin, const WebKit::WebURL& url,
|
||||
bool is_local_storage) {
|
||||
// The event is dispatched by the proxy.
|
||||
}
|
||||
|
||||
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
|
||||
WebKit::WebApplicationCacheHostClient* client) {
|
||||
return BrowserAppCacheSystem::CreateApplicationCacheHost(client);
|
||||
}
|
||||
|
||||
virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository() {
|
||||
return NULL;
|
||||
virtual WebKit::WebIndexedDatabase* indexedDatabase() {
|
||||
return WebKit::WebIndexedDatabase::create();
|
||||
}
|
||||
|
||||
private:
|
||||
webkit_glue::SimpleWebMimeRegistryImpl mime_registry_;
|
||||
webkit_glue::WebClipboardImpl clipboard_;
|
||||
webkit_glue::WebFileSystemImpl file_system_;
|
||||
ScopedTempDir appcache_dir_;
|
||||
BrowserAppCacheSystem appcache_system_;
|
||||
BrowserDatabaseSystem database_system_;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
// have initialized a MessageLoop before these methods are called.
|
||||
|
||||
#include "browser_webview_delegate.h"
|
||||
#include "browser_appcache_system.h"
|
||||
#include "browser_impl.h"
|
||||
#include "browser_navigation_controller.h"
|
||||
#include "context.h"
|
||||
|
@ -15,7 +16,7 @@
|
|||
#include "v8_impl.h"
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/gfx/point.h"
|
||||
#include "gfx/point.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/process_util.h"
|
||||
#include "base/trace_event.h"
|
||||
|
@ -36,6 +37,7 @@
|
|||
#include "third_party/WebKit/WebKit/chromium/public/WebNode.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebPopupMenu.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebRange.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h"
|
||||
|
@ -53,7 +55,7 @@
|
|||
#include "webkit/glue/media/simple_data_source.h"
|
||||
#include "webkit/glue/media/video_renderer_impl.h"
|
||||
#include "webkit/glue/webdropdata.h"
|
||||
#include "webkit/glue/webplugin_impl.h"
|
||||
#include "webkit/glue/plugins/webplugin_impl.h"
|
||||
#include "webkit/glue/webpreferences.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
#include "webkit/glue/plugins/plugin_list.h"
|
||||
|
@ -69,6 +71,8 @@
|
|||
#endif
|
||||
|
||||
using appcache::WebApplicationCacheHostImpl;
|
||||
using WebKit::WebApplicationCacheHost;
|
||||
using WebKit::WebApplicationCacheHostClient;
|
||||
using WebKit::WebConsoleMessage;
|
||||
using WebKit::WebContextMenuData;
|
||||
using WebKit::WebCookieJar;
|
||||
|
@ -81,6 +85,7 @@ using WebKit::WebFileChooserParams;
|
|||
using WebKit::WebFormElement;
|
||||
using WebKit::WebFrame;
|
||||
using WebKit::WebHistoryItem;
|
||||
using WebKit::WebImage;
|
||||
using WebKit::WebMediaPlayer;
|
||||
using WebKit::WebMediaPlayerClient;
|
||||
using WebKit::WebNavigationType;
|
||||
|
@ -90,6 +95,7 @@ using WebKit::WebPlugin;
|
|||
using WebKit::WebPluginParams;
|
||||
using WebKit::WebPoint;
|
||||
using WebKit::WebPopupMenu;
|
||||
using WebKit::WebPopupType;
|
||||
using WebKit::WebRange;
|
||||
using WebKit::WebRect;
|
||||
using WebKit::WebScreenInfo;
|
||||
|
@ -106,6 +112,7 @@ using WebKit::WebURLResponse;
|
|||
using WebKit::WebVector;
|
||||
using WebKit::WebView;
|
||||
using WebKit::WebWidget;
|
||||
using WebKit::WebWindowFeatures;
|
||||
using WebKit::WebWorker;
|
||||
using WebKit::WebWorkerClient;
|
||||
using WebKit::WebKeyboardEvent;
|
||||
|
@ -133,20 +140,25 @@ void BrowserWebViewDelegate::SetUserStyleSheetLocation(const GURL& location) {
|
|||
|
||||
// WebViewClient -------------------------------------------------------------
|
||||
|
||||
WebView* BrowserWebViewDelegate::createView(WebFrame* creator) {
|
||||
WebView* BrowserWebViewDelegate::createView(WebFrame* creator,
|
||||
const WebWindowFeatures& features,
|
||||
const WebString& name) {
|
||||
CefRefPtr<CefBrowserImpl> browser =
|
||||
browser_->UIT_CreatePopupWindow(std::wstring());
|
||||
return browser.get() ? browser->GetWebView() : NULL;
|
||||
}
|
||||
|
||||
WebWidget* BrowserWebViewDelegate::createPopupMenu(
|
||||
bool activatable) {
|
||||
// TODO(darin): Should we honor activatable?
|
||||
WebWidget* BrowserWebViewDelegate::createPopupMenu(WebPopupType popup_type) {
|
||||
// TODO(darin): Should we take into account |popup_type| (for activation
|
||||
// purpose)?
|
||||
return browser_->UIT_CreatePopupWidget();
|
||||
}
|
||||
|
||||
WebStorageNamespace* BrowserWebViewDelegate::createSessionStorageNamespace() {
|
||||
return WebKit::WebStorageNamespace::createSessionStorageNamespace();
|
||||
WebStorageNamespace* BrowserWebViewDelegate::createSessionStorageNamespace(
|
||||
unsigned quota) {
|
||||
// Enforce quota, ignoring the parameter from WebCore as in Chrome.
|
||||
return WebKit::WebStorageNamespace::createSessionStorageNamespace(
|
||||
WebStorageNamespace::m_sessionStorageQuota);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didAddMessageToConsole(
|
||||
|
@ -368,8 +380,10 @@ void BrowserWebViewDelegate::setToolTipText(
|
|||
}
|
||||
|
||||
void BrowserWebViewDelegate::startDragging(
|
||||
const WebPoint& mouse_coords, const WebDragData& data,
|
||||
WebDragOperationsMask mask) {
|
||||
const WebDragData& data,
|
||||
WebDragOperationsMask mask,
|
||||
const WebImage& image,
|
||||
const WebPoint& image_offset) {
|
||||
// TODO(tc): Drag and drop is disabled in the test shell because we need
|
||||
// to be able to convert from WebDragData to an IDataObject.
|
||||
//if (!drag_delegate_)
|
||||
|
@ -459,7 +473,20 @@ WebScreenInfo BrowserWebViewDelegate::screenInfo() {
|
|||
|
||||
WebPlugin* BrowserWebViewDelegate::createPlugin(
|
||||
WebFrame* frame, const WebPluginParams& params) {
|
||||
return new webkit_glue::WebPluginImpl(frame, params, AsWeakPtr());
|
||||
bool allow_wildcard = true;
|
||||
WebPluginInfo info;
|
||||
std::string actual_mime_type;
|
||||
if (!NPAPI::PluginList::Singleton()->GetPluginInfo(
|
||||
params.url, params.mimeType.utf8(), allow_wildcard, &info,
|
||||
&actual_mime_type)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (actual_mime_type.empty())
|
||||
actual_mime_type = params.mimeType.utf8();
|
||||
|
||||
return new webkit_glue::WebPluginImpl(
|
||||
frame, params, info.path, actual_mime_type, AsWeakPtr());
|
||||
}
|
||||
|
||||
WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer(
|
||||
|
@ -491,7 +518,12 @@ WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer(
|
|||
factory->AddFactory(buffered_data_source_factory);
|
||||
factory->AddFactory(simple_data_source_factory);
|
||||
return new webkit_glue::WebMediaPlayerImpl(
|
||||
client, factory, new webkit_glue::VideoRendererImpl::FactoryFactory());
|
||||
client, factory, new webkit_glue::VideoRendererImpl::FactoryFactory(false));
|
||||
}
|
||||
|
||||
WebApplicationCacheHost* BrowserWebViewDelegate::createApplicationCacheHost(
|
||||
WebFrame* frame, WebApplicationCacheHostClient* client) {
|
||||
return BrowserAppCacheSystem::CreateApplicationCacheHost(client);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::loadURLExternally(
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebViewClient.h"
|
||||
#include "webkit/glue/webcursor.h"
|
||||
#include "webkit/glue/webplugin_page_delegate.h"
|
||||
#include "webkit/glue/plugins/webplugin_page_delegate.h"
|
||||
#if defined(OS_WIN)
|
||||
#include "browser_drag_delegate.h"
|
||||
#include "browser_drop_delegate.h"
|
||||
|
@ -46,11 +46,14 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||
public base::SupportsWeakPtr<BrowserWebViewDelegate> {
|
||||
public:
|
||||
// WebKit::WebViewClient
|
||||
virtual WebKit::WebView* createView(WebKit::WebFrame* creator);
|
||||
virtual WebKit::WebWidget* createPopupMenu(bool activatable);
|
||||
virtual WebKit::WebView* createView(WebKit::WebFrame* creator,
|
||||
const WebKit::WebWindowFeatures& features,
|
||||
const WebKit::WebString& name);
|
||||
virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
|
||||
virtual WebKit::WebWidget* createPopupMenu(
|
||||
const WebKit::WebPopupMenuInfo& info);
|
||||
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace();
|
||||
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
|
||||
unsigned quota);
|
||||
virtual void didAddMessageToConsole(
|
||||
const WebKit::WebConsoleMessage& message,
|
||||
const WebKit::WebString& source_name, unsigned source_line);
|
||||
|
@ -93,8 +96,10 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||
virtual void setToolTipText(
|
||||
const WebKit::WebString& text, WebKit::WebTextDirection hint);
|
||||
virtual void startDragging(
|
||||
const WebKit::WebPoint& from, const WebKit::WebDragData& data,
|
||||
WebKit::WebDragOperationsMask mask);
|
||||
const WebKit::WebDragData& data,
|
||||
WebKit::WebDragOperationsMask mask,
|
||||
const WebKit::WebImage& image,
|
||||
const WebKit::WebPoint& image_offset);
|
||||
virtual bool acceptsLoadDrops() { return true; }
|
||||
virtual void focusNext();
|
||||
virtual void focusPrevious();
|
||||
|
@ -123,6 +128,8 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||
WebKit::WebFrame*, const WebKit::WebPluginParams&);
|
||||
virtual WebKit::WebMediaPlayer* createMediaPlayer(
|
||||
WebKit::WebFrame*, WebKit::WebMediaPlayerClient*);
|
||||
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
|
||||
WebKit::WebFrame* frame, WebKit::WebApplicationCacheHostClient* client);
|
||||
virtual void loadURLExternally(
|
||||
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
||||
WebKit::WebNavigationPolicy);
|
||||
|
@ -157,9 +164,8 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||
|
||||
// webkit_glue::WebPluginPageDelegate
|
||||
virtual webkit_glue::WebPluginDelegate* CreatePluginDelegate(
|
||||
const GURL& url,
|
||||
const std::string& mime_type,
|
||||
std::string* actual_mime_type);
|
||||
const FilePath& file_path,
|
||||
const std::string& mime_type);
|
||||
virtual void CreatedPluginWindow(
|
||||
gfx::PluginWindowHandle handle);
|
||||
virtual void WillDestroyPluginWindow(
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <shlobj.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
#include "base/gfx/point.h"
|
||||
#include "gfx/point.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/trace_event.h"
|
||||
#include "base/string_util.h"
|
||||
|
@ -33,7 +33,7 @@
|
|||
#include "third_party/WebKit/WebKit/chromium/public/WebView.h"
|
||||
#include "webkit/glue/webdropdata.h"
|
||||
#include "webkit/glue/webpreferences.h"
|
||||
#include "webkit/glue/webplugin.h"
|
||||
#include "webkit/glue/plugins/webplugin.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
#include "webkit/glue/plugins/plugin_list.h"
|
||||
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
|
||||
|
@ -147,24 +147,14 @@ void BrowserWebViewDelegate::runModal() {
|
|||
// WebPluginPageDelegate ------------------------------------------------------
|
||||
|
||||
webkit_glue::WebPluginDelegate* BrowserWebViewDelegate::CreatePluginDelegate(
|
||||
const GURL& url,
|
||||
const std::string& mime_type,
|
||||
std::string* actual_mime_type) {
|
||||
const FilePath& file_path,
|
||||
const std::string& mime_type)
|
||||
{
|
||||
HWND hwnd = browser_->GetWebViewHost()->view_handle();
|
||||
if (!hwnd)
|
||||
return NULL;
|
||||
|
||||
bool allow_wildcard = true;
|
||||
WebPluginInfo info;
|
||||
if (!NPAPI::PluginList::Singleton()->GetPluginInfo(
|
||||
url, mime_type, allow_wildcard, &info, actual_mime_type)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (actual_mime_type && !actual_mime_type->empty())
|
||||
return WebPluginDelegateImpl::Create(info.path, *actual_mime_type, hwnd);
|
||||
else
|
||||
return WebPluginDelegateImpl::Create(info.path, mime_type, hwnd);
|
||||
return WebPluginDelegateImpl::Create(file_path, mime_type, hwnd);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::CreatedPluginWindow(
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "net/base/net_module.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h"
|
||||
#include "webkit/extensions/v8/gc_extension.h"
|
||||
#include "webkit/glue/webplugin.h"
|
||||
#include "webkit/glue/plugins/webplugin.h"
|
||||
#include "webkit/glue/plugins/plugin_lib.h"
|
||||
#include "webkit/glue/plugins/plugin_list.h"
|
||||
|
||||
|
@ -171,9 +171,8 @@ bool CefContext::DoInitialize()
|
|||
// Initializing with a default context, which means no on-disk cookie DB,
|
||||
// and no support for directory listings.
|
||||
//PathService::Get(base::DIR_EXE, &cache_path);
|
||||
BrowserResourceLoaderBridge::Init(
|
||||
new BrowserRequestContext(FilePath(cache_path_), net::HttpCache::NORMAL,
|
||||
false));
|
||||
BrowserResourceLoaderBridge::Init(FilePath(cache_path_), net::HttpCache::NORMAL,
|
||||
false);
|
||||
|
||||
// Load ICU data tables.
|
||||
bool ret = icu_util::Initialize();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef _PRINTING_PRINT_SETTINGS_H
|
||||
#define _PRINTING_PRINT_SETTINGS_H
|
||||
|
||||
#include "base/gfx/rect.h"
|
||||
#include "gfx/rect.h"
|
||||
#include "printing/page_range.h"
|
||||
#include "printing/page_setup.h"
|
||||
|
||||
|
|
|
@ -118,6 +118,15 @@ void CefRequestImpl::Set(URLRequest* request)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void CefRequestImpl::GetHeaderMap(const net::HttpRequestHeaders& headers, HeaderMap& map)
|
||||
{
|
||||
net::HttpRequestHeaders::Iterator it(headers);
|
||||
do {
|
||||
map[UTF8ToWide(it.name())] = UTF8ToWide(it.value());
|
||||
} while (it.GetNext());
|
||||
}
|
||||
|
||||
void CefRequestImpl::GetHeaderMap(const WebKit::WebURLRequest& request,
|
||||
HeaderMap& map)
|
||||
{
|
||||
|
@ -240,14 +249,15 @@ void CefPostDataImpl::RemoveElements()
|
|||
Unlock();
|
||||
}
|
||||
|
||||
void CefPostDataImpl::Set(const net::UploadData& data)
|
||||
void CefPostDataImpl::Set(net::UploadData& data)
|
||||
{
|
||||
Lock();
|
||||
|
||||
CefRefPtr<CefPostDataElement> postelem;
|
||||
const std::vector<net::UploadData::Element>& elements = data.elements();
|
||||
std::vector<net::UploadData::Element>::const_iterator it = elements.begin();
|
||||
for (; it != elements.end(); ++it) {
|
||||
|
||||
std::vector<net::UploadData::Element>* elements = data.elements();
|
||||
std::vector<net::UploadData::Element>::const_iterator it = elements->begin();
|
||||
for (; it != elements->end(); ++it) {
|
||||
postelem = CefPostDataElement::CreatePostDataElement();
|
||||
static_cast<CefPostDataElementImpl*>(postelem.get())->Set(*it);
|
||||
AddElement(postelem);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "../include/cef.h"
|
||||
#include "net/base/upload_data.h"
|
||||
#include "net/http/http_request_headers.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
|
||||
|
||||
|
@ -34,6 +35,8 @@ public:
|
|||
|
||||
void Set(URLRequest* request);
|
||||
|
||||
static void GetHeaderMap(const net::HttpRequestHeaders& headers,
|
||||
HeaderMap& map);
|
||||
static void GetHeaderMap(const WebKit::WebURLRequest& request,
|
||||
HeaderMap& map);
|
||||
static void SetHeaderMap(const HeaderMap& map,
|
||||
|
@ -61,7 +64,7 @@ public:
|
|||
virtual bool AddElement(CefRefPtr<CefPostDataElement> element);
|
||||
virtual void RemoveElements();
|
||||
|
||||
void Set(const net::UploadData& data);
|
||||
void Set(net::UploadData& data);
|
||||
void Get(net::UploadData& data);
|
||||
void Set(const WebKit::WebHTTPBody& data);
|
||||
void Get(WebKit::WebHTTPBody& data);
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#include "webview_host.h"
|
||||
#include "browser_webview_delegate.h"
|
||||
|
||||
#include "base/gfx/rect.h"
|
||||
#include "base/gfx/size.h"
|
||||
#include "gfx/rect.h"
|
||||
#include "gfx/size.h"
|
||||
#include "base/win_util.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebView.h"
|
||||
#include "webkit/glue/webpreferences.h"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#define _WEBVIEW_HOST_H
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/gfx/rect.h"
|
||||
#include "gfx/rect.h"
|
||||
#include "gfx/native_widget_types.h"
|
||||
#include "webwidget_host.h"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "webwidget_host.h"
|
||||
|
||||
#include "base/gfx/rect.h"
|
||||
#include "gfx/rect.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/win_util.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
|
||||
|
@ -118,7 +118,6 @@ LRESULT CALLBACK WebWidgetHost::WndProc(HWND hwnd, UINT message, WPARAM wparam,
|
|||
case WM_SYSKEYUP:
|
||||
case WM_CHAR:
|
||||
case WM_SYSCHAR:
|
||||
case WM_IME_CHAR:
|
||||
host->KeyEvent(message, wparam, lparam);
|
||||
break;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#define _WEBWIDGET_HOST_H
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/gfx/rect.h"
|
||||
#include "gfx/rect.h"
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "gfx/native_widget_types.h"
|
||||
#include "skia/ext/platform_canvas.h"
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
Index: common.gypi
|
||||
===================================================================
|
||||
--- common.gypi (revision 26790)
|
||||
--- common.gypi (revision 50325)
|
||||
+++ common.gypi (working copy)
|
||||
@@ -15,6 +15,9 @@
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
# Variables expected to be overriden on the GYP command line (-D) or by
|
||||
# ~/.gyp/include.gypi.
|
||||
+
|
||||
|
||||
+ # Directory for CEF source files. This will be set by cef.gypi.
|
||||
+ 'cef_directory%' : '',
|
||||
|
||||
+
|
||||
# Putting a variables dict inside another variables dict looks kind of
|
||||
# weird. This is done so that "branding" and "buildtype" are defined as
|
||||
# variables within the outer variables dict here. This is necessary
|
||||
Index: win/system.gyp
|
||||
===================================================================
|
||||
--- win/system.gyp (revision 26790)
|
||||
--- win/system.gyp (revision 50325)
|
||||
+++ win/system.gyp (working copy)
|
||||
@@ -22,6 +22,13 @@
|
||||
'action': ['', '<@(_inputs)'],
|
||||
|
|
Loading…
Reference in New Issue