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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 1169983006: Convert BrowserPlugin to render using cc::Surfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore guest resize pathway. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/browser_plugin/browser_plugin.h" 5 #include "content/renderer/browser_plugin/browser_plugin.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
13 #include "cc/surfaces/surface.h"
13 #include "content/common/browser_plugin/browser_plugin_constants.h" 14 #include "content/common/browser_plugin/browser_plugin_constants.h"
14 #include "content/common/browser_plugin/browser_plugin_messages.h" 15 #include "content/common/browser_plugin/browser_plugin_messages.h"
15 #include "content/common/view_messages.h" 16 #include "content/common/view_messages.h"
16 #include "content/public/common/content_client.h" 17 #include "content/public/common/content_client.h"
17 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
18 #include "content/public/renderer/browser_plugin_delegate.h" 19 #include "content/public/renderer/browser_plugin_delegate.h"
19 #include "content/public/renderer/content_renderer_client.h" 20 #include "content/public/renderer/content_renderer_client.h"
20 #include "content/renderer/browser_plugin/browser_plugin_manager.h" 21 #include "content/renderer/browser_plugin/browser_plugin_manager.h"
21 #include "content/renderer/child_frame_compositing_helper.h" 22 #include "content/renderer/child_frame_compositing_helper.h"
22 #include "content/renderer/cursor_utils.h" 23 #include "content/renderer/cursor_utils.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus) 96 IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus)
96 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginMsg_CompositorFrameSwapped, 97 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginMsg_CompositorFrameSwapped,
97 OnCompositorFrameSwapped(message)) 98 OnCompositorFrameSwapped(message))
98 IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestGone, OnGuestGone) 99 IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestGone, OnGuestGone)
99 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetContentsOpaque, OnSetContentsOpaque) 100 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetContentsOpaque, OnSetContentsOpaque)
100 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetCursor, OnSetCursor) 101 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetCursor, OnSetCursor)
101 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetMouseLock, OnSetMouseLock) 102 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetMouseLock, OnSetMouseLock)
102 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetTooltipText, OnSetTooltipText) 103 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetTooltipText, OnSetTooltipText)
103 IPC_MESSAGE_HANDLER(BrowserPluginMsg_ShouldAcceptTouchEvents, 104 IPC_MESSAGE_HANDLER(BrowserPluginMsg_ShouldAcceptTouchEvents,
104 OnShouldAcceptTouchEvents) 105 OnShouldAcceptTouchEvents)
106 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetChildFrameSurface,
107 OnSetChildFrameSurface)
105 IPC_END_MESSAGE_MAP() 108 IPC_END_MESSAGE_MAP()
106 return handled; 109 return handled;
107 } 110 }
108 111
112 void BrowserPlugin::OnSetChildFrameSurface(
113 int browser_plugin_instance_id,
114 const cc::SurfaceId& surface_id,
115 const gfx::Size& frame_size,
116 float scale_factor,
117 const cc::SurfaceSequence& sequence) {
118 if (!attached())
119 return;
120
121 EnableCompositing(true);
122 DCHECK(compositing_helper_.get());
123
124 compositing_helper_->OnSetSurface(surface_id, frame_size, scale_factor,
125 sequence);
126 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SatisfySequence(
127 render_frame_routing_id_, browser_plugin_instance_id_, sequence));
128 }
129
109 void BrowserPlugin::UpdateDOMAttribute(const std::string& attribute_name, 130 void BrowserPlugin::UpdateDOMAttribute(const std::string& attribute_name,
110 const base::string16& attribute_value) { 131 const base::string16& attribute_value) {
111 if (!container()) 132 if (!container())
112 return; 133 return;
113 134
114 blink::WebElement element = container()->element(); 135 blink::WebElement element = container()->element();
115 blink::WebString web_attribute_name = 136 blink::WebString web_attribute_name =
116 blink::WebString::fromUTF8(attribute_name); 137 blink::WebString::fromUTF8(attribute_name);
117 element.setAttribute(web_attribute_name, attribute_value); 138 element.setAttribute(web_attribute_name, attribute_value);
118 } 139 }
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 bool BrowserPlugin::HandleMouseLockedInputEvent( 631 bool BrowserPlugin::HandleMouseLockedInputEvent(
611 const blink::WebMouseEvent& event) { 632 const blink::WebMouseEvent& event) {
612 BrowserPluginManager::Get()->Send( 633 BrowserPluginManager::Get()->Send(
613 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, 634 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_,
614 view_rect_, 635 view_rect_,
615 &event)); 636 &event));
616 return true; 637 return true;
617 } 638 }
618 639
619 } // namespace content 640 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698