summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-12 19:49:04 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-12 19:49:04 +0000
commitb94d3327ed86b1345ceca7806ae1e050055e252b (patch)
treea5fce8db5729299807c8ac0d3bf37e721b535392
parent35b7041fbb49843f868c34ed3b5200d7653a6f5d (diff)
downloadchromium_src-b94d3327ed86b1345ceca7806ae1e050055e252b.zip
chromium_src-b94d3327ed86b1345ceca7806ae1e050055e252b.tar.gz
chromium_src-b94d3327ed86b1345ceca7806ae1e050055e252b.tar.bz2
Lots of small nits to help to split off webkit.dll.
- Stop directly referencing WebPluginDelegateImpl. - Make the password manager to not allocation the data on heap. - Remove some unneeded includes. Review URL: http://codereview.chromium.org/20208 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9692 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/clipboard.h4
-rw-r--r--base/clipboard_win.cc5
-rw-r--r--base/scoped_clipboard_writer.cc1
-rw-r--r--chrome/browser/autofill_manager.cc2
-rw-r--r--chrome/browser/autofill_manager.h2
-rw-r--r--chrome/browser/password_manager/password_manager.cc11
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h1
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc4
-rw-r--r--chrome/plugin/webplugin_delegate_stub.h4
-rw-r--r--chrome/plugin/webplugin_proxy.cc33
-rw-r--r--chrome/plugin/webplugin_proxy.h6
-rw-r--r--chrome/renderer/render_view.cc8
-rw-r--r--webkit/glue/password_form_dom_manager.cc9
-rw-r--r--webkit/glue/password_form_dom_manager.h9
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.cc8
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.h34
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_gtk.cc2
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_mac.cc2
-rw-r--r--webkit/glue/scoped_clipboard_writer_glue.h7
-rw-r--r--webkit/glue/webkit_glue.cc49
-rw-r--r--webkit/glue/webplugin_delegate.h49
21 files changed, 143 insertions, 107 deletions
diff --git a/base/clipboard.h b/base/clipboard.h
index abaaa1b..b9c58d1 100644
--- a/base/clipboard.h
+++ b/base/clipboard.h
@@ -7,12 +7,10 @@
#include <map>
#include <string>
-#include <utility>
#include <vector>
-#include "base/basictypes.h"
+#include "base/process.h"
#include "base/gfx/size.h"
-#include "base/shared_memory.h"
#if defined(OS_MACOSX)
#if defined(__OBJC__)
diff --git a/base/clipboard_win.cc b/base/clipboard_win.cc
index 865a1307..c688f30 100644
--- a/base/clipboard_win.cc
+++ b/base/clipboard_win.cc
@@ -5,14 +5,15 @@
// Many of these functions are based on those found in
// webkit/port/platform/PasteboardWin.cpp
+#include "base/clipboard.h"
+
#include <shlobj.h>
#include <shellapi.h>
-#include "base/clipboard.h"
-
#include "base/clipboard_util.h"
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/shared_memory.h"
#include "base/string_util.h"
namespace {
diff --git a/base/scoped_clipboard_writer.cc b/base/scoped_clipboard_writer.cc
index 3ddb1a9..f940462 100644
--- a/base/scoped_clipboard_writer.cc
+++ b/base/scoped_clipboard_writer.cc
@@ -8,7 +8,6 @@
// base/clipboard.h.
#include "base/scoped_clipboard_writer.h"
-#include "base/clipboard.h"
#include "base/string_util.h"
ScopedClipboardWriter::ScopedClipboardWriter(Clipboard* clipboard)
diff --git a/chrome/browser/autofill_manager.cc b/chrome/browser/autofill_manager.cc
index 8284cb4..6b44dd6 100644
--- a/chrome/browser/autofill_manager.cc
+++ b/chrome/browser/autofill_manager.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
+#include "webkit/glue/autofill_form.h"
// static
void AutofillManager::RegisterUserPrefs(PrefService* prefs) {
@@ -114,4 +115,3 @@ void AutofillManager::StoreFormEntriesInWebDatabase(
profile()->GetWebDataService(Profile::EXPLICIT_ACCESS)->
AddAutofillFormElements(form.elements);
}
-
diff --git a/chrome/browser/autofill_manager.h b/chrome/browser/autofill_manager.h
index 3ece658..b3f03f9 100644
--- a/chrome/browser/autofill_manager.h
+++ b/chrome/browser/autofill_manager.h
@@ -10,8 +10,8 @@
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/pref_member.h"
-#include "webkit/glue/autofill_form.h"
+class AutofillForm;
class Profile;
class WebContents;
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc
index 28b83db..4769f07 100644
--- a/chrome/browser/password_manager/password_manager.cc
+++ b/chrome/browser/password_manager/password_manager.cc
@@ -228,11 +228,12 @@ void PasswordManager::Autofill(const PasswordForm& form_for_autofill,
// schemed password form may have been freed, so we need to distinguish.
bool action_mismatch = form_for_autofill.action.GetWithEmptyPath() !=
preferred_match->action.GetWithEmptyPath();
- scoped_ptr<PasswordFormDomManager::FillData> fill_data(
- PasswordFormDomManager::CreateFillData(form_for_autofill,
- best_matches, preferred_match,
- action_mismatch));
- web_contents_->render_view_host()->FillPasswordForm(*fill_data);
+ PasswordFormDomManager::FillData fill_data;
+ PasswordFormDomManager::InitFillData(form_for_autofill,
+ best_matches, preferred_match,
+ action_mismatch,
+ &fill_data);
+ web_contents_->render_view_host()->FillPasswordForm(fill_data);
return;
}
default:
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index 764aaa8..c5b25f9 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -10,6 +10,7 @@
#include "base/gfx/rect.h"
#include "base/gfx/native_widget_types.h"
#include "base/ref_counted.h"
+#include "base/shared_memory.h"
#include "build/build_config.h"
#include "chrome/browser/net/resolve_proxy_msg_helper.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index 31444b6..1a35ecf 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -17,8 +17,8 @@
#include "third_party/npapi/bindings/npapi.h"
#include "third_party/npapi/bindings/npruntime.h"
#include "skia/ext/platform_device.h"
-#include "webkit/glue/plugins/webplugin_delegate_impl.h"
#include "webkit/glue/webcursor.h"
+#include "webkit/glue/webplugin_delegate.h"
class FinishDestructionTask : public Task {
public:
@@ -126,7 +126,7 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params,
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
FilePath path =
FilePath(command_line.GetSwitchValue(switches::kPluginPath));
- delegate_ = WebPluginDelegateImpl::Create(
+ delegate_ = WebPluginDelegate::Create(
path, mime_type_, params.containing_window);
if (delegate_) {
webplugin_ = new WebPluginProxy(
diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h
index d5e8270..9599945 100644
--- a/chrome/plugin/webplugin_delegate_stub.h
+++ b/chrome/plugin/webplugin_delegate_stub.h
@@ -17,7 +17,7 @@
class GURL;
class PluginChannel;
class WebPluginProxy;
-class WebPluginDelegateImpl;
+class WebPluginDelegate;
struct PluginMsg_Init_Params;
struct PluginMsg_DidReceiveResponseParams;
struct PluginMsg_PrintResponse_Params;
@@ -98,7 +98,7 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
scoped_refptr<PluginChannel> channel_;
- WebPluginDelegateImpl* delegate_;
+ WebPluginDelegate* delegate_;
WebPluginProxy* webplugin_;
DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateStub);
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 7302cbe..448064a 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -18,7 +18,7 @@
#include "chrome/plugin/plugin_thread.h"
#include "chrome/plugin/webplugin_delegate_stub.h"
#include "skia/ext/platform_device.h"
-#include "webkit/glue/plugins/webplugin_delegate_impl.h"
+#include "webkit/glue/webplugin_delegate.h"
typedef std::map<CPBrowsingContext, WebPluginProxy*> ContextMap;
static ContextMap& GetContextMap() {
@@ -28,7 +28,7 @@ static ContextMap& GetContextMap() {
WebPluginProxy::WebPluginProxy(
PluginChannel* channel,
int route_id,
- WebPluginDelegateImpl* delegate,
+ WebPluginDelegate* delegate,
HANDLE modal_dialog_event)
: channel_(channel),
route_id_(route_id),
@@ -109,7 +109,9 @@ void WebPluginProxy::CancelResource(int id) {
}
void WebPluginProxy::Invalidate() {
- gfx::Rect rect(0, 0, delegate_->rect().width(), delegate_->rect().height());
+ gfx::Rect rect(0, 0,
+ delegate_->GetRect().width(),
+ delegate_->GetRect().height());
InvalidateRect(rect);
}
@@ -118,7 +120,7 @@ void WebPluginProxy::InvalidateRect(const gfx::Rect& rect) {
// Ignore NPN_InvalidateRect calls with empty rects. Also don't send an
// invalidate if it's outside the clipping region, since if we did it won't
// lead to a paint and we'll be stuck waiting forever for a DidPaint response.
- if (rect.IsEmpty() || !delegate_->clip_rect().Intersects(rect))
+ if (rect.IsEmpty() || !delegate_->GetClipRect().Intersects(rect))
return;
// Only send a single InvalidateRect message at a time. From DidPaint we
@@ -267,8 +269,8 @@ void WebPluginProxy::HandleURLRequest(const char *method,
if (!target && (0 == _strcmpi(method, "GET"))) {
// Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082
// for more details on this.
- if (delegate_->quirks() &
- WebPluginDelegateImpl::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) {
+ if (delegate_->GetQuirks() &
+ WebPluginDelegate::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) {
GURL request_url(url);
if (!request_url.SchemeIs("http") && !request_url.SchemeIs("https") &&
!request_url.SchemeIs("ftp")) {
@@ -304,7 +306,7 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) {
// Clear the damaged area so that if the plugin doesn't paint there we won't
// end up with the old values.
gfx::Rect offset_rect = rect;
- offset_rect.Offset(delegate_->rect().x(), delegate_->rect().y());
+ offset_rect.Offset(delegate_->GetRect().origin());
if (!background_hdc_) {
FillRect(windowless_hdc_, &offset_rect.ToRECT(),
static_cast<HBRUSH>(GetStockObject(BLACK_BRUSH)));
@@ -324,11 +326,10 @@ void WebPluginProxy::UpdateGeometry(
const gfx::Rect& clip_rect,
const base::SharedMemoryHandle& windowless_buffer,
const base::SharedMemoryHandle& background_buffer) {
- gfx::Rect old = delegate_->rect();
- gfx::Rect old_clip_rect = delegate_->clip_rect();
+ gfx::Rect old = delegate_->GetRect();
+ gfx::Rect old_clip_rect = delegate_->GetClipRect();
- bool moved = delegate_->rect().x() != window_rect.x() ||
- delegate_->rect().y() != window_rect.y();
+ bool moved = old.x() != window_rect.x() || old.y() != window_rect.y();
delegate_->UpdateGeometry(window_rect, clip_rect);
if (windowless_buffer) {
// The plugin's rect changed, so now we have a new buffer to draw into.
@@ -339,7 +340,7 @@ void WebPluginProxy::UpdateGeometry(
}
// Send over any pending invalidates which occured when the plugin was
// off screen.
- if (delegate_->windowless() && !clip_rect.IsEmpty() &&
+ if (delegate_->IsWindowless() && !clip_rect.IsEmpty() &&
old_clip_rect.IsEmpty() && !damaged_rect_.IsEmpty()) {
InvalidateRect(damaged_rect_);
}
@@ -377,8 +378,8 @@ void WebPluginProxy::ConvertBuffer(const base::SharedMemoryHandle& buffer,
void* data = NULL;
HDC screen_dc = GetDC(NULL);
BITMAPINFOHEADER bitmap_header;
- gfx::CreateBitmapHeader(delegate_->rect().width(),
- delegate_->rect().height(),
+ gfx::CreateBitmapHeader(delegate_->GetRect().width(),
+ delegate_->GetRect().height(),
&bitmap_header);
bitmap->Set(CreateDIBSection(
screen_dc, reinterpret_cast<const BITMAPINFO*>(&bitmap_header),
@@ -404,8 +405,8 @@ void WebPluginProxy::UpdateTransform() {
return;
XFORM xf;
- xf.eDx = static_cast<FLOAT>(-delegate_->rect().x());
- xf.eDy = static_cast<FLOAT>(-delegate_->rect().y());
+ xf.eDx = static_cast<FLOAT>(-delegate_->GetRect().x());
+ xf.eDy = static_cast<FLOAT>(-delegate_->GetRect().y());
xf.eM11 = 1;
xf.eM21 = 0;
xf.eM12 = 0;
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index 9f6177b..d6922aa 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -20,7 +20,7 @@ class WaitableEvent;
}
class PluginChannel;
-class WebPluginDelegateImpl;
+class WebPluginDelegate;
// This is an implementation of WebPlugin that proxies all calls to the
// renderer.
@@ -30,7 +30,7 @@ class WebPluginProxy : public WebPlugin {
// marshalled WebPlugin calls.
WebPluginProxy(PluginChannel* channel,
int route_id,
- WebPluginDelegateImpl* delegate,
+ WebPluginDelegate* delegate,
HANDLE modal_dialog_event);
~WebPluginProxy();
@@ -125,7 +125,7 @@ class WebPluginProxy : public WebPlugin {
int route_id_;
NPObject* window_npobject_;
NPObject* plugin_element_;
- WebPluginDelegateImpl* delegate_;
+ WebPluginDelegate* delegate_;
gfx::Rect damaged_rect_;
bool waiting_for_paint_;
uint32 cp_browsing_context_;
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index bd300e1..7003f43 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -42,7 +42,6 @@
#include "webkit/glue/glue_accessibility.h"
#include "webkit/glue/password_form.h"
#include "webkit/glue/plugins/plugin_list.h"
-#include "webkit/glue/plugins/webplugin_delegate_impl.h"
#include "webkit/glue/searchable_form_data.h"
#include "webkit/glue/webdatasource.h"
#include "webkit/glue/webdropdata.h"
@@ -52,6 +51,7 @@
#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webpreferences.h"
+#include "webkit/glue/webplugin_delegate.h"
#include "webkit/glue/webresponse.h"
#include "webkit/glue/weburlrequest.h"
#include "webkit/glue/webview.h"
@@ -1895,9 +1895,9 @@ WebPluginDelegate* RenderView::CreatePluginDelegate(
if (is_gears)
ChromePluginLib::Create(path, GetCPBrowserFuncsForRenderer());
- return WebPluginDelegateImpl::Create(path,
- mime_type_to_use,
- gfx::NativeViewFromId(host_window_));
+ return WebPluginDelegate::Create(path,
+ mime_type_to_use,
+ gfx::NativeViewFromId(host_window_));
}
WebPluginDelegateProxy* proxy =
diff --git a/webkit/glue/password_form_dom_manager.cc b/webkit/glue/password_form_dom_manager.cc
index 956a55e..4a372e8 100644
--- a/webkit/glue/password_form_dom_manager.cc
+++ b/webkit/glue/password_form_dom_manager.cc
@@ -62,15 +62,13 @@ PasswordForm* PasswordFormDomManager::CreatePasswordForm(
}
// static
-PasswordFormDomManager::FillData* PasswordFormDomManager::CreateFillData(
+void PasswordFormDomManager::InitFillData(
const PasswordForm& form_on_page,
const PasswordFormMap& matches,
const PasswordForm* const preferred_match,
- bool wait_for_username_before_autofill) {
+ bool wait_for_username_before_autofill,
+ PasswordFormDomManager::FillData* result) {
DCHECK(preferred_match);
- PasswordFormDomManager::FillData* result =
- new PasswordFormDomManager::FillData();
-
// Fill basic form data.
result->basic_data.origin = form_on_page.origin;
result->basic_data.action = form_on_page.action;
@@ -87,7 +85,6 @@ PasswordFormDomManager::FillData* PasswordFormDomManager::CreateFillData(
if (iter->second != preferred_match)
result->additional_logins[iter->first] = iter->second->password_value;
}
- return result;
}
// static
diff --git a/webkit/glue/password_form_dom_manager.h b/webkit/glue/password_form_dom_manager.h
index 9f827de..fcca8c7 100644
--- a/webkit/glue/password_form_dom_manager.h
+++ b/webkit/glue/password_form_dom_manager.h
@@ -52,10 +52,11 @@ class PasswordFormDomManager {
// preferred_match should equal (address) one of matches.
// wait_for_username_before_autofill is true if we should not autofill
// anything until the user typed in a valid username and blurred the field.
- static FillData* CreateFillData(const PasswordForm& form_on_page,
- const PasswordFormMap& matches,
- const PasswordForm* const preferred_match,
- bool wait_for_username_before_autofill);
+ static void InitFillData(const PasswordForm& form_on_page,
+ const PasswordFormMap& matches,
+ const PasswordForm* const preferred_match,
+ bool wait_for_username_before_autofill,
+ FillData* result);
private:
// Helper structure to locate username, passwords and submit fields.
struct PasswordFormFields {
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc
index 839cbd5..0ab5c02 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl.cc
@@ -58,7 +58,7 @@ base::LazyInstance<iat_patch::IATPatchFunction> g_iat_patch_set_cursor(
} // namespace
-WebPluginDelegateImpl* WebPluginDelegateImpl::Create(
+WebPluginDelegate* WebPluginDelegate::Create(
const FilePath& filename,
const std::string& mime_type,
gfx::NativeView containing_view) {
@@ -800,7 +800,7 @@ LRESULT CALLBACK WebPluginDelegateImpl::NativeWndProc(
}
if (message == delegate->last_message_ &&
- delegate->quirks() & PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY &&
+ delegate->GetQuirks() & PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY &&
delegate->is_calling_wndproc) {
// Real may go into a state where it recursively dispatches the same event
// when subclassed. See https://bugzilla.mozilla.org/show_bug.cgi?id=192914
@@ -852,7 +852,7 @@ LRESULT CALLBACK WebPluginDelegateImpl::NativeWndProc(
// usage. See https://bugzilla.mozilla.org/show_bug.cgi?id=132759. We
// prevent this by throttling the messages.
case WM_USER + 1: {
- if (delegate->quirks() & PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE) {
+ if (delegate->GetQuirks() & PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE) {
WebPluginDelegateImpl::ThrottleMessage(delegate->plugin_wnd_proc_, hwnd,
message, wparam, lparam);
g_current_plugin_instance = last_plugin_instance;
@@ -1172,7 +1172,7 @@ HCURSOR WINAPI WebPluginDelegateImpl::SetCursorPatch(HCURSOR cursor) {
if (!g_current_plugin_instance)
return GetCursor();
- if (!g_current_plugin_instance->windowless()) {
+ if (!g_current_plugin_instance->IsWindowless()) {
return SetCursor(cursor);
}
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h
index f196c6e..46d0f95 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.h
+++ b/webkit/glue/plugins/webplugin_delegate_impl.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__
-#define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__
+#ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_
+#define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_
#include "build/build_config.h"
@@ -26,9 +26,6 @@ namespace NPAPI {
// the plugin process.
class WebPluginDelegateImpl : public WebPluginDelegate {
public:
- static WebPluginDelegateImpl* Create(const FilePath& filename,
- const std::string& mime_type,
- gfx::NativeView containing_view);
static bool IsPluginDelegateWindow(gfx::NativeWindow window);
static bool GetPluginNameFromWindow(gfx::NativeWindow window,
std::wstring *plugin_name);
@@ -82,24 +79,10 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
virtual void URLRequestRouted(const std::string&url, bool notify_needed,
void* notify_data);
- bool windowless() const { return windowless_ ; }
- gfx::Rect rect() const { return window_rect_; }
- gfx::Rect clip_rect() const { return clip_rect_; }
-
-#if defined(OS_WIN)
- enum PluginQuirks {
- PLUGIN_QUIRK_SETWINDOW_TWICE = 1 << 0,
- PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 1 << 1,
- PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 1 << 2,
- PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 1 << 3,
- PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 1 << 4,
- PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU = 1 << 5,
- PLUGIN_QUIRK_PATCH_SETCURSOR = 1 << 6,
- PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 1 << 7,
- };
-#endif
-
- int quirks() { return quirks_; }
+ virtual bool IsWindowless() const { return windowless_ ; }
+ virtual const gfx::Rect& GetRect() const { return window_rect_; }
+ virtual const gfx::Rect& GetClipRect() const { return clip_rect_; }
+ virtual int GetQuirks() const { return quirks_; }
private:
WebPluginDelegateImpl(gfx::NativeView containing_view,
@@ -279,8 +262,9 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
// Holds the current cursor set by the windowless plugin.
WebCursor current_windowless_cursor_;
+ friend class WebPluginDelegate;
+
DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl);
};
-#endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__
-
+#endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
index 58d853e..40da272b 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
@@ -37,7 +37,7 @@
#include "webkit/glue/plugins/plugin_stream_url.h"
#include "webkit/glue/webkit_glue.h"
-WebPluginDelegateImpl* WebPluginDelegateImpl::Create(
+WebPluginDelegate* WebPluginDelegate::Create(
const FilePath& filename,
const std::string& mime_type,
gfx::NativeView containing_view) {
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.cc b/webkit/glue/plugins/webplugin_delegate_impl_mac.cc
index 8c62dbc..1a25ad6c 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_mac.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.cc
@@ -50,7 +50,7 @@ WebPluginDelegateImpl* g_current_plugin_instance = NULL;
} // namespace
-WebPluginDelegateImpl* WebPluginDelegateImpl::Create(
+WebPluginDelegate* WebPluginDelegate::Create(
const FilePath& filename,
const std::string& mime_type,
gfx::NativeView containing_view) {
diff --git a/webkit/glue/scoped_clipboard_writer_glue.h b/webkit/glue/scoped_clipboard_writer_glue.h
index 6307e6a..db7c428 100644
--- a/webkit/glue/scoped_clipboard_writer_glue.h
+++ b/webkit/glue/scoped_clipboard_writer_glue.h
@@ -5,9 +5,14 @@
#ifndef SCOPED_CLIPBOARD_WRITER_GLUE_H_
#define SCOPED_CLIPBOARD_WRITER_GLUE_H_
-#include "base/clipboard.h"
#include "base/scoped_clipboard_writer.h"
+class SkBitmap;
+
+namespace base {
+class SharedMemory;
+}
+
class ScopedClipboardWriterGlue : public ScopedClipboardWriter {
public:
ScopedClipboardWriterGlue(Clipboard* clipboard)
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index ebcb3e8..c98c987 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -35,6 +35,7 @@ MSVC_POP_WARNING();
#include "webkit/glue/webkit_glue.h"
#include "base/file_version_info.h"
+#include "base/singleton.h"
#include "base/string_util.h"
#include "skia/include/SkBitmap.h"
#include "webkit/glue/event_conversion.h"
@@ -316,9 +317,19 @@ std::string GetWebKitVersion() {
namespace {
-const std::string* user_agent = NULL;
-bool user_agent_requested = false;
-bool user_agent_is_overridden = false;
+struct UserAgentState {
+ UserAgentState()
+ : user_agent_requested(false),
+ user_agent_is_overridden(false) {
+ }
+
+ std::string user_agent;
+ std::string mimic_safari_user_agent;
+ bool user_agent_requested;
+ bool user_agent_is_overridden;
+};
+
+Singleton<UserAgentState> g_user_agent;
void BuildUserAgent(bool mimic_safari, std::string* result) {
#if defined(OS_WIN) || defined(OS_MACOSX)
@@ -392,38 +403,34 @@ void BuildUserAgent(bool mimic_safari, std::string* result) {
}
void SetUserAgentToDefault() {
- static std::string default_user_agent;
- BuildUserAgent(false, &default_user_agent);
- user_agent = &default_user_agent;
+ BuildUserAgent(false, &g_user_agent->user_agent);
}
} // namespace
void SetUserAgent(const std::string& new_user_agent) {
- DCHECK(!user_agent_requested) << "Setting the user agent after someone has "
+ // If you combine this with the previous line, the function only works the
+ // first time.
+ DCHECK(!g_user_agent->user_agent_requested) <<
+ "Setting the user agent after someone has "
"already requested it can result in unexpected behavior.";
- static std::string overridden_user_agent;
- overridden_user_agent = new_user_agent; // If you combine this with the
- // previous line, the function only
- // works the first time.
- user_agent_is_overridden = true;
- user_agent = &overridden_user_agent;
+ g_user_agent->user_agent_is_overridden = true;
+ g_user_agent->user_agent = new_user_agent;
}
const std::string& GetUserAgent(const GURL& url) {
- if (!user_agent)
+ if (g_user_agent->user_agent.empty())
SetUserAgentToDefault();
- user_agent_requested = true;
- if (!user_agent_is_overridden) {
- static std::string mimic_safari_user_agent;
+ g_user_agent->user_agent_requested = true;
+ if (!g_user_agent->user_agent_is_overridden) {
// For hotmail, we need to spoof as Safari (bug 4111).
if (MatchPattern(url.host(), "*.mail.live.com")) {
- if (mimic_safari_user_agent.empty())
- BuildUserAgent(true, &mimic_safari_user_agent);
- return mimic_safari_user_agent;
+ if (g_user_agent->mimic_safari_user_agent.empty())
+ BuildUserAgent(true, &g_user_agent->mimic_safari_user_agent);
+ return g_user_agent->mimic_safari_user_agent;
}
}
- return *user_agent;
+ return g_user_agent->user_agent;
}
void NotifyJSOutOfMemory(WebCore::Frame* frame) {
diff --git a/webkit/glue/webplugin_delegate.h b/webkit/glue/webplugin_delegate.h
index 122503f0..b1a17cf 100644
--- a/webkit/glue/webplugin_delegate.h
+++ b/webkit/glue/webplugin_delegate.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H__
-#define WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H__
+#ifndef WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_
+#define WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_
#include <string>
#include <vector>
@@ -27,9 +27,26 @@ class WebPluginResourceClient;
// This is the interface that a plugin implementation needs to provide.
class WebPluginDelegate {
public:
+#if defined(OS_WIN)
+ enum PluginQuirks {
+ PLUGIN_QUIRK_SETWINDOW_TWICE = 1 << 0,
+ PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 1 << 1,
+ PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 1 << 2,
+ PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 1 << 3,
+ PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 1 << 4,
+ PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU = 1 << 5,
+ PLUGIN_QUIRK_PATCH_SETCURSOR = 1 << 6,
+ PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 1 << 7,
+ };
+#endif
+
WebPluginDelegate() {}
virtual ~WebPluginDelegate() {}
+ static WebPluginDelegate* Create(const FilePath& filename,
+ const std::string& mime_type,
+ gfx::NativeView containing_view);
+
// Initializes the plugin implementation with the given (UTF8) arguments.
// Note that the lifetime of WebPlugin must be longer than this delegate.
// If this function returns false the plugin isn't started and shouldn't be
@@ -120,9 +137,33 @@ class WebPluginDelegate {
// Notifies the delegate about a Get/Post URL request getting routed.
virtual void URLRequestRouted(const std::string&url, bool notify_needed,
void* notify_data) = 0;
+
+ virtual bool IsWindowless() const {
+ NOTREACHED();
+ return false;
+ }
+
+ virtual const gfx::Rect& GetRect() const {
+ NOTREACHED();
+ static gfx::Rect dummy;
+ return dummy;
+ }
+
+ virtual const gfx::Rect& GetClipRect() const {
+ NOTREACHED();
+ return GetRect();
+ }
+
+#if defined(OS_WIN)
+ // Returns a combinaison of PluginQuirks.
+ virtual int GetQuirks() const {
+ NOTREACHED();
+ return 0;
+ }
+#endif
+
private:
DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegate);
};
-#endif // #ifndef WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H__
-
+#endif // #ifndef WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_