libcef: Update due to underlying chromium changes.

- Files moved out of base.
- WebKit API changes.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@53 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2009-10-13 01:39:30 +00:00
parent 144e15c966
commit 09a8c28773
20 changed files with 183 additions and 106 deletions

View File

@@ -17,7 +17,7 @@ MSVC_POP_WARNING();
#include "browser_webkit_glue.h"
#undef LOG
#include "base/gfx/gdi_util.h"
#include "app/gfx/gdi_util.h"
#include "base/logging.h"
#include "skia/ext/platform_canvas.h"
#include "webkit/api/public/WebRect.h"

View File

@@ -20,6 +20,7 @@
#include "webkit/api/public/WebData.h"
#include "webkit/api/public/WebKit.h"
#include "webkit/api/public/WebStorageArea.h"
#include "webkit/api/public/WebStorageEventDispatcher.h"
#include "webkit/api/public/WebStorageNamespace.h"
#include "webkit/api/public/WebString.h"
#include "webkit/api/public/WebURL.h"
@@ -165,14 +166,30 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
}
virtual WebKit::WebStorageNamespace* createLocalStorageNamespace(
const WebKit::WebString& path) {
return WebKit::WebStorageNamespace::createLocalStorageNamespace(path);
const WebKit::WebString& path, unsigned quota) {
return WebKit::WebStorageNamespace::createLocalStorageNamespace(path,
quota);
}
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace() {
return WebKit::WebStorageNamespace::createSessionStorageNamespace();
}
void dispatchStorageEvent(const WebKit::WebString& key,
const WebKit::WebString& old_value, const WebKit::WebString& new_value,
const WebKit::WebString& origin, bool is_local_storage) {
// TODO(jorlow): Implement
if (!is_local_storage)
return;
if (!dom_storage_event_dispatcher_.get()) {
dom_storage_event_dispatcher_.reset(
WebKit::WebStorageEventDispatcher::create());
}
dom_storage_event_dispatcher_->dispatchStorageEvent(key, old_value,
new_value, origin, is_local_storage);
}
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
WebKit::WebApplicationCacheHostClient* client) {
return BrowserAppCacheSystem::CreateApplicationCacheHost(client);
@@ -184,6 +201,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
ScopedTempDir appcache_dir_;
BrowserAppCacheSystem appcache_system_;
BrowserDatabaseSystem database_system_;
scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_;
};
#endif // _BROWSER_WEBKIT_INIT_H

View File

@@ -16,16 +16,17 @@
#include "request_impl.h"
#include "v8_impl.h"
#include "app/gfx/gdi_util.h"
#include "app/gfx/native_widget_types.h"
#include "base/file_util.h"
#include "base/gfx/gdi_util.h"
#include "base/gfx/point.h"
#include "base/gfx/native_widget_types.h"
#include "base/message_loop.h"
#include "base/process_util.h"
#include "base/string_util.h"
#include "base/trace_event.h"
#include "net/base/net_errors.h"
#include "webkit/api/public/WebConsoleMessage.h"
#include "webkit/api/public/WebContextMenuData.h"
#include "webkit/api/public/WebCString.h"
#include "webkit/appcache/appcache_interfaces.h"
#include "webkit/api/public/WebData.h"
@@ -67,6 +68,7 @@
#endif
using WebKit::WebConsoleMessage;
using WebKit::WebContextMenuData;
using WebKit::WebData;
using WebKit::WebDataSource;
using WebKit::WebDragData;
@@ -258,10 +260,21 @@ WebString BrowserWebViewDelegate::autoCorrectWord(const WebString& word) {
void BrowserWebViewDelegate::showSpellingUI(bool show) {
}
bool BrowserWebViewDelegate::isShowingSpellingUI() {
return false;
}
void BrowserWebViewDelegate::updateSpellingUIWithMisspelledWord(
const WebKit::WebString& word) {
}
bool BrowserWebViewDelegate::runFileChooser(
bool multi_select, const WebKit::WebString& title,
const WebKit::WebString& initial_value,
WebKit::WebFileChooserCompletion* chooser_completion) {
return false;
}
void BrowserWebViewDelegate::runModalAlertDialog(
WebFrame* frame, const WebString& message) {
std::wstring messageStr = UTF16ToWideHack(message);
@@ -387,6 +400,9 @@ int BrowserWebViewDelegate::historyForwardListCount() {
void BrowserWebViewDelegate::didAddHistoryItem() {
}
void BrowserWebViewDelegate::didUpdateInspectorSettings() {
}
// WebWidgetClient -----------------------------------------------------------
void BrowserWebViewDelegate::didInvalidateRect(const WebRect& rect) {
@@ -465,8 +481,8 @@ void BrowserWebViewDelegate::loadURLExternally(
WebNavigationPolicy BrowserWebViewDelegate::decidePolicyForNavigation(
WebFrame* frame, const WebURLRequest& request,
WebNavigationType type, WebNavigationPolicy default_policy,
bool is_redirect) {
WebNavigationType type, const WebNode& originating_node,
WebNavigationPolicy default_policy, bool is_redirect) {
CefRefPtr<CefHandler> handler = browser_->GetHandler();
if(handler.get()) {
// Gather browse request information
@@ -701,13 +717,31 @@ void BrowserWebViewDelegate::didRunInsecureContent(
WebFrame* frame, const WebKit::WebSecurityOrigin& origin) {
}
void BrowserWebViewDelegate::didExhaustMemoryAvailableForScript(WebFrame* frame) {
void BrowserWebViewDelegate::didExhaustMemoryAvailableForScript(
WebFrame* frame) {
}
void BrowserWebViewDelegate::didCreateScriptContext(WebKit::WebFrame* frame) {
}
void BrowserWebViewDelegate::didDestroyScriptContext(WebKit::WebFrame* frame) {
}
void BrowserWebViewDelegate::didCreateIsolatedScriptContext(
WebKit::WebFrame* frame) {
}
void BrowserWebViewDelegate::didChangeContentsSize(
WebFrame* frame, const WebSize&) {
}
void BrowserWebViewDelegate::reportFindInPageMatchCount(
int identifier, int count, bool final_update) {
}
void BrowserWebViewDelegate::reportFindInPageSelection(
int identifier, int ordinal, const WebKit::WebRect& selection) {
}
// Public methods ------------------------------------------------------------

View File

@@ -21,6 +21,7 @@
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "base/weak_ptr.h"
#include "webkit/api/public/WebContextMenuData.h"
#include "webkit/api/public/WebFrameClient.h"
#include "webkit/api/public/WebRect.h"
#include "webkit/glue/webcursor.h"
@@ -33,7 +34,6 @@
#include "browser_navigation_controller.h"
class CefBrowserImpl;
struct ContextMenuMediaParams;
struct WebPreferences;
class GURL;
class WebWidgetHost;
@@ -43,22 +43,6 @@ class BrowserWebViewDelegate : public WebViewDelegate,
public webkit_glue::WebPluginPageDelegate,
public base::SupportsWeakPtr<BrowserWebViewDelegate> {
public:
// WebViewDelegate
virtual void ShowContextMenu(WebView* webview,
ContextNodeType node_type,
int x,
int y,
const GURL& link_url,
const GURL& image_url,
const GURL& page_url,
const GURL& frame_url,
const ContextMenuMediaParams& media_params,
const std::wstring& selection_text,
const std::wstring& misspelled_word,
int edit_flags,
const std::string& security_info,
const std::string& frame_charset);
// WebKit::WebViewClient
virtual WebView* createView(WebKit::WebFrame* creator);
virtual WebKit::WebWidget* createPopupMenu(bool activatable);
@@ -99,8 +83,13 @@ class BrowserWebViewDelegate : public WebViewDelegate,
virtual WebKit::WebString autoCorrectWord(
const WebKit::WebString& misspelled_word);
virtual void showSpellingUI(bool show);
virtual bool isShowingSpellingUI();
virtual void updateSpellingUIWithMisspelledWord(
const WebKit::WebString& word);
virtual bool runFileChooser(
bool multi_select, const WebKit::WebString& title,
const WebKit::WebString& initial_value,
WebKit::WebFileChooserCompletion* chooser_completion);
virtual void runModalAlertDialog(
WebKit::WebFrame* frame, const WebKit::WebString& message);
virtual bool runModalConfirmDialog(
@@ -110,6 +99,8 @@ class BrowserWebViewDelegate : public WebViewDelegate,
const WebKit::WebString& default_value, WebKit::WebString* actual_value);
virtual bool runModalBeforeUnloadDialog(
WebKit::WebFrame* frame, const WebKit::WebString& message);
virtual void showContextMenu(
WebKit::WebFrame* frame, const WebKit::WebContextMenuData& data);
virtual void setStatusText(const WebKit::WebString& text);
virtual void setMouseOverURL(const WebKit::WebURL& url);
virtual void setToolTipText(
@@ -124,6 +115,7 @@ class BrowserWebViewDelegate : public WebViewDelegate,
virtual int historyBackListCount();
virtual int historyForwardListCount();
virtual void didAddHistoryItem();
virtual void didUpdateInspectorSettings();
// WebKit::WebWidgetClient
virtual void didInvalidateRect(const WebKit::WebRect& rect);
@@ -154,8 +146,8 @@ class BrowserWebViewDelegate : public WebViewDelegate,
WebKit::WebNavigationPolicy);
virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
WebKit::WebFrame*, const WebKit::WebURLRequest&,
WebKit::WebNavigationType, WebKit::WebNavigationPolicy default_policy,
bool isRedirect);
WebKit::WebNavigationType, const WebKit::WebNode&,
WebKit::WebNavigationPolicy default_policy, bool isRedirect);
virtual void willSubmitForm(WebKit::WebFrame*, const WebKit::WebForm&);
virtual void willPerformClientRedirect(
WebKit::WebFrame*, const WebKit::WebURL& from, const WebKit::WebURL& to,
@@ -204,8 +196,15 @@ class BrowserWebViewDelegate : public WebViewDelegate,
virtual void didRunInsecureContent(
WebKit::WebFrame* frame, const WebKit::WebSecurityOrigin& origin);
virtual void didExhaustMemoryAvailableForScript(WebKit::WebFrame*);
virtual void didCreateScriptContext(WebKit::WebFrame* frame);
virtual void didDestroyScriptContext(WebKit::WebFrame* frame);
virtual void didCreateIsolatedScriptContext(WebKit::WebFrame* frame);
virtual void didChangeContentsSize(
WebKit::WebFrame*, const WebKit::WebSize&);
virtual void reportFindInPageMatchCount(
int identifier, int count, bool final_update);
virtual void reportFindInPageSelection(
int identifier, int ordinal, const WebKit::WebRect& selection);
// webkit_glue::WebPluginPageDelegate
virtual webkit_glue::WebPluginDelegate* CreatePluginDelegate(

View File

@@ -18,13 +18,14 @@
#include <shlobj.h>
#include <shlwapi.h>
#include "base/gfx/gdi_util.h"
#include "base/gfx/native_widget_types.h"
#include "app/gfx/gdi_util.h"
#include "app/gfx/native_widget_types.h"
#include "base/gfx/point.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/trace_event.h"
#include "net/base/net_errors.h"
#include "webkit/api/public/WebContextMenuData.h"
#include "webkit/api/public/WebCursorInfo.h"
#include "webkit/api/public/WebFrame.h"
#include "webkit/api/public/WebRect.h"
@@ -37,6 +38,7 @@
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
#include "webkit/glue/window_open_disposition.h"
using WebKit::WebContextMenuData;
using WebKit::WebCursorInfo;
using WebKit::WebFrame;
using WebKit::WebNavigationPolicy;
@@ -244,23 +246,10 @@ static void AddMenuSeparator(HMENU menu, int index)
InsertMenuItem(menu, index, TRUE, &mii);
}
void BrowserWebViewDelegate::ShowContextMenu(
WebView* webview,
ContextNodeType node_type,
int x,
int y,
const GURL& link_url,
const GURL& image_url,
const GURL& page_url,
const GURL& frame_url,
const ContextMenuMediaParams& media_params,
const std::wstring& selection_text,
const std::wstring& misspelled_word,
int edit_flags,
const std::string& security_info,
const std::string& frame_charset) {
POINT screen_pt = { x, y };
void BrowserWebViewDelegate::showContextMenu(
WebFrame* frame, const WebContextMenuData& data)
{
POINT screen_pt = { data.mousePosition.x, data.mousePosition.y };
MapWindowPoints(browser_->GetMainWndHandle(), HWND_DESKTOP,
&screen_pt, 1);
@@ -272,34 +261,58 @@ void BrowserWebViewDelegate::ShowContextMenu(
bool old_state = MessageLoop::current()->NestableTasksAllowed();
MessageLoop::current()->SetNestableTasksAllowed(true);
int edit_flags = data.editFlags;
if(browser_->UIT_CanGoBack())
edit_flags |= MENU_CAN_GO_BACK;
if(browser_->UIT_CanGoForward())
edit_flags |= MENU_CAN_GO_FORWARD;
int type_flags = MENUTYPE_NONE;
if(!data.pageURL.isEmpty())
type_flags |= MENUTYPE_PAGE;
if(!data.frameURL.isEmpty())
type_flags |= MENUTYPE_FRAME;
if(!data.linkURL.isEmpty())
type_flags |= MENUTYPE_LINK;
if(data.mediaType == WebContextMenuData::MediaTypeImage)
type_flags |= MENUTYPE_IMAGE;
if(!data.selectedText.isEmpty())
type_flags |= MENUTYPE_SELECTION;
if(data.isEditable)
type_flags |= MENUTYPE_EDITABLE;
if(data.isSpellCheckingEnabled && !data.misspelledWord.isEmpty())
type_flags |= MENUTYPE_MISSPELLED_WORD;
if(data.mediaType == WebContextMenuData::MediaTypeVideo)
type_flags |= MENUTYPE_VIDEO;
if(data.mediaType == WebContextMenuData::MediaTypeAudio)
type_flags |= MENUTYPE_AUDIO;
CefRefPtr<CefHandler> handler = browser_->GetHandler();
if(handler.get()) {
// Gather menu information
CefHandler::MenuInfo menuInfo;
std::wstring linkstr, imagestr, pagestr, framestr, securitystr;
std::wstring linkStr, imageStr, pageStr, frameStr;
std::wstring selectedTextStr, misspelledWordStr, securityInfoStr;
linkstr = UTF8ToWide(link_url.spec().c_str());
imagestr = UTF8ToWide(image_url.spec().c_str());
pagestr = UTF8ToWide(page_url.spec().c_str());
framestr = UTF8ToWide(frame_url.spec().c_str());
securitystr = UTF8ToWide(security_info);
linkStr = UTF16ToWideHack(data.linkURL.spec().utf16());
imageStr = UTF16ToWideHack(data.srcURL.spec().utf16());
pageStr = UTF16ToWideHack(data.pageURL.spec().utf16());
frameStr = UTF16ToWideHack(data.frameURL.spec().utf16());
selectedTextStr = UTF16ToWideHack(data.selectedText);
misspelledWordStr = UTF16ToWideHack(data.misspelledWord);
securityInfoStr = UTF16ToWideHack(data.securityInfo.utf16());
menuInfo.typeFlags = node_type.type;
menuInfo.typeFlags = type_flags;
menuInfo.x = screen_pt.x;
menuInfo.y = screen_pt.y;
menuInfo.linkUrl = linkstr.c_str();
menuInfo.imageUrl = imagestr.c_str();
menuInfo.pageUrl = pagestr.c_str();
menuInfo.frameUrl = framestr.c_str();
menuInfo.selectionText = selection_text.c_str();
menuInfo.misspelledWord = misspelled_word.c_str();
menuInfo.linkUrl = linkStr.c_str();
menuInfo.imageUrl = imageStr.c_str();
menuInfo.pageUrl = pageStr.c_str();
menuInfo.frameUrl = frameStr.c_str();
menuInfo.selectionText = selectedTextStr.c_str();
menuInfo.misspelledWord = misspelledWordStr.c_str();
menuInfo.editFlags = edit_flags;
menuInfo.securityInfo = securitystr.c_str();
menuInfo.securityInfo = securityInfoStr.c_str();
// Notify the handler that a context menu is requested
CefHandler::RetVal rv = handler->HandleBeforeMenu(browser_, menuInfo);
@@ -308,30 +321,29 @@ void BrowserWebViewDelegate::ShowContextMenu(
}
// Build the correct default context menu
if (node_type.type & ContextNodeType::EDITABLE) {
if (type_flags & MENUTYPE_EDITABLE) {
menu = CreatePopupMenu();
AddMenuItem(browser_, menu, -1, MENU_ID_UNDO, L"Undo",
!!(edit_flags & ContextNodeType::CAN_UNDO), label_list);
!!(edit_flags & WebContextMenuData::CanUndo), label_list);
AddMenuItem(browser_, menu, -1, MENU_ID_REDO, L"Redo",
!!(edit_flags & ContextNodeType::CAN_REDO), label_list);
!!(edit_flags & WebContextMenuData::CanRedo), label_list);
AddMenuSeparator(menu, -1);
AddMenuItem(browser_, menu, -1, MENU_ID_CUT, L"Cut",
!!(edit_flags & ContextNodeType::CAN_CUT), label_list);
!!(edit_flags & WebContextMenuData::CanCut), label_list);
AddMenuItem(browser_, menu, -1, MENU_ID_COPY, L"Copy",
!!(edit_flags & ContextNodeType::CAN_COPY), label_list);
!!(edit_flags & WebContextMenuData::CanCopy), label_list);
AddMenuItem(browser_, menu, -1, MENU_ID_PASTE, L"Paste",
!!(edit_flags & ContextNodeType::CAN_PASTE), label_list);
!!(edit_flags & WebContextMenuData::CanPaste), label_list);
AddMenuItem(browser_, menu, -1, MENU_ID_DELETE, L"Delete",
!!(edit_flags & ContextNodeType::CAN_DELETE), label_list);
!!(edit_flags & WebContextMenuData::CanDelete), label_list);
AddMenuSeparator(menu, -1);
AddMenuItem(browser_, menu, -1, MENU_ID_SELECTALL, L"Select All",
!!(edit_flags & MENU_CAN_SELECT_ALL), label_list);
} else if(node_type.type & ContextNodeType::SELECTION) {
} else if(type_flags & MENUTYPE_SELECTION) {
menu = CreatePopupMenu();
AddMenuItem(browser_, menu, -1, MENU_ID_COPY, L"Copy",
!!(edit_flags & ContextNodeType::CAN_COPY), label_list);
} else if(node_type.type &
(ContextNodeType::PAGE | ContextNodeType::FRAME)) {
!!(edit_flags & WebContextMenuData::CanCopy), label_list);
} else if(type_flags & (MENUTYPE_PAGE | MENUTYPE_FRAME)) {
menu = CreatePopupMenu();
AddMenuItem(browser_, menu, -1, MENU_ID_NAV_BACK, L"Back",
browser_->UIT_CanGoBack(), label_list);

View File

@@ -12,7 +12,7 @@
#include "../include/cef_nplugin.h"
#include "base/command_line.h"
#include "base/icu_util.h"
#include "base/i18n/icu_util.h"
#include "base/path_service.h"
#include "base/rand_util.h"
#include "base/resource_util.h"

View File

@@ -7,10 +7,10 @@
#define _CONTEXT_H
#include "../include/cef.h"
#include "app/gfx/native_widget_types.h"
#include "base/at_exit.h"
#include "base/message_loop.h"
#include "base/stats_table.h"
#include "base/gfx/native_widget_types.h"
#include "webkit/glue/webpreferences.h"
class BrowserWebKitInit;

View File

@@ -7,9 +7,9 @@
#include <winspool.h>
#include "base/file_util.h"
#include "base/i18n/time_formatting.h"
#include "base/message_loop.h"
#include "base/time.h"
#include "base/time_format.h"
#include "skia/ext/platform_device_win.h"
using base::Time;

View File

@@ -6,7 +6,7 @@
#include <string>
#include "base/clipboard.h"
#include "app/clipboard/clipboard.h"
#include "base/lazy_instance.h"
#include "base/string16.h"
#include "googleurl/src/gurl.h"

View File

@@ -5,7 +5,6 @@
#include "webview_host.h"
#include "browser_webview_delegate.h"
#include "base/gfx/platform_canvas.h"
#include "base/gfx/rect.h"
#include "base/gfx/size.h"
#include "base/win_util.h"

View File

@@ -6,7 +6,7 @@
#define _WEBVIEW_HOST_H
#include "base/basictypes.h"
#include "base/gfx/native_widget_types.h"
#include "app/gfx/native_widget_types.h"
#include "base/gfx/rect.h"
#include "webwidget_host.h"

View File

@@ -5,7 +5,6 @@
#include "webwidget_host.h"
#include "base/gfx/platform_canvas.h"
#include "base/gfx/rect.h"
#include "base/logging.h"
#include "base/win_util.h"

View File

@@ -6,8 +6,7 @@
#define _WEBWIDGET_HOST_H
#include "base/basictypes.h"
#include "base/gfx/native_widget_types.h"
#include "base/gfx/platform_canvas.h"
#include "app/gfx/native_widget_types.h"
#include "base/gfx/rect.h"
#include "base/scoped_ptr.h"
#include "skia/ext/platform_canvas.h"