Update to Chromium revision 153668.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@748 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-08-28 22:26:35 +00:00
parent 6a8f3a9410
commit 2e83d58814
36 changed files with 317 additions and 117 deletions

View File

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

17
cef.gyp
View File

@ -159,7 +159,7 @@
# Modify the Info.plist as needed.
'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py',
'--svn=1'],
'--scm=1'],
},
{
# This postbuid step is responsible for creating the following
@ -337,7 +337,7 @@
# Modify the Info.plist as needed.
'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py',
'--svn=1'],
'--scm=1'],
},
{
# This postbuid step is responsible for creating the following
@ -932,6 +932,7 @@
'<@(includes_linux)',
'libcef/browser/browser_host_impl_gtk.cc',
'libcef/browser/browser_main_gtk.cc',
'libcef/browser/download_manager_delegate_gtk.cc',
'libcef/browser/gtk_util_stub.cc',
'libcef/browser/javascript_dialog_gtk.cc',
'libcef/browser/menu_creator_runner_gtk.cc',
@ -1024,14 +1025,14 @@
{
# Modify the Info.plist as needed. The script explains why this
# is needed. This is also done in the chrome and chrome_dll
# targets. In this case, --breakpad=0, --keystone=0, and --svn=0
# are used because Breakpad, Keystone, and Subversion keys are
# targets. In this case, --breakpad=0, --keystone=0, and --scm=0
# are used because Breakpad, Keystone, and SCM keys are
# never placed into the helper.
'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py',
'--breakpad=0',
'--keystone=0',
'--svn=0'],
'--scm=0'],
},
],
}, # target cefclient_helper_app
@ -1113,14 +1114,14 @@
{
# Modify the Info.plist as needed. The script explains why this
# is needed. This is also done in the chrome and chrome_dll
# targets. In this case, --breakpad=0, --keystone=0, and --svn=0
# are used because Breakpad, Keystone, and Subversion keys are
# targets. In this case, --breakpad=0, --keystone=0, and --scm=0
# are used because Breakpad, Keystone, and SCM keys are
# never placed into the helper.
'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py',
'--breakpad=0',
'--keystone=0',
'--svn=0'],
'--scm=0'],
},
],
}, # target cef_unittests_helper_app

View File

@ -114,7 +114,9 @@ typedef struct _cef_browser_t {
///
int (CEF_CALLBACK *is_popup)(struct _cef_browser_t* self);
///
// Returns true (1) if a document has been loaded in the browser.
///
int (CEF_CALLBACK *has_document)(struct _cef_browser_t* self);
///

View File

@ -70,7 +70,8 @@ typedef struct _cef_menu_model_t {
//
// Add a separator to the menu. Returns true (1) on success.
///
int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self);
int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self,
enum cef_menu_separator_type_t type);
//
// Add an item to the menu. Returns true (1) on success.
@ -103,7 +104,7 @@ typedef struct _cef_menu_model_t {
// on success.
///
int (CEF_CALLBACK *insert_separator_at)(struct _cef_menu_model_t* self,
int index);
int index, enum cef_menu_separator_type_t type);
//
// Insert an item in the menu at the specified |index|. Returns true (1) on
@ -205,6 +206,12 @@ typedef struct _cef_menu_model_t {
enum cef_menu_item_type_t (CEF_CALLBACK *get_type_at)(
struct _cef_menu_model_t* self, int index);
///
// Returns the separator type at the specified |index|.
///
enum cef_menu_separator_type_t (CEF_CALLBACK *get_separator_type_at)(
struct _cef_menu_model_t* self, int index);
///
// Returns the group id for the specified |command_id| or -1 if invalid.
///

View File

@ -308,7 +308,7 @@ typedef struct _cef_v8exception_t {
///
// Structure representing a V8 value. The functions of this structure may only
// be called on the UI thread.
// be called on the render process main thread.
///
typedef struct _cef_v8value_t {
///

View File

@ -50,6 +50,7 @@
class CefMenuModel : public virtual CefBase {
public:
typedef cef_menu_item_type_t MenuItemType;
typedef cef_menu_separator_type_t MenuSeparatorType;
///
// Clears the menu. Returns true on success.
@ -67,7 +68,7 @@ class CefMenuModel : public virtual CefBase {
// Add a separator to the menu. Returns true on success.
///
/*--cef()--*/
virtual bool AddSeparator() =0;
virtual bool AddSeparator(MenuSeparatorType type) =0;
//
// Add an item to the menu. Returns true on success.
@ -103,7 +104,7 @@ class CefMenuModel : public virtual CefBase {
// success.
///
/*--cef()--*/
virtual bool InsertSeparatorAt(int index) =0;
virtual bool InsertSeparatorAt(int index, MenuSeparatorType type) =0;
//
// Insert an item in the menu at the specified |index|. Returns true on
@ -212,6 +213,12 @@ class CefMenuModel : public virtual CefBase {
/*--cef(default_retval=MENUITEMTYPE_NONE)--*/
virtual MenuItemType GetTypeAt(int index) =0;
///
// Returns the separator type at the specified |index|.
///
/*--cef(default_retval=MENUSEPARATORTYPE_NONE)--*/
virtual MenuSeparatorType GetSeparatorTypeAt(int index) =0;
///
// Returns the group id for the specified |command_id| or -1 if invalid.
///

View File

@ -984,6 +984,33 @@ enum cef_menu_item_type_t {
MENUITEMTYPE_SUBMENU,
};
///
// Supported menu separator types.
///
enum cef_menu_separator_type_t {
MENUSEPARATORTYPE_NONE,
///
// Normal - top to bottom: Spacing, line, spacing
///
MENUSEPARATORTYPE_NORMAL,
///
// Upper - top to bottom: Line, spacing
///
MENUSEPARATORTYPE_UPPER,
///
// Lower - top to bottom: Spacing, line
///
MENUSEPARATORTYPE_LOWER,
///
// Spacing - top to bottom: Spacing only.
///
MENUSEPARATORTYPE_SPACING,
};
///
// Supported context menu type flags.
///

View File

@ -223,7 +223,13 @@ net::URLRequestContextGetter*
}
net::URLRequestContextGetter*
CefBrowserContext::GetRequestContextForMedia() {
CefBrowserContext::GetMediaRequestContext() {
return GetRequestContext();
}
net::URLRequestContextGetter*
CefBrowserContext::GetMediaRequestContextForRenderProcess(
int renderer_child_id) {
return GetRequestContext();
}

View File

@ -32,7 +32,9 @@ class CefBrowserContext : public content::BrowserContext {
virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
int renderer_child_id) OVERRIDE;
virtual net::URLRequestContextGetter* GetRequestContextForMedia() OVERRIDE;
virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE;
virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
int renderer_child_id) OVERRIDE;
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
virtual content::GeolocationPermissionContext*
GetGeolocationPermissionContext() OVERRIDE;

View File

@ -181,7 +181,6 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
_Context->browser_context(),
NULL,
MSG_ROUTING_NONE,
NULL,
NULL);
}
@ -909,7 +908,8 @@ void CefBrowserHostImpl::CloseContents(content::WebContents* source) {
PlatformCloseWindow();
}
bool CefBrowserHostImpl::TakeFocus(bool reverse) {
bool CefBrowserHostImpl::TakeFocus(content::WebContents* source,
bool reverse) {
if (client_.get()) {
CefRefPtr<CefFocusHandler> handler = client_->GetFocusHandler();
if (handler.get())
@ -935,6 +935,7 @@ bool CefBrowserHostImpl::HandleContextMenu(
}
bool CefBrowserHostImpl::PreHandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) {
if (client_.get()) {
@ -961,6 +962,7 @@ bool CefBrowserHostImpl::PreHandleKeyboardEvent(
}
void CefBrowserHostImpl::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
// Check to see if event should be ignored.
if (event.skip_in_browser)

View File

@ -205,14 +205,17 @@ class CefBrowserHostImpl : public CefBrowserHost,
const content::OpenURLParams& params) OVERRIDE;
virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE;
virtual void CloseContents(content::WebContents* source) OVERRIDE;
virtual bool TakeFocus(bool reverse) OVERRIDE;
virtual bool TakeFocus(content::WebContents* source,
bool reverse) OVERRIDE;
virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE;
virtual bool HandleContextMenu(const content::ContextMenuParams& params)
OVERRIDE;
virtual bool PreHandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) OVERRIDE;
virtual void HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) OVERRIDE;
virtual bool ShouldCreateWebContents(
content::WebContents* web_contents,

View File

@ -137,7 +137,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
FilePath result;
if (show_dialog) {
#if defined(OS_WIN) || defined(OS_MACOSX)
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(TOOLKIT_GTK)
WebContents* web_contents = item->GetWebContents();
result = CefDownloadManagerDelegate::PlatformChooseDownloadPath(
web_contents, suggested_path);

View File

@ -0,0 +1,43 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2011 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.
#include "libcef/browser/download_manager_delegate.h"
#include <gtk/gtk.h>
#include "base/string_util.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
// static
FilePath CefDownloadManagerDelegate::PlatformChooseDownloadPath(
content::WebContents* web_contents,
const FilePath& suggested_path) {
FilePath result;
gfx::NativeWindow parent_window =
web_contents->GetView()->GetTopLevelNativeWindow();
std::string base_name = suggested_path.BaseName().value();
GtkWidget* dialog = gtk_file_chooser_dialog_new(
"Save File",
parent_window,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog),
TRUE);
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog),
base_name.c_str());
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
result = FilePath(filename);
}
gtk_widget_destroy(dialog);
return result;
}

View File

@ -206,13 +206,13 @@ void CefMenuCreator::CreateDefaultModel() {
model_->AddItem(MENU_ID_UNDO, GetLabel(IDS_MENU_UNDO));
model_->AddItem(MENU_ID_REDO, GetLabel(IDS_MENU_REDO));
model_->AddSeparator();
model_->AddSeparator(MENUSEPARATORTYPE_NORMAL);
model_->AddItem(MENU_ID_CUT, GetLabel(IDS_MENU_CUT));
model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY));
model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_MENU_PASTE));
model_->AddItem(MENU_ID_DELETE, GetLabel(IDS_MENU_DELETE));
model_->AddSeparator();
model_->AddSeparator(MENUSEPARATORTYPE_NORMAL);
model_->AddItem(MENU_ID_SELECT_ALL, GetLabel(IDS_MENU_SELECT_ALL));
if (!(params_.edit_flags & CM_EDITFLAG_CAN_UNDO))
@ -237,7 +237,7 @@ void CefMenuCreator::CreateDefaultModel() {
model_->AddItem(MENU_ID_BACK, GetLabel(IDS_MENU_BACK));
model_->AddItem(MENU_ID_FORWARD, GetLabel(IDS_MENU_FORWARD));
model_->AddSeparator();
model_->AddSeparator(MENUSEPARATORTYPE_NORMAL);
model_->AddItem(MENU_ID_PRINT, GetLabel(IDS_MENU_PRINT));
model_->AddItem(MENU_ID_VIEW_SOURCE, GetLabel(IDS_MENU_VIEW_SOURCE));

View File

@ -56,6 +56,10 @@ class CefSimpleMenuModel : public ui::MenuModel {
}
}
virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const OVERRIDE {
return ui::NORMAL_SEPARATOR;
}
virtual int GetCommandIdAt(int index) const OVERRIDE {
return impl_->GetCommandIdAt(index);
}
@ -99,7 +103,7 @@ class CefSimpleMenuModel : public ui::MenuModel {
return impl_->GetGroupIdAt(index);
}
virtual bool GetIconAt(int index, gfx::ImageSkia* icon) OVERRIDE {
virtual bool GetIconAt(int index, gfx::Image* icon) OVERRIDE {
return false;
}
@ -163,6 +167,7 @@ struct CefMenuModelImpl::Item {
const CefString& label,
int group_id)
: type_(type),
separator_type_(MENUSEPARATORTYPE_NONE),
command_id_(command_id),
label_(label),
group_id_(group_id),
@ -178,6 +183,7 @@ struct CefMenuModelImpl::Item {
// Basic information.
cef_menu_item_type_t type_;
cef_menu_separator_type_t separator_type_;
int command_id_;
CefString label_;
int group_id_;
@ -221,11 +227,17 @@ int CefMenuModelImpl::GetCount() {
return static_cast<int>(items_.size());
}
bool CefMenuModelImpl::AddSeparator() {
bool CefMenuModelImpl::AddSeparator(MenuSeparatorType type) {
if (!VerifyContext())
return false;
AppendItem(Item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1));
DCHECK(type != MENUSEPARATORTYPE_NONE);
if (type == MENUSEPARATORTYPE_NONE)
return false;
Item item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1);
item.separator_type_ = type;
AppendItem(item);
return true;
}
@ -265,12 +277,17 @@ CefRefPtr<CefMenuModel> CefMenuModelImpl::AddSubMenu(int command_id,
return item.submenu_.get();
}
bool CefMenuModelImpl::InsertSeparatorAt(int index) {
bool CefMenuModelImpl::InsertSeparatorAt(int index, MenuSeparatorType type) {
if (!VerifyContext())
return false;
InsertItemAt(Item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1),
index);
DCHECK(type != MENUSEPARATORTYPE_NONE);
if (type == MENUSEPARATORTYPE_NONE)
return false;
Item item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1);
item.separator_type_ = type;
InsertItemAt(item, index);
return true;
}
@ -400,6 +417,16 @@ CefMenuModelImpl::MenuItemType CefMenuModelImpl::GetTypeAt(int index) {
return MENUITEMTYPE_NONE;
}
CefMenuModelImpl::MenuSeparatorType
CefMenuModelImpl::GetSeparatorTypeAt(int index) {
if (!VerifyContext())
return MENUSEPARATORTYPE_NONE;
if (index >= 0 && index < static_cast<int>(items_.size()))
return items_[index].separator_type_;
return MENUSEPARATORTYPE_NONE;
}
int CefMenuModelImpl::GetGroupId(int command_id) {
return GetGroupIdAt(GetIndexOf(command_id));
}

View File

@ -42,14 +42,14 @@ class CefMenuModelImpl : public CefMenuModel {
// CefMenuModel methods.
virtual bool Clear() OVERRIDE;
virtual int GetCount() OVERRIDE;
virtual bool AddSeparator() OVERRIDE;
virtual bool AddSeparator(MenuSeparatorType type) OVERRIDE;
virtual bool AddItem(int command_id, const CefString& label) OVERRIDE;
virtual bool AddCheckItem(int command_id, const CefString& label) OVERRIDE;
virtual bool AddRadioItem(int command_id, const CefString& label,
int group_id) OVERRIDE;
virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id,
const CefString& label) OVERRIDE;
virtual bool InsertSeparatorAt(int index) OVERRIDE;
virtual bool InsertSeparatorAt(int index, MenuSeparatorType type) OVERRIDE;
virtual bool InsertItemAt(int index, int command_id,
const CefString& label) OVERRIDE;
virtual bool InsertCheckItemAt(int index, int command_id,
@ -69,6 +69,7 @@ class CefMenuModelImpl : public CefMenuModel {
virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE;
virtual MenuItemType GetType(int command_id) OVERRIDE;
virtual MenuItemType GetTypeAt(int index) OVERRIDE;
virtual MenuSeparatorType GetSeparatorTypeAt(int index) OVERRIDE;
virtual int GetGroupId(int command_id) OVERRIDE;
virtual int GetGroupIdAt(int index) OVERRIDE;
virtual bool SetGroupId(int command_id, int group_id) OVERRIDE;

View File

@ -125,8 +125,9 @@ class CefResourceRequestJobCallback : public CefCallback {
CefResourceRequestJob::CefResourceRequestJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
CefRefPtr<CefResourceHandler> handler)
: net::URLRequestJob(request, request->context()->network_delegate()),
: net::URLRequestJob(request, network_delegate),
handler_(handler),
remaining_bytes_(0),
response_cookies_save_index_(0),

View File

@ -25,6 +25,7 @@ class CefResourceRequestJobCallback;
class CefResourceRequestJob : public net::URLRequestJob {
public:
CefResourceRequestJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate,
CefRefPtr<CefResourceHandler> handler);
virtual ~CefResourceRequestJob();

View File

@ -71,12 +71,15 @@ bool IsBuiltinScheme(const std::string& scheme) {
return false;
}
net::URLRequestJob* GetBuiltinSchemeRequestJob(net::URLRequest* request,
const std::string& scheme) {
net::URLRequestJob* GetBuiltinSchemeRequestJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const std::string& scheme) {
// See if the request should be handled by a built-in protocol factory.
for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i) {
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!
return job;
}
@ -104,10 +107,11 @@ class CefUrlRequestManager {
// From net::URLRequestJobFactory::ProtocolHandler
virtual net::URLRequestJob* MaybeCreateJob(
net::URLRequest* request) const OVERRIDE {
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const OVERRIDE {
CEF_REQUIRE_IOT();
return CefUrlRequestManager::GetInstance()->GetRequestJob(request,
scheme_);
return CefUrlRequestManager::GetInstance()->GetRequestJob(
request, network_delegate, scheme_);
}
private:
@ -220,6 +224,7 @@ class CefUrlRequestManager {
// Create the job that will handle the request. |scheme| will already be in
// lower case.
net::URLRequestJob* GetRequestJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const std::string& scheme) {
net::URLRequestJob* job = NULL;
CefRefPtr<CefSchemeHandlerFactory> factory =
@ -239,12 +244,12 @@ class CefUrlRequestManager {
CefRefPtr<CefResourceHandler> handler =
factory->Create(browser.get(), frame, scheme, requestPtr.get());
if (handler.get())
job = new CefResourceRequestJob(request, handler);
job = new CefResourceRequestJob(request, network_delegate, handler);
}
if (!job && IsBuiltinScheme(scheme)) {
// Give the built-in scheme handler a chance to handle the request.
job = GetBuiltinSchemeRequestJob(request, scheme);
job = GetBuiltinSchemeRequestJob(request, network_delegate, scheme);
}
#ifndef NDEBUG

View File

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

View File

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

View File

@ -41,7 +41,7 @@
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_storage.h"
#include "net/url_request/url_request_job_factory.h"
#include "net/url_request/url_request_job_factory_impl.h"
#include "net/url_request/url_request_job_manager.h"
using content::BrowserThread;
@ -275,7 +275,7 @@ net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() {
storage_->set_ftp_transaction_factory(
new net::FtpNetworkLayer(url_request_context_->host_resolver()));
storage_->set_job_factory(new net::URLRequestJobFactory);
storage_->set_job_factory(new net::URLRequestJobFactoryImpl);
request_interceptor_.reset(new CefRequestInterceptor);
}

View File

@ -26,7 +26,8 @@ CefRequestInterceptor::~CefRequestInterceptor() {
}
net::URLRequestJob* CefRequestInterceptor::MaybeIntercept(
net::URLRequest* request) {
net::URLRequest* request,
net::NetworkDelegate* network_delegate) {
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForRequest(request);
if (browser.get()) {
@ -44,7 +45,8 @@ net::URLRequestJob* CefRequestInterceptor::MaybeIntercept(
CefRefPtr<CefResourceHandler> resourceHandler =
handler->GetResourceHandler(browser.get(), frame, req);
if (resourceHandler.get())
return new CefResourceRequestJob(request, resourceHandler);
return new CefResourceRequestJob(request, network_delegate,
resourceHandler);
}
}
}
@ -53,7 +55,9 @@ net::URLRequestJob* CefRequestInterceptor::MaybeIntercept(
}
net::URLRequestJob* CefRequestInterceptor::MaybeInterceptRedirect(
net::URLRequest* request, const GURL& location) {
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const GURL& location) {
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForRequest(request);
if (browser.get()) {
@ -70,7 +74,8 @@ net::URLRequestJob* CefRequestInterceptor::MaybeInterceptRedirect(
if (newUrlStr != location.spec()) {
GURL new_url = GURL(std::string(newUrlStr));
if (!new_url.is_empty() && new_url.is_valid())
return new net::URLRequestRedirectJob(request, new_url);
return new net::URLRequestRedirectJob(request, network_delegate,
new_url);
}
}
}
@ -80,6 +85,7 @@ net::URLRequestJob* CefRequestInterceptor::MaybeInterceptRedirect(
}
net::URLRequestJob* CefRequestInterceptor::MaybeInterceptResponse(
net::URLRequest* request) {
net::URLRequest* request,
net::NetworkDelegate* network_delegate) {
return NULL;
}

View File

@ -16,12 +16,16 @@ class CefRequestInterceptor : public net::URLRequest::Interceptor {
~CefRequestInterceptor();
// net::URLRequest::Interceptor methods.
virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request)
OVERRIDE;
virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request,
virtual net::URLRequestJob* MaybeIntercept(
net::URLRequest* request,
net::NetworkDelegate* network_delegate) OVERRIDE;
virtual net::URLRequestJob* MaybeInterceptRedirect(
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const GURL& location) OVERRIDE;
virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request)
OVERRIDE;
virtual net::URLRequestJob* MaybeInterceptResponse(
net::URLRequest* request,
net::NetworkDelegate* network_delegate) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(CefRequestInterceptor);
};

View File

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

View File

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

View File

@ -565,7 +565,7 @@ bool CefListValueImpl::Remove(int index) {
CefValueType CefListValueImpl::GetType(int index) {
CEF_VALUE_VERIFY_RETURN(false, VTYPE_INVALID);
base::Value* out_value = NULL;
const base::Value* out_value = NULL;
if (const_value().Get(index, &out_value)) {
switch (out_value->GetType()) {
case base::Value::TYPE_NULL:
@ -593,7 +593,7 @@ CefValueType CefListValueImpl::GetType(int index) {
bool CefListValueImpl::GetBool(int index) {
CEF_VALUE_VERIFY_RETURN(false, false);
base::Value* out_value = NULL;
const base::Value* out_value = NULL;
bool ret_value = false;
if (const_value().Get(index, &out_value))
@ -605,7 +605,7 @@ bool CefListValueImpl::GetBool(int index) {
int CefListValueImpl::GetInt(int index) {
CEF_VALUE_VERIFY_RETURN(false, 0);
base::Value* out_value = NULL;
const base::Value* out_value = NULL;
int ret_value = 0;
if (const_value().Get(index, &out_value))
@ -617,7 +617,7 @@ int CefListValueImpl::GetInt(int index) {
double CefListValueImpl::GetDouble(int index) {
CEF_VALUE_VERIFY_RETURN(false, 0);
base::Value* out_value = NULL;
const base::Value* out_value = NULL;
double ret_value = 0;
if (const_value().Get(index, &out_value))
@ -629,7 +629,7 @@ double CefListValueImpl::GetDouble(int index) {
CefString CefListValueImpl::GetString(int index) {
CEF_VALUE_VERIFY_RETURN(false, CefString());
base::Value* out_value = NULL;
const base::Value* out_value = NULL;
string16 ret_value;
if (const_value().Get(index, &out_value))
@ -641,12 +641,12 @@ CefString CefListValueImpl::GetString(int index) {
CefRefPtr<CefBinaryValue> CefListValueImpl::GetBinary(int index) {
CEF_VALUE_VERIFY_RETURN(false, NULL);
base::Value* out_value = NULL;
const base::Value* out_value = NULL;
if (const_value().Get(index, &out_value) &&
out_value->IsType(base::Value::TYPE_BINARY)) {
base::BinaryValue* binary_value =
static_cast<base::BinaryValue*>(out_value);
static_cast<base::BinaryValue*>(const_cast<base::Value*>(out_value));
return CefBinaryValueImpl::GetOrCreateRef(binary_value,
const_cast<base::ListValue*>(&const_value()), controller());
}
@ -657,12 +657,13 @@ CefRefPtr<CefBinaryValue> CefListValueImpl::GetBinary(int index) {
CefRefPtr<CefDictionaryValue> CefListValueImpl::GetDictionary(int index) {
CEF_VALUE_VERIFY_RETURN(false, NULL);
base::Value* out_value = NULL;
const base::Value* out_value = NULL;
if (const_value().Get(index, &out_value) &&
out_value->IsType(base::Value::TYPE_DICTIONARY)) {
base::DictionaryValue* dict_value =
static_cast<base::DictionaryValue*>(out_value);
static_cast<base::DictionaryValue*>(
const_cast<base::Value*>(out_value));
return CefDictionaryValueImpl::GetOrCreateRef(
dict_value,
const_cast<base::ListValue*>(&const_value()),
@ -676,11 +677,12 @@ CefRefPtr<CefDictionaryValue> CefListValueImpl::GetDictionary(int index) {
CefRefPtr<CefListValue> CefListValueImpl::GetList(int index) {
CEF_VALUE_VERIFY_RETURN(false, NULL);
base::Value* out_value = NULL;
const base::Value* out_value = NULL;
if (const_value().Get(index, &out_value) &&
out_value->IsType(base::Value::TYPE_LIST)) {
base::ListValue* list_value = static_cast<base::ListValue*>(out_value);
base::ListValue* list_value =
static_cast<base::ListValue*>(const_cast<base::Value*>(out_value));
return CefListValueImpl::GetOrCreateRef(
list_value,
const_cast<base::ListValue*>(&const_value()),

View File

@ -319,19 +319,17 @@ void CefBrowserImpl::LoadRequest(const CefMsg_LoadRequest_Params& params) {
WebKit::WebHTTPBody body;
body.initialize();
const std::vector<net::UploadData::Element>* elements =
const std::vector<net::UploadElement>* elements =
params.upload_data->elements();
std::vector<net::UploadData::Element>::const_iterator it =
std::vector<net::UploadElement>::const_iterator it =
elements->begin();
for (; it != elements->end(); ++it) {
const net::UploadData::Element& element = *it;
if (element.type() == net::UploadData::TYPE_BYTES) {
const net::UploadElement& element = *it;
if (element.type() == net::UploadElement::TYPE_BYTES) {
WebKit::WebData data;
data.assign(std::string(element.bytes().begin(),
element.bytes().end()).c_str(),
element.bytes().size());
data.assign(element.bytes(), element.bytes_length());
body.appendData(data);
} else if (element.type() == net::UploadData::TYPE_FILE) {
} else if (element.type() == net::UploadElement::TYPE_FILE) {
body.appendFile(webkit_glue::FilePathToWebString(element.file_path()));
} else {
NOTREACHED();

View File

@ -8,7 +8,10 @@
#include "third_party/WebKit/Source/WebCore/config.h"
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)
MSVC_POP_WARNING();
#undef LOG
@ -554,12 +557,14 @@ bool CefV8ContextImpl::Eval(const CefString& code,
retval = 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.
WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve();
DCHECK(proxy);
if (proxy)
func_rv = proxy->callFunction(func, obj, 1, &code_val);
RefPtr<WebCore::Frame> frame = WebCore::toFrameIfNotDetached(GetHandle());
DCHECK(frame);
if (frame &&
frame->script()->canExecuteScripts(WebCore::AboutToExecuteScript)) {
func_rv = frame->script()->callFunction(func, obj, 1, &code_val);
}
if (try_catch.HasCaught()) {
exception = new CefV8ExceptionImpl(try_catch.Message());
@ -1288,12 +1293,14 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::ExecuteFunctionWithContext(
try_catch.SetVerbose(true);
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.
WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve();
DCHECK(proxy);
if (proxy)
func_rv = proxy->callFunction(func, recv, argc, argv);
RefPtr<WebCore::Frame> frame = WebCore::toFrameIfNotDetached(context_local);
DCHECK(frame);
if (frame &&
frame->script()->canExecuteScripts(WebCore::AboutToExecuteScript)) {
func_rv = frame->script()->callFunction(func, recv, argc, argv);
}
if (!HasCaught(try_catch) && !func_rv.IsEmpty())
retval = new CefV8ValueImpl(func_rv);

View File

@ -10,6 +10,7 @@
#include "third_party/WebKit/Source/WebCore/config.h"
MSVC_PUSH_WARNING_LEVEL(0);
#include "Page.h"
#include "ScriptController.h"
#include "third_party/WebKit/Source/WebKit/chromium/src/WebFrameImpl.h"
#include "third_party/WebKit/Source/WebKit/chromium/src/WebViewImpl.h"
MSVC_POP_WARNING();
@ -33,8 +34,7 @@ void GoBackOrForward(WebKit::WebView* view, int distance) {
v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame) {
WebKit::WebFrameImpl* impl = static_cast<WebKit::WebFrameImpl*>(frame);
WebCore::Frame* core_frame = impl->frame();
return WebCore::V8Proxy::context(core_frame);
return WebCore::ScriptController::mainWorldContext(impl->frame());
}
} // webkit_glue

View File

@ -43,7 +43,8 @@ int CEF_CALLBACK menu_model_get_count(struct _cef_menu_model_t* self) {
return _retval;
}
int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self) {
int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self,
enum cef_menu_separator_type_t type) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -51,7 +52,8 @@ int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self) {
return 0;
// Execute
bool _retval = CefMenuModelCppToC::Get(self)->AddSeparator();
bool _retval = CefMenuModelCppToC::Get(self)->AddSeparator(
type);
// Return type: bool
return _retval;
@ -144,7 +146,7 @@ struct _cef_menu_model_t* CEF_CALLBACK menu_model_add_sub_menu(
}
int CEF_CALLBACK menu_model_insert_separator_at(struct _cef_menu_model_t* self,
int index) {
int index, enum cef_menu_separator_type_t type) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -153,7 +155,8 @@ int CEF_CALLBACK menu_model_insert_separator_at(struct _cef_menu_model_t* self,
// Execute
bool _retval = CefMenuModelCppToC::Get(self)->InsertSeparatorAt(
index);
index,
type);
// Return type: bool
return _retval;
@ -437,6 +440,23 @@ enum cef_menu_item_type_t CEF_CALLBACK menu_model_get_type_at(
return _retval;
}
enum cef_menu_separator_type_t CEF_CALLBACK menu_model_get_separator_type_at(
struct _cef_menu_model_t* self, int index) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return MENUSEPARATORTYPE_NONE;
// Execute
cef_menu_separator_type_t _retval = CefMenuModelCppToC::Get(
self)->GetSeparatorTypeAt(
index);
// Return type: simple
return _retval;
}
int CEF_CALLBACK menu_model_get_group_id(struct _cef_menu_model_t* self,
int command_id) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -985,6 +1005,7 @@ CefMenuModelCppToC::CefMenuModelCppToC(CefMenuModel* cls)
struct_.struct_.set_label_at = menu_model_set_label_at;
struct_.struct_.get_type = menu_model_get_type;
struct_.struct_.get_type_at = menu_model_get_type_at;
struct_.struct_.get_separator_type_at = menu_model_get_separator_type_at;
struct_.struct_.get_group_id = menu_model_get_group_id;
struct_.struct_.get_group_id_at = menu_model_get_group_id_at;
struct_.struct_.set_group_id = menu_model_set_group_id;

View File

@ -41,14 +41,15 @@ int CefMenuModelCToCpp::GetCount() {
return _retval;
}
bool CefMenuModelCToCpp::AddSeparator() {
bool CefMenuModelCToCpp::AddSeparator(MenuSeparatorType type) {
if (CEF_MEMBER_MISSING(struct_, add_separator))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->add_separator(struct_);
int _retval = struct_->add_separator(struct_,
type);
// Return type: bool
return _retval?true:false;
@ -137,7 +138,7 @@ CefRefPtr<CefMenuModel> CefMenuModelCToCpp::AddSubMenu(int command_id,
return CefMenuModelCToCpp::Wrap(_retval);
}
bool CefMenuModelCToCpp::InsertSeparatorAt(int index) {
bool CefMenuModelCToCpp::InsertSeparatorAt(int index, MenuSeparatorType type) {
if (CEF_MEMBER_MISSING(struct_, insert_separator_at))
return false;
@ -145,7 +146,8 @@ bool CefMenuModelCToCpp::InsertSeparatorAt(int index) {
// Execute
int _retval = struct_->insert_separator_at(struct_,
index);
index,
type);
// Return type: bool
return _retval?true:false;
@ -411,6 +413,21 @@ CefMenuModel::MenuItemType CefMenuModelCToCpp::GetTypeAt(int index) {
return _retval;
}
CefMenuModel::MenuSeparatorType CefMenuModelCToCpp::GetSeparatorTypeAt(
int index) {
if (CEF_MEMBER_MISSING(struct_, get_separator_type_at))
return MENUSEPARATORTYPE_NONE;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_menu_separator_type_t _retval = struct_->get_separator_type_at(struct_,
index);
// Return type: simple
return _retval;
}
int CefMenuModelCToCpp::GetGroupId(int command_id) {
if (CEF_MEMBER_MISSING(struct_, get_group_id))
return 0;

View File

@ -34,14 +34,14 @@ class CefMenuModelCToCpp
// CefMenuModel methods
virtual bool Clear() OVERRIDE;
virtual int GetCount() OVERRIDE;
virtual bool AddSeparator() OVERRIDE;
virtual bool AddSeparator(MenuSeparatorType type) OVERRIDE;
virtual bool AddItem(int command_id, const CefString& label) OVERRIDE;
virtual bool AddCheckItem(int command_id, const CefString& label) OVERRIDE;
virtual bool AddRadioItem(int command_id, const CefString& label,
int group_id) OVERRIDE;
virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id,
const CefString& label) OVERRIDE;
virtual bool InsertSeparatorAt(int index) OVERRIDE;
virtual bool InsertSeparatorAt(int index, MenuSeparatorType type) OVERRIDE;
virtual bool InsertItemAt(int index, int command_id,
const CefString& label) OVERRIDE;
virtual bool InsertCheckItemAt(int index, int command_id,
@ -61,6 +61,7 @@ class CefMenuModelCToCpp
virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE;
virtual MenuItemType GetType(int command_id) OVERRIDE;
virtual MenuItemType GetTypeAt(int index) OVERRIDE;
virtual MenuSeparatorType GetSeparatorTypeAt(int index) OVERRIDE;
virtual int GetGroupId(int command_id) OVERRIDE;
virtual int GetGroupIdAt(int index) OVERRIDE;
virtual bool SetGroupId(int command_id, int group_id) OVERRIDE;

View File

@ -222,6 +222,13 @@ void ClientApp::GetProxyForUrl(const CefString& url,
CefString(&proxy_info.proxyList) = proxy_config_;
}
void ClientApp::OnRenderThreadCreated() {
// Execute delegate callbacks.
RenderDelegateSet::iterator it = render_delegates_.begin();
for (; it != render_delegates_.end(); ++it)
(*it)->OnRenderThreadCreated(this);
}
void ClientApp::OnWebKitInitialized() {
// Register the client_app extension.
std::string app_code =

View File

@ -23,9 +23,13 @@ class ClientApp : public CefApp,
// constructor.
class RenderDelegate : public virtual CefBase {
public:
// Called after the render process main thread has been created.
virtual void OnRenderThreadCreated(CefRefPtr<ClientApp> app) {
}
// Called when WebKit is initialized. Used to register V8 extensions.
virtual void OnWebKitInitialized(CefRefPtr<ClientApp> app) {
};
}
// Called when a V8 context is created. Used to create V8 window bindings
// and set message callbacks. RenderDelegates should check for unique URLs
@ -34,7 +38,7 @@ class ClientApp : public CefApp,
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context) {
};
}
// Called when a V8 context is released. Used to clean up V8 window
// bindings. RenderDelegates should check for unique URLs to avoid
@ -43,7 +47,7 @@ class ClientApp : public CefApp,
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context) {
};
}
// Called when the focused node in a frame has changed.
virtual void OnFocusedNodeChanged(CefRefPtr<ClientApp> app,
@ -120,6 +124,7 @@ class ClientApp : public CefApp,
CefProxyInfo& proxy_info) OVERRIDE;
// CefRenderProcessHandler methods.
virtual void OnRenderThreadCreated() OVERRIDE;
virtual void OnWebKitInitialized() OVERRIDE;
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,

View File

@ -94,7 +94,7 @@ void ClientHandler::OnBeforeContextMenu(
if ((params->GetTypeFlags() & (CM_TYPEFLAG_PAGE | CM_TYPEFLAG_FRAME)) != 0) {
// Add a separator if the menu already has items.
if (model->GetCount() > 0)
model->AddSeparator();
model->AddSeparator(MENUSEPARATORTYPE_NORMAL);
// Add a "Show DevTools" item to all context menus.
model->AddItem(CLIENT_ID_SHOW_DEVTOOLS, "&Show DevTools");
@ -490,7 +490,7 @@ void ClientHandler::CreateRequestDelegates(RequestDelegateSet& delegates) {
void ClientHandler::BuildTestMenu(CefRefPtr<CefMenuModel> model) {
if (model->GetCount() > 0)
model->AddSeparator();
model->AddSeparator(MENUSEPARATORTYPE_NORMAL);
// Build the sub menu.
CefRefPtr<CefMenuModel> submenu =