2010-10-09 20:23:06 +02:00
|
|
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
2010-10-03 23:04:50 +02:00
|
|
|
// 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
|
|
|
#ifndef CEF_LIBCEF_WEBVIEW_HOST_H_
|
|
|
|
#define CEF_LIBCEF_WEBVIEW_HOST_H_
|
|
|
|
#pragma once
|
2010-10-03 23:04:50 +02:00
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
#include "libcef/webwidget_host.h"
|
2010-10-03 23:04:50 +02:00
|
|
|
#include "base/basictypes.h"
|
2011-02-15 19:07:24 +01:00
|
|
|
#include "ui/gfx/native_widget_types.h"
|
2010-10-03 23:04:50 +02:00
|
|
|
|
2012-04-11 21:37:06 +02:00
|
|
|
#if defined(TOOLKIT_GTK)
|
2011-01-07 22:34:20 +01:00
|
|
|
#include "webkit/plugins/npapi/gtk_plugin_container_manager.h"
|
2010-10-09 20:23:06 +02:00
|
|
|
#endif
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
class BrowserWebViewDelegate;
|
|
|
|
|
2012-05-23 21:01:04 +02:00
|
|
|
namespace webkit_glue {
|
|
|
|
struct WebPreferences;
|
|
|
|
}
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
namespace WebKit {
|
|
|
|
class WebDevToolsAgentClient;
|
|
|
|
class WebView;
|
|
|
|
}
|
|
|
|
|
2010-10-09 20:23:06 +02:00
|
|
|
// This class is a simple NativeView-based host for a WebView
|
2010-10-03 23:04:50 +02:00
|
|
|
class WebViewHost : public WebWidgetHost {
|
|
|
|
public:
|
2010-10-09 20:23:06 +02:00
|
|
|
// The new instance is deleted once the associated NativeView is destroyed.
|
2010-10-03 23:04:50 +02:00
|
|
|
// The newly created window should be resized after it is created, using the
|
|
|
|
// MoveWindow (or equivalent) function.
|
2010-10-09 20:23:06 +02:00
|
|
|
static WebViewHost* Create(gfx::NativeView parent_view,
|
2010-11-15 16:39:56 +01:00
|
|
|
const gfx::Rect& rect,
|
2010-10-03 23:04:50 +02:00
|
|
|
BrowserWebViewDelegate* delegate,
|
2011-03-24 21:36:47 +01:00
|
|
|
PaintDelegate* paint_delegate,
|
2010-10-03 23:04:50 +02:00
|
|
|
WebKit::WebDevToolsAgentClient* devtools_client,
|
2012-05-23 21:01:04 +02:00
|
|
|
const webkit_glue::WebPreferences& prefs);
|
2010-10-03 23:04:50 +02:00
|
|
|
|
2011-03-24 21:36:47 +01:00
|
|
|
virtual ~WebViewHost();
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
WebKit::WebView* webview() const;
|
|
|
|
|
2012-04-11 21:37:06 +02:00
|
|
|
#if defined(TOOLKIT_GTK)
|
2010-10-09 20:23:06 +02:00
|
|
|
// Create a new plugin parent container for a given plugin XID.
|
|
|
|
void CreatePluginContainer(gfx::PluginWindowHandle id);
|
|
|
|
|
|
|
|
// Destroy the plugin parent container when a plugin has been destroyed.
|
|
|
|
void DestroyPluginContainer(gfx::PluginWindowHandle id);
|
|
|
|
|
2011-01-07 22:34:20 +01:00
|
|
|
webkit::npapi::GtkPluginContainerManager* plugin_container_manager() {
|
2010-10-09 20:23:06 +02:00
|
|
|
return &plugin_container_manager_;
|
|
|
|
}
|
2011-11-04 19:19:14 +01:00
|
|
|
|
|
|
|
virtual void KeyEvent(GdkEventKey* event);
|
2010-10-09 20:23:06 +02:00
|
|
|
#elif defined(OS_MACOSX)
|
|
|
|
void SetIsActive(bool active);
|
2012-01-10 00:46:23 +01:00
|
|
|
virtual void MouseEvent(NSEvent* event);
|
|
|
|
virtual void KeyEvent(NSEvent* event);
|
2011-08-02 18:50:06 +02:00
|
|
|
virtual void SetFocus(bool enable);
|
2010-10-09 20:23:06 +02:00
|
|
|
#endif
|
|
|
|
|
2012-08-21 21:48:29 +02:00
|
|
|
virtual bool IsTransparent();
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
protected:
|
2012-01-10 00:46:23 +01:00
|
|
|
explicit WebViewHost(BrowserWebViewDelegate* delegate);
|
2011-03-24 21:36:47 +01:00
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
#if defined(OS_WIN)
|
2011-06-14 17:45:00 +02:00
|
|
|
virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam);
|
2011-02-28 01:33:11 +01:00
|
|
|
virtual void MouseEvent(UINT message, WPARAM wparam, LPARAM lparam);
|
2011-11-04 19:19:14 +01:00
|
|
|
virtual void KeyEvent(UINT message, WPARAM wparam, LPARAM lparam);
|
2010-10-03 23:04:50 +02:00
|
|
|
#endif
|
2010-10-09 20:23:06 +02:00
|
|
|
|
2012-04-11 21:37:06 +02:00
|
|
|
#if defined(TOOLKIT_GTK)
|
2010-10-09 20:23:06 +02:00
|
|
|
// Helper class that creates and moves plugin containers.
|
2011-01-07 22:34:20 +01:00
|
|
|
webkit::npapi::GtkPluginContainerManager plugin_container_manager_;
|
2010-10-09 20:23:06 +02:00
|
|
|
#endif
|
2011-11-04 19:19:14 +01:00
|
|
|
|
|
|
|
// The delegate pointer will always outlive the WebViewHost object.
|
|
|
|
BrowserWebViewDelegate* delegate_;
|
2010-10-03 23:04:50 +02:00
|
|
|
};
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
#endif // CEF_LIBCEF_WEBVIEW_HOST_H_
|