2010-10-03 23:04:50 +02:00
|
|
|
// Copyright (c) 2008-2009 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
// BrowserWebViewDelegate class:
|
2010-10-03 23:04:50 +02:00
|
|
|
// This class implements the WebViewDelegate methods for the test shell. One
|
|
|
|
// instance is owned by each CefBrowser.
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_WEBVIEW_DELEGATE_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_WEBVIEW_DELEGATE_H_
|
|
|
|
#pragma once
|
2010-10-03 23:04:50 +02:00
|
|
|
|
|
|
|
#include <map>
|
2012-01-10 00:46:23 +01:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "libcef/browser_navigation_controller.h"
|
2012-03-22 23:09:09 +01:00
|
|
|
#include "libcef/browser_webcookiejar_impl.h"
|
2010-10-03 23:04:50 +02:00
|
|
|
|
|
|
|
#include "base/basictypes.h"
|
2012-01-10 00:46:23 +01:00
|
|
|
#include "base/compiler_specific.h"
|
2011-09-23 02:16:03 +02:00
|
|
|
#include "base/memory/scoped_ptr.h"
|
2011-04-05 18:17:33 +02:00
|
|
|
#include "base/memory/weak_ptr.h"
|
2011-01-07 22:34:20 +01:00
|
|
|
#include "build/build_config.h"
|
2011-02-15 19:07:24 +01:00
|
|
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
|
|
|
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.h"
|
2011-12-16 15:51:10 +01:00
|
|
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h"
|
2011-02-15 19:07:24 +01:00
|
|
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h"
|
2012-01-05 20:34:20 +01:00
|
|
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPermissionClient.h"
|
2011-12-16 15:51:10 +01:00
|
|
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
|
2011-02-15 19:07:24 +01:00
|
|
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h"
|
2011-01-07 22:34:20 +01:00
|
|
|
#include "webkit/glue/webcursor.h"
|
|
|
|
#include "webkit/plugins/npapi/webplugin_page_delegate.h"
|
2012-01-10 00:46:23 +01:00
|
|
|
|
|
|
|
#if defined(TOOLKIT_USES_GTK)
|
|
|
|
#include <gdk/gdk.h> // NOLINT(build/include_order)
|
|
|
|
#endif
|
2011-01-07 22:34:20 +01:00
|
|
|
|
2010-10-23 19:00:47 +02:00
|
|
|
#if defined(OS_MACOSX)
|
2011-02-15 19:07:24 +01:00
|
|
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h"
|
2012-01-10 00:46:23 +01:00
|
|
|
#include "libcef/external_popup_menu_mac.h"
|
2010-10-23 19:00:47 +02:00
|
|
|
#endif
|
2011-01-07 22:34:20 +01:00
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
#if defined(OS_WIN)
|
2011-02-28 01:33:11 +01:00
|
|
|
class BrowserDragDelegate;
|
|
|
|
class WebDropTarget;
|
2010-10-03 23:04:50 +02:00
|
|
|
#endif
|
2011-01-07 22:34:20 +01:00
|
|
|
|
2012-01-23 20:04:54 +01:00
|
|
|
#if defined(OS_LINUX)
|
|
|
|
class WebDragSource;
|
|
|
|
class WebDropTarget;
|
|
|
|
#endif
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
class CefBrowserImpl;
|
|
|
|
class GURL;
|
|
|
|
class WebWidgetHost;
|
|
|
|
class FilePath;
|
|
|
|
|
|
|
|
class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|
|
|
public WebKit::WebFrameClient,
|
2012-01-05 20:34:20 +01:00
|
|
|
public WebKit::WebPermissionClient,
|
2011-01-07 22:34:20 +01:00
|
|
|
public webkit::npapi::WebPluginPageDelegate,
|
2010-10-03 23:04:50 +02:00
|
|
|
public base::SupportsWeakPtr<BrowserWebViewDelegate> {
|
|
|
|
public:
|
|
|
|
// WebKit::WebViewClient
|
2011-01-12 00:46:14 +01:00
|
|
|
virtual WebKit::WebView* createView(
|
|
|
|
WebKit::WebFrame* creator, const WebKit::WebURLRequest& request,
|
2011-05-20 16:42:25 +02:00
|
|
|
const WebKit::WebWindowFeatures& features, const WebKit::WebString& name)
|
|
|
|
OVERRIDE;
|
|
|
|
virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type)
|
|
|
|
OVERRIDE;
|
2011-04-09 18:54:59 +02:00
|
|
|
virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
|
|
|
|
const WebKit::WebPopupMenuInfo& info,
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebExternalPopupMenuClient* client) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
|
2011-05-20 16:42:25 +02:00
|
|
|
unsigned quota) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void didAddMessageToConsole(
|
|
|
|
const WebKit::WebConsoleMessage& message,
|
2011-05-20 16:42:25 +02:00
|
|
|
const WebKit::WebString& source_name, unsigned source_line) OVERRIDE;
|
|
|
|
virtual void printPage(WebKit::WebFrame* frame) OVERRIDE;
|
|
|
|
virtual bool shouldBeginEditing(const WebKit::WebRange& range) OVERRIDE;
|
|
|
|
virtual bool shouldEndEditing(const WebKit::WebRange& range) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool shouldInsertNode(
|
|
|
|
const WebKit::WebNode& node, const WebKit::WebRange& range,
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebEditingAction action) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool shouldInsertText(
|
|
|
|
const WebKit::WebString& text, const WebKit::WebRange& range,
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebEditingAction action) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool shouldChangeSelectedRange(
|
|
|
|
const WebKit::WebRange& from, const WebKit::WebRange& to,
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebTextAffinity affinity, bool still_selecting) OVERRIDE;
|
|
|
|
virtual bool shouldDeleteRange(const WebKit::WebRange& range) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool shouldApplyStyle(
|
2011-05-20 16:42:25 +02:00
|
|
|
const WebKit::WebString& style, const WebKit::WebRange& range) OVERRIDE;
|
|
|
|
virtual bool isSmartInsertDeleteEnabled() OVERRIDE;
|
|
|
|
virtual bool isSelectTrailingWhitespaceEnabled() OVERRIDE;
|
|
|
|
virtual bool handleCurrentKeyboardEvent() OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool runFileChooser(
|
|
|
|
const WebKit::WebFileChooserParams& params,
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFileChooserCompletion* chooser_completion) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void runModalAlertDialog(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame* frame, const WebKit::WebString& message) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool runModalConfirmDialog(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame* frame, const WebKit::WebString& message) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool runModalPromptDialog(
|
|
|
|
WebKit::WebFrame* frame, const WebKit::WebString& message,
|
2011-05-20 16:42:25 +02:00
|
|
|
const WebKit::WebString& default_value, WebKit::WebString* actual_value)
|
|
|
|
OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool runModalBeforeUnloadDialog(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame* frame, const WebKit::WebString& message) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void showContextMenu(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame* frame, const WebKit::WebContextMenuData& data) OVERRIDE;
|
|
|
|
virtual void setStatusText(const WebKit::WebString& text) OVERRIDE;
|
|
|
|
virtual void setMouseOverURL(const WebKit::WebURL& url) OVERRIDE;
|
|
|
|
virtual void setKeyboardFocusURL(const WebKit::WebURL& url) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void setToolTipText(
|
2011-05-20 16:42:25 +02:00
|
|
|
const WebKit::WebString& text, WebKit::WebTextDirection hint) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void startDragging(
|
|
|
|
const WebKit::WebDragData& data,
|
|
|
|
WebKit::WebDragOperationsMask mask,
|
|
|
|
const WebKit::WebImage& image,
|
2011-05-20 16:42:25 +02:00
|
|
|
const WebKit::WebPoint& image_offset) OVERRIDE;
|
2011-10-19 18:37:31 +02:00
|
|
|
virtual bool acceptsLoadDrops() OVERRIDE;
|
2011-05-20 16:42:25 +02:00
|
|
|
virtual void focusNext() OVERRIDE;
|
|
|
|
virtual void focusPrevious() OVERRIDE;
|
2011-10-14 14:40:40 +02:00
|
|
|
virtual void focusedNodeChanged(const WebKit::WebNode& node) OVERRIDE;
|
2011-05-20 16:42:25 +02:00
|
|
|
virtual void navigateBackForwardSoon(int offset) OVERRIDE;
|
|
|
|
virtual int historyBackListCount() OVERRIDE;
|
|
|
|
virtual int historyForwardListCount() OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
|
|
|
|
// WebKit::WebWidgetClient
|
2011-05-20 16:42:25 +02:00
|
|
|
virtual void didInvalidateRect(const WebKit::WebRect& rect) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void didScrollRect(int dx, int dy,
|
2011-05-20 16:42:25 +02:00
|
|
|
const WebKit::WebRect& clip_rect) OVERRIDE;
|
|
|
|
virtual void scheduleComposite() OVERRIDE;
|
|
|
|
virtual void scheduleAnimation() OVERRIDE;
|
|
|
|
virtual void didFocus() OVERRIDE;
|
|
|
|
virtual void didBlur() OVERRIDE;
|
|
|
|
virtual void didChangeCursor(const WebKit::WebCursorInfo& cursor) OVERRIDE;
|
|
|
|
virtual void closeWidgetSoon() OVERRIDE;
|
|
|
|
virtual void show(WebKit::WebNavigationPolicy policy) OVERRIDE;
|
|
|
|
virtual void runModal() OVERRIDE;
|
|
|
|
virtual WebKit::WebRect windowRect() OVERRIDE;
|
|
|
|
virtual void setWindowRect(const WebKit::WebRect& rect) OVERRIDE;
|
|
|
|
virtual WebKit::WebRect rootWindowRect() OVERRIDE;
|
|
|
|
virtual WebKit::WebRect windowResizerRect() OVERRIDE;
|
|
|
|
virtual WebKit::WebScreenInfo screenInfo() OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
|
|
|
|
// WebKit::WebFrameClient
|
|
|
|
virtual WebKit::WebPlugin* createPlugin(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame*, const WebKit::WebPluginParams&) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual WebKit::WebMediaPlayer* createMediaPlayer(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame*, WebKit::WebMediaPlayerClient*) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame* frame, WebKit::WebApplicationCacheHostClient* client)
|
|
|
|
OVERRIDE;
|
2012-03-22 23:09:09 +01:00
|
|
|
virtual WebKit::WebCookieJar* cookieJar(WebKit::WebFrame*) OVERRIDE;
|
2011-05-20 16:42:25 +02:00
|
|
|
virtual void willClose(WebKit::WebFrame*) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void loadURLExternally(
|
|
|
|
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebNavigationPolicy) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
|
|
|
|
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
|
|
|
WebKit::WebNavigationType, const WebKit::WebNode&,
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebNavigationPolicy default_policy, bool isRedirect) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool canHandleRequest(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame*, const WebKit::WebURLRequest&) OVERRIDE { return true; }
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual WebKit::WebURLError cannotHandleRequestError(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame*, const WebKit::WebURLRequest& request) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual WebKit::WebURLError cancelledError(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame*, const WebKit::WebURLRequest& request) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void didCreateDataSource(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame*, WebKit::WebDataSource*) OVERRIDE;
|
|
|
|
virtual void didStartProvisionalLoad(WebKit::WebFrame*) OVERRIDE;
|
|
|
|
virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame*)
|
|
|
|
OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void didFailProvisionalLoad(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame*, const WebKit::WebURLError&) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void didCommitProvisionalLoad(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame*, bool is_new_navigation) OVERRIDE;
|
2011-11-21 22:21:55 +01:00
|
|
|
virtual void didCreateScriptContext(
|
|
|
|
WebKit::WebFrame*, v8::Handle<v8::Context>, int worldId) OVERRIDE;
|
|
|
|
virtual void willReleaseScriptContext(
|
|
|
|
WebKit::WebFrame*, v8::Handle<v8::Context>, int worldId) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void didReceiveTitle(
|
2011-05-16 18:56:12 +02:00
|
|
|
WebKit::WebFrame*, const WebKit::WebString& title,
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebTextDirection direction) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void didFailLoad(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame*, const WebKit::WebURLError&) OVERRIDE;
|
|
|
|
virtual void didFinishLoad(WebKit::WebFrame*) OVERRIDE;
|
2011-03-23 00:53:10 +01:00
|
|
|
virtual void didNavigateWithinPage(
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFrame*, bool isNewNavigation) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void willSendRequest(
|
|
|
|
WebKit::WebFrame*, unsigned identifier, WebKit::WebURLRequest&,
|
2011-05-20 16:42:25 +02:00
|
|
|
const WebKit::WebURLResponse& redirectResponse) OVERRIDE;
|
2011-10-21 16:09:04 +02:00
|
|
|
virtual void didChangeContentsSize(
|
|
|
|
WebKit::WebFrame*, const WebKit::WebSize&) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void reportFindInPageMatchCount(
|
2011-05-20 16:42:25 +02:00
|
|
|
int request_id, int count, bool final_update) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void reportFindInPageSelection(
|
2011-05-20 16:42:25 +02:00
|
|
|
int request_id, int active_match_ordinal, const WebKit::WebRect& sel)
|
|
|
|
OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void openFileSystem(
|
|
|
|
WebKit::WebFrame* frame,
|
|
|
|
WebKit::WebFileSystem::Type type,
|
2012-01-10 00:46:23 +01:00
|
|
|
long long size, // NOLINT(runtime/int)
|
2010-11-16 17:01:14 +01:00
|
|
|
bool create,
|
2011-05-20 16:42:25 +02:00
|
|
|
WebKit::WebFileSystemCallbacks* callbacks) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
|
2012-01-05 20:34:20 +01:00
|
|
|
// WebKit::WebPermissionClient
|
|
|
|
virtual bool allowScriptExtension(
|
|
|
|
WebKit::WebFrame*,
|
|
|
|
const WebKit::WebString& extensionName,
|
|
|
|
int extensionGroup) OVERRIDE;
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
// webkit_glue::WebPluginPageDelegate
|
2011-01-07 22:34:20 +01:00
|
|
|
virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
|
2010-10-03 23:04:50 +02:00
|
|
|
const FilePath& file_path,
|
2011-05-20 16:42:25 +02:00
|
|
|
const std::string& mime_type) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void CreatedPluginWindow(
|
2011-05-20 16:42:25 +02:00
|
|
|
gfx::PluginWindowHandle handle) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void WillDestroyPluginWindow(
|
2011-05-20 16:42:25 +02:00
|
|
|
gfx::PluginWindowHandle handle) OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual void DidMovePlugin(
|
2011-05-20 16:42:25 +02:00
|
|
|
const webkit::npapi::WebPluginGeometry& move) OVERRIDE;
|
|
|
|
virtual void DidStartLoadingForPlugin() OVERRIDE {}
|
|
|
|
virtual void DidStopLoadingForPlugin() OVERRIDE {}
|
|
|
|
virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE;
|
2010-10-03 23:04:50 +02:00
|
|
|
|
2011-11-18 23:10:53 +01:00
|
|
|
explicit BrowserWebViewDelegate(CefBrowserImpl* browser);
|
2011-07-03 02:03:30 +02:00
|
|
|
virtual ~BrowserWebViewDelegate();
|
2010-10-03 23:04:50 +02:00
|
|
|
void Reset();
|
|
|
|
|
|
|
|
void SetSmartInsertDeleteEnabled(bool enabled);
|
|
|
|
void SetSelectTrailingWhitespaceEnabled(bool enabled);
|
|
|
|
|
|
|
|
// Additional accessors
|
2012-01-23 20:04:54 +01:00
|
|
|
#if defined(OS_WIN) || defined(OS_LINUX)
|
2011-08-02 18:50:06 +02:00
|
|
|
// Sets the webview as a drop target.
|
|
|
|
void RegisterDragDrop();
|
2012-01-23 20:04:54 +01:00
|
|
|
#endif
|
|
|
|
#if defined(OS_WIN)
|
2011-08-02 18:50:06 +02:00
|
|
|
void RevokeDragDrop();
|
|
|
|
|
|
|
|
// Called after dragging has finished.
|
|
|
|
void EndDragging();
|
|
|
|
|
2011-02-28 01:33:11 +01:00
|
|
|
BrowserDragDelegate* drag_delegate() { return drag_delegate_.get(); }
|
|
|
|
WebDropTarget* drop_target() { return drop_target_.get(); }
|
2010-10-03 23:04:50 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void set_pending_extra_data(BrowserExtraData* extra_data) {
|
|
|
|
pending_extra_data_.reset(extra_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetCustomPolicyDelegate(bool is_custom, bool is_permissive);
|
|
|
|
void WaitForPolicyDelegate();
|
|
|
|
|
|
|
|
void set_block_redirects(bool block_redirects) {
|
|
|
|
block_redirects_ = block_redirects;
|
|
|
|
}
|
|
|
|
bool block_redirects() const {
|
|
|
|
return block_redirects_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetEditCommand(const std::string& name, const std::string& value) {
|
|
|
|
edit_command_name_ = name;
|
|
|
|
edit_command_value_ = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClearEditCommand() {
|
|
|
|
edit_command_name_.clear();
|
|
|
|
edit_command_value_.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
CefBrowserImpl* GetBrowser() { return browser_; }
|
|
|
|
|
2011-02-02 03:25:32 +01:00
|
|
|
#if defined(OS_MACOSX)
|
2011-04-09 18:54:59 +02:00
|
|
|
// Called after the external popup menu has been dismissed.
|
|
|
|
void ClosePopupMenu();
|
2011-02-02 03:25:32 +01:00
|
|
|
#endif
|
|
|
|
|
2011-10-24 22:20:52 +02:00
|
|
|
#ifdef OS_LINUX
|
|
|
|
void HandleContextMenu(int selected_id);
|
|
|
|
#endif
|
|
|
|
|
2011-11-04 19:19:14 +01:00
|
|
|
bool OnKeyboardEvent(const WebKit::WebKeyboardEvent& event,
|
|
|
|
bool isAfterJavaScript);
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
protected:
|
|
|
|
// Default handling of JavaScript messages.
|
|
|
|
void ShowJavaScriptAlert(WebKit::WebFrame* webframe,
|
2010-11-22 18:49:46 +01:00
|
|
|
const CefString& message);
|
2010-10-03 23:04:50 +02:00
|
|
|
bool ShowJavaScriptConfirm(WebKit::WebFrame* webframe,
|
2010-11-22 18:49:46 +01:00
|
|
|
const CefString& message);
|
2010-10-03 23:04:50 +02:00
|
|
|
bool ShowJavaScriptPrompt(WebKit::WebFrame* webframe,
|
2010-11-22 18:49:46 +01:00
|
|
|
const CefString& message,
|
|
|
|
const CefString& default_value,
|
|
|
|
CefString* result);
|
2010-10-03 23:04:50 +02:00
|
|
|
|
|
|
|
// Called to show the file chooser dialog.
|
2012-01-10 00:46:23 +01:00
|
|
|
bool ShowFileChooser(std::vector<FilePath>& file_names,
|
|
|
|
const bool multi_select,
|
|
|
|
const WebKit::WebString& title,
|
2010-10-03 23:04:50 +02:00
|
|
|
const FilePath& default_file);
|
|
|
|
|
2011-01-26 16:12:49 +01:00
|
|
|
// Called to show status messages.
|
2011-05-20 16:42:25 +02:00
|
|
|
void ShowStatus(const WebKit::WebString& text, cef_handler_statustype_t type);
|
2011-01-26 16:12:49 +01:00
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
// In the Mac code, this is called to trigger the end of a test after the
|
|
|
|
// page has finished loading. From here, we can generate the dump for the
|
|
|
|
// test.
|
|
|
|
void LocationChangeDone(WebKit::WebFrame*);
|
|
|
|
|
|
|
|
WebWidgetHost* GetWidgetHost();
|
|
|
|
|
|
|
|
void UpdateForCommittedLoad(WebKit::WebFrame* webframe,
|
|
|
|
bool is_new_navigation);
|
|
|
|
void UpdateURL(WebKit::WebFrame* frame);
|
|
|
|
void UpdateSessionHistory(WebKit::WebFrame* frame);
|
|
|
|
|
2011-09-12 21:49:38 +02:00
|
|
|
bool OnBeforeMenu(const WebKit::WebContextMenuData& data,
|
|
|
|
int mouse_x,
|
|
|
|
int mouse_y,
|
|
|
|
int& edit_flags,
|
|
|
|
int& type_flags);
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
private:
|
2012-01-10 00:46:23 +01:00
|
|
|
// Causes navigation actions just printout the intended navigation instead
|
2010-10-03 23:04:50 +02:00
|
|
|
// of taking you to the page. This is used for cases like mailto, where you
|
|
|
|
// don't actually want to open the mail program.
|
|
|
|
bool policy_delegate_enabled_;
|
|
|
|
|
|
|
|
// Toggles the behavior of the policy delegate. If true, then navigations
|
|
|
|
// will be allowed. Otherwise, they will be ignored (dropped).
|
|
|
|
bool policy_delegate_is_permissive_;
|
|
|
|
|
|
|
|
// If true, the policy delegate will signal layout test completion.
|
|
|
|
bool policy_delegate_should_notify_done_;
|
|
|
|
|
|
|
|
// Non-owning pointer. The delegate is owned by the host.
|
|
|
|
CefBrowserImpl* browser_;
|
|
|
|
|
|
|
|
// For tracking session history. See RenderView.
|
|
|
|
int page_id_;
|
|
|
|
int last_page_id_updated_;
|
|
|
|
|
|
|
|
scoped_ptr<BrowserExtraData> pending_extra_data_;
|
|
|
|
|
|
|
|
WebCursor current_cursor_;
|
|
|
|
#if defined(OS_WIN)
|
|
|
|
// Classes needed by drag and drop.
|
|
|
|
scoped_refptr<BrowserDragDelegate> drag_delegate_;
|
2012-01-23 20:04:54 +01:00
|
|
|
#endif
|
|
|
|
#if defined(OS_WIN) || defined(OS_LINUX)
|
2011-02-28 01:33:11 +01:00
|
|
|
scoped_refptr<WebDropTarget> drop_target_;
|
2010-10-03 23:04:50 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(OS_LINUX)
|
|
|
|
// The type of cursor the window is currently using.
|
|
|
|
// Used for judging whether a new SetCursor call is actually changing the
|
|
|
|
// cursor.
|
|
|
|
GdkCursorType cursor_type_;
|
2012-01-23 20:04:54 +01:00
|
|
|
scoped_refptr<WebDragSource> drag_source_;
|
2010-10-03 23:04:50 +02:00
|
|
|
#endif
|
2010-10-23 19:00:47 +02:00
|
|
|
|
|
|
|
#if defined(OS_MACOSX)
|
2011-04-09 18:54:59 +02:00
|
|
|
// The external popup menu for the currently showing select popup.
|
|
|
|
scoped_ptr<ExternalPopupMenu> external_popup_menu_;
|
2010-10-23 19:00:47 +02:00
|
|
|
#endif
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
// true if we want to enable smart insert/delete.
|
|
|
|
bool smart_insert_delete_enabled_;
|
|
|
|
|
|
|
|
// true if we want to enable selection of trailing whitespaces
|
|
|
|
bool select_trailing_whitespace_enabled_;
|
|
|
|
|
|
|
|
// true if we should block any redirects
|
|
|
|
bool block_redirects_;
|
|
|
|
|
|
|
|
// Edit command associated to the current keyboard event.
|
|
|
|
std::string edit_command_name_;
|
|
|
|
std::string edit_command_value_;
|
|
|
|
|
2012-03-22 23:09:09 +01:00
|
|
|
BrowserWebCookieJarImpl cookie_jar_;
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(BrowserWebViewDelegate);
|
|
|
|
};
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_WEBVIEW_DELEGATE_H_
|