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_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. # Modify the Info.plist as needed.
'postbuild_name': 'Tweak Info.plist', 'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py', 'action': ['../build/mac/tweak_info_plist.py',
'--svn=1'], '--scm=1'],
}, },
{ {
# This postbuid step is responsible for creating the following # This postbuid step is responsible for creating the following
@ -337,7 +337,7 @@
# Modify the Info.plist as needed. # Modify the Info.plist as needed.
'postbuild_name': 'Tweak Info.plist', 'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py', 'action': ['../build/mac/tweak_info_plist.py',
'--svn=1'], '--scm=1'],
}, },
{ {
# This postbuid step is responsible for creating the following # This postbuid step is responsible for creating the following
@ -932,6 +932,7 @@
'<@(includes_linux)', '<@(includes_linux)',
'libcef/browser/browser_host_impl_gtk.cc', 'libcef/browser/browser_host_impl_gtk.cc',
'libcef/browser/browser_main_gtk.cc', 'libcef/browser/browser_main_gtk.cc',
'libcef/browser/download_manager_delegate_gtk.cc',
'libcef/browser/gtk_util_stub.cc', 'libcef/browser/gtk_util_stub.cc',
'libcef/browser/javascript_dialog_gtk.cc', 'libcef/browser/javascript_dialog_gtk.cc',
'libcef/browser/menu_creator_runner_gtk.cc', 'libcef/browser/menu_creator_runner_gtk.cc',
@ -1024,14 +1025,14 @@
{ {
# Modify the Info.plist as needed. The script explains why this # Modify the Info.plist as needed. The script explains why this
# is needed. This is also done in the chrome and chrome_dll # is needed. This is also done in the chrome and chrome_dll
# targets. In this case, --breakpad=0, --keystone=0, and --svn=0 # targets. In this case, --breakpad=0, --keystone=0, and --scm=0
# are used because Breakpad, Keystone, and Subversion keys are # are used because Breakpad, Keystone, and SCM keys are
# never placed into the helper. # never placed into the helper.
'postbuild_name': 'Tweak Info.plist', 'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py', 'action': ['../build/mac/tweak_info_plist.py',
'--breakpad=0', '--breakpad=0',
'--keystone=0', '--keystone=0',
'--svn=0'], '--scm=0'],
}, },
], ],
}, # target cefclient_helper_app }, # target cefclient_helper_app
@ -1113,14 +1114,14 @@
{ {
# Modify the Info.plist as needed. The script explains why this # Modify the Info.plist as needed. The script explains why this
# is needed. This is also done in the chrome and chrome_dll # is needed. This is also done in the chrome and chrome_dll
# targets. In this case, --breakpad=0, --keystone=0, and --svn=0 # targets. In this case, --breakpad=0, --keystone=0, and --scm=0
# are used because Breakpad, Keystone, and Subversion keys are # are used because Breakpad, Keystone, and SCM keys are
# never placed into the helper. # never placed into the helper.
'postbuild_name': 'Tweak Info.plist', 'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py', 'action': ['../build/mac/tweak_info_plist.py',
'--breakpad=0', '--breakpad=0',
'--keystone=0', '--keystone=0',
'--svn=0'], '--scm=0'],
}, },
], ],
}, # target cef_unittests_helper_app }, # 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); int (CEF_CALLBACK *is_popup)(struct _cef_browser_t* self);
///
// Returns true (1) if a document has been loaded in the browser. // Returns true (1) if a document has been loaded in the browser.
///
int (CEF_CALLBACK *has_document)(struct _cef_browser_t* self); 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. // 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. // Add an item to the menu. Returns true (1) on success.
@ -103,7 +104,7 @@ typedef struct _cef_menu_model_t {
// on success. // on success.
/// ///
int (CEF_CALLBACK *insert_separator_at)(struct _cef_menu_model_t* self, 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 // 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)( enum cef_menu_item_type_t (CEF_CALLBACK *get_type_at)(
struct _cef_menu_model_t* self, int index); 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. // 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 // 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 { typedef struct _cef_v8value_t {
/// ///

View File

@ -50,6 +50,7 @@
class CefMenuModel : public virtual CefBase { class CefMenuModel : public virtual CefBase {
public: public:
typedef cef_menu_item_type_t MenuItemType; typedef cef_menu_item_type_t MenuItemType;
typedef cef_menu_separator_type_t MenuSeparatorType;
/// ///
// Clears the menu. Returns true on success. // 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. // Add a separator to the menu. Returns true on success.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool AddSeparator() =0; virtual bool AddSeparator(MenuSeparatorType type) =0;
// //
// Add an item to the menu. Returns true on success. // Add an item to the menu. Returns true on success.
@ -103,7 +104,7 @@ class CefMenuModel : public virtual CefBase {
// success. // success.
/// ///
/*--cef()--*/ /*--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 // 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)--*/ /*--cef(default_retval=MENUITEMTYPE_NONE)--*/
virtual MenuItemType GetTypeAt(int index) =0; 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. // 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, 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. // Supported context menu type flags.
/// ///

View File

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

View File

@ -32,7 +32,9 @@ class CefBrowserContext : public content::BrowserContext {
virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
int renderer_child_id) OVERRIDE; 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::ResourceContext* GetResourceContext() OVERRIDE;
virtual content::GeolocationPermissionContext* virtual content::GeolocationPermissionContext*
GetGeolocationPermissionContext() OVERRIDE; GetGeolocationPermissionContext() OVERRIDE;

View File

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

View File

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

View File

@ -137,7 +137,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
FilePath result; FilePath result;
if (show_dialog) { 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(); WebContents* web_contents = item->GetWebContents();
result = CefDownloadManagerDelegate::PlatformChooseDownloadPath( result = CefDownloadManagerDelegate::PlatformChooseDownloadPath(
web_contents, suggested_path); 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_UNDO, GetLabel(IDS_MENU_UNDO));
model_->AddItem(MENU_ID_REDO, GetLabel(IDS_MENU_REDO)); 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_CUT, GetLabel(IDS_MENU_CUT));
model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY)); model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY));
model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_MENU_PASTE)); model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_MENU_PASTE));
model_->AddItem(MENU_ID_DELETE, GetLabel(IDS_MENU_DELETE)); 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)); model_->AddItem(MENU_ID_SELECT_ALL, GetLabel(IDS_MENU_SELECT_ALL));
if (!(params_.edit_flags & CM_EDITFLAG_CAN_UNDO)) 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_BACK, GetLabel(IDS_MENU_BACK));
model_->AddItem(MENU_ID_FORWARD, GetLabel(IDS_MENU_FORWARD)); 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_PRINT, GetLabel(IDS_MENU_PRINT));
model_->AddItem(MENU_ID_VIEW_SOURCE, GetLabel(IDS_MENU_VIEW_SOURCE)); 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 { virtual int GetCommandIdAt(int index) const OVERRIDE {
return impl_->GetCommandIdAt(index); return impl_->GetCommandIdAt(index);
} }
@ -99,7 +103,7 @@ class CefSimpleMenuModel : public ui::MenuModel {
return impl_->GetGroupIdAt(index); return impl_->GetGroupIdAt(index);
} }
virtual bool GetIconAt(int index, gfx::ImageSkia* icon) OVERRIDE { virtual bool GetIconAt(int index, gfx::Image* icon) OVERRIDE {
return false; return false;
} }
@ -163,6 +167,7 @@ struct CefMenuModelImpl::Item {
const CefString& label, const CefString& label,
int group_id) int group_id)
: type_(type), : type_(type),
separator_type_(MENUSEPARATORTYPE_NONE),
command_id_(command_id), command_id_(command_id),
label_(label), label_(label),
group_id_(group_id), group_id_(group_id),
@ -178,6 +183,7 @@ struct CefMenuModelImpl::Item {
// Basic information. // Basic information.
cef_menu_item_type_t type_; cef_menu_item_type_t type_;
cef_menu_separator_type_t separator_type_;
int command_id_; int command_id_;
CefString label_; CefString label_;
int group_id_; int group_id_;
@ -221,11 +227,17 @@ int CefMenuModelImpl::GetCount() {
return static_cast<int>(items_.size()); return static_cast<int>(items_.size());
} }
bool CefMenuModelImpl::AddSeparator() { bool CefMenuModelImpl::AddSeparator(MenuSeparatorType type) {
if (!VerifyContext()) if (!VerifyContext())
return false; 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; return true;
} }
@ -265,12 +277,17 @@ CefRefPtr<CefMenuModel> CefMenuModelImpl::AddSubMenu(int command_id,
return item.submenu_.get(); return item.submenu_.get();
} }
bool CefMenuModelImpl::InsertSeparatorAt(int index) { bool CefMenuModelImpl::InsertSeparatorAt(int index, MenuSeparatorType type) {
if (!VerifyContext()) if (!VerifyContext())
return false; return false;
InsertItemAt(Item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1), DCHECK(type != MENUSEPARATORTYPE_NONE);
index); if (type == MENUSEPARATORTYPE_NONE)
return false;
Item item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1);
item.separator_type_ = type;
InsertItemAt(item, index);
return true; return true;
} }
@ -400,6 +417,16 @@ CefMenuModelImpl::MenuItemType CefMenuModelImpl::GetTypeAt(int index) {
return MENUITEMTYPE_NONE; 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) { int CefMenuModelImpl::GetGroupId(int command_id) {
return GetGroupIdAt(GetIndexOf(command_id)); return GetGroupIdAt(GetIndexOf(command_id));
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,7 +43,8 @@ int CEF_CALLBACK menu_model_get_count(struct _cef_menu_model_t* self) {
return _retval; 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 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -51,7 +52,8 @@ int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self) {
return 0; return 0;
// Execute // Execute
bool _retval = CefMenuModelCppToC::Get(self)->AddSeparator(); bool _retval = CefMenuModelCppToC::Get(self)->AddSeparator(
type);
// Return type: bool // Return type: bool
return _retval; 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 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 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -153,7 +155,8 @@ int CEF_CALLBACK menu_model_insert_separator_at(struct _cef_menu_model_t* self,
// Execute // Execute
bool _retval = CefMenuModelCppToC::Get(self)->InsertSeparatorAt( bool _retval = CefMenuModelCppToC::Get(self)->InsertSeparatorAt(
index); index,
type);
// Return type: bool // Return type: bool
return _retval; return _retval;
@ -437,6 +440,23 @@ enum cef_menu_item_type_t CEF_CALLBACK menu_model_get_type_at(
return _retval; 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 CEF_CALLBACK menu_model_get_group_id(struct _cef_menu_model_t* self,
int command_id) { int command_id) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // 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_.set_label_at = menu_model_set_label_at;
struct_.struct_.get_type = menu_model_get_type; struct_.struct_.get_type = menu_model_get_type;
struct_.struct_.get_type_at = menu_model_get_type_at; 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 = menu_model_get_group_id;
struct_.struct_.get_group_id_at = menu_model_get_group_id_at; struct_.struct_.get_group_id_at = menu_model_get_group_id_at;
struct_.struct_.set_group_id = menu_model_set_group_id; struct_.struct_.set_group_id = menu_model_set_group_id;

View File

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

View File

@ -34,14 +34,14 @@ class CefMenuModelCToCpp
// CefMenuModel methods // CefMenuModel methods
virtual bool Clear() OVERRIDE; virtual bool Clear() OVERRIDE;
virtual int GetCount() 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 AddItem(int command_id, const CefString& label) OVERRIDE;
virtual bool AddCheckItem(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, virtual bool AddRadioItem(int command_id, const CefString& label,
int group_id) OVERRIDE; int group_id) OVERRIDE;
virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id, virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id,
const CefString& label) OVERRIDE; 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, virtual bool InsertItemAt(int index, int command_id,
const CefString& label) OVERRIDE; const CefString& label) OVERRIDE;
virtual bool InsertCheckItemAt(int index, int command_id, virtual bool InsertCheckItemAt(int index, int command_id,
@ -61,6 +61,7 @@ class CefMenuModelCToCpp
virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE; virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE;
virtual MenuItemType GetType(int command_id) OVERRIDE; virtual MenuItemType GetType(int command_id) OVERRIDE;
virtual MenuItemType GetTypeAt(int index) OVERRIDE; virtual MenuItemType GetTypeAt(int index) OVERRIDE;
virtual MenuSeparatorType GetSeparatorTypeAt(int index) OVERRIDE;
virtual int GetGroupId(int command_id) OVERRIDE; virtual int GetGroupId(int command_id) OVERRIDE;
virtual int GetGroupIdAt(int index) OVERRIDE; virtual int GetGroupIdAt(int index) OVERRIDE;
virtual bool SetGroupId(int command_id, int group_id) 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_; 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() { void ClientApp::OnWebKitInitialized() {
// Register the client_app extension. // Register the client_app extension.
std::string app_code = std::string app_code =

View File

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

View File

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