Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Unified Diff: content/browser/browser_plugin/browser_plugin_guest_helper.cc

Issue 10868012: Browser Plugin: New Implementation (Browser Side) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master-trial-obrowser
Patch Set: Fix mac build + Address nits from awong@ Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_plugin/browser_plugin_guest_helper.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest_helper.cc b/content/browser/browser_plugin/browser_plugin_guest_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a7b1880083bee2911539fc867bea44d0e3179c0e
--- /dev/null
+++ b/content/browser/browser_plugin/browser_plugin_guest_helper.cc
@@ -0,0 +1,76 @@
+// Copyright (c) 2012 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 "content/browser/browser_plugin/browser_plugin_guest_helper.h"
+
+#include "base/time.h"
+#include "content/browser/browser_plugin/browser_plugin_guest.h"
+#include "content/browser/renderer_host/render_view_host_impl.h"
+#include "content/browser/renderer_host/render_widget_host_impl.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/common/browser_plugin_messages.h"
awong 2012/09/06 00:23:27 ordering of includes.
lazyboy 2012/09/06 04:33:53 Done.
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
+#include "content/public/browser/notification_types.h"
+#include "content/common/view_messages.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/render_widget_host_view.h"
+#include "ui/gfx/size.h"
+
+namespace content {
+
+BrowserPluginGuestHelper::BrowserPluginGuestHelper(
+ BrowserPluginGuest* guest,
+ RenderViewHost* render_view_host)
+ : RenderViewHostObserver(render_view_host),
+ guest_(guest) {
+}
+
+BrowserPluginGuestHelper::~BrowserPluginGuestHelper() {
+}
+
+bool BrowserPluginGuestHelper::OnMessageReceived(
+ const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuestHelper, message)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnHandleInputEventAck)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void BrowserPluginGuestHelper::OnUpdateRect(
+ const ViewHostMsg_UpdateRect_Params& params) {
+ RenderWidgetHostImpl* render_widget_host =
+ RenderWidgetHostImpl::From(render_view_host());
awong 2012/09/06 00:23:27 Add comment explaining why it makes sense to Reset
lazyboy 2012/09/06 04:33:53 Fady: Can you explain this one? Thanks.
+ render_widget_host->ResetFlags();
+ guest_->UpdateRect(render_view_host(), params);
+}
+
+void BrowserPluginGuestHelper::OnHandleInputEventAck(
+ WebKit::WebInputEvent::Type event_type,
+ bool processed) {
+ guest_->HandleInputEventAck(render_view_host(), processed);
+}
+
+void BrowserPluginGuestHelper::OnTakeFocus(bool reverse) {
+ guest_->ViewTakeFocus(reverse);
+}
+
+void BrowserPluginGuestHelper::OnShowWidget(int route_id,
+ const gfx::Rect& initial_pos) {
+ guest_->ShowWidget(render_view_host(), route_id, initial_pos);
+}
+
+void BrowserPluginGuestHelper::OnSetCursor(const WebCursor& cursor) {
+ guest_->SetCursor(cursor);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698