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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 251593004: Remove SW rendering path code from BrowserPlugin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after test file change commit Created 6 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "content/browser/browser_plugin/browser_plugin_embedder.h" 12 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
13 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h" 13 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
14 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" 14 #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
15 #include "content/browser/browser_thread_impl.h" 15 #include "content/browser/browser_thread_impl.h"
16 #include "content/browser/child_process_security_policy_impl.h" 16 #include "content/browser/child_process_security_policy_impl.h"
17 #include "content/browser/frame_host/render_frame_host_impl.h" 17 #include "content/browser/frame_host/render_frame_host_impl.h"
18 #include "content/browser/frame_host/render_widget_host_view_guest.h" 18 #include "content/browser/frame_host/render_widget_host_view_guest.h"
19 #include "content/browser/loader/resource_dispatcher_host_impl.h" 19 #include "content/browser/loader/resource_dispatcher_host_impl.h"
20 #include "content/browser/renderer_host/render_view_host_impl.h" 20 #include "content/browser/renderer_host/render_view_host_impl.h"
21 #include "content/browser/renderer_host/render_widget_host_impl.h" 21 #include "content/browser/renderer_host/render_widget_host_impl.h"
22 #include "content/browser/web_contents/web_contents_impl.h" 22 #include "content/browser/web_contents/web_contents_impl.h"
23 #include "content/browser/web_contents/web_contents_view_guest.h" 23 #include "content/browser/web_contents/web_contents_view_guest.h"
24 #include "content/common/browser_plugin/browser_plugin_constants.h" 24 #include "content/common/browser_plugin/browser_plugin_constants.h"
25 #include "content/common/browser_plugin/browser_plugin_messages.h" 25 #include "content/common/browser_plugin/browser_plugin_messages.h"
26 #include "content/common/content_constants_internal.h" 26 #include "content/common/content_constants_internal.h"
27 #include "content/common/drag_messages.h" 27 #include "content/common/drag_messages.h"
28 #include "content/common/gpu/gpu_messages.h"
29 #include "content/common/input_messages.h" 28 #include "content/common/input_messages.h"
30 #include "content/common/view_messages.h" 29 #include "content/common/view_messages.h"
31 #include "content/port/browser/render_view_host_delegate_view.h" 30 #include "content/port/browser/render_view_host_delegate_view.h"
32 #include "content/port/browser/render_widget_host_view_port.h" 31 #include "content/port/browser/render_widget_host_view_port.h"
33 #include "content/public/browser/browser_context.h" 32 #include "content/public/browser/browser_context.h"
34 #include "content/public/browser/content_browser_client.h" 33 #include "content/public/browser/content_browser_client.h"
35 #include "content/public/browser/navigation_controller.h" 34 #include "content/public/browser/navigation_controller.h"
36 #include "content/public/browser/render_process_host.h"
37 #include "content/public/browser/render_widget_host_view.h" 35 #include "content/public/browser/render_widget_host_view.h"
38 #include "content/public/browser/resource_request_details.h"
39 #include "content/public/browser/user_metrics.h" 36 #include "content/public/browser/user_metrics.h"
40 #include "content/public/browser/web_contents_observer.h" 37 #include "content/public/browser/web_contents_observer.h"
41 #include "content/public/browser/web_contents_view.h" 38 #include "content/public/browser/web_contents_view.h"
42 #include "content/public/common/drop_data.h" 39 #include "content/public/common/drop_data.h"
43 #include "content/public/common/media_stream_request.h" 40 #include "content/public/common/media_stream_request.h"
44 #include "content/public/common/result_codes.h" 41 #include "content/public/common/result_codes.h"
45 #include "content/public/common/url_constants.h" 42 #include "content/public/common/url_constants.h"
46 #include "content/public/common/url_utils.h" 43 #include "content/public/common/url_utils.h"
47 #include "net/url_request/url_request.h" 44 #include "net/url_request/url_request.h"
48 #include "third_party/WebKit/public/platform/WebCursorInfo.h" 45 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
49 #include "ui/events/keycodes/keyboard_codes.h" 46 #include "ui/events/keycodes/keyboard_codes.h"
50 #include "ui/surface/transport_dib.h"
51 #include "webkit/common/resource_type.h" 47 #include "webkit/common/resource_type.h"
52 48
53 #if defined(OS_MACOSX) 49 #if defined(OS_MACOSX)
54 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" 50 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h"
55 #endif 51 #endif
56 52
57 namespace content { 53 namespace content {
58 54
59 // static 55 // static
60 BrowserPluginHostFactory* BrowserPluginGuest::factory_ = NULL; 56 BrowserPluginHostFactory* BrowserPluginGuest::factory_ = NULL;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 }; 187 };
192 188
193 BrowserPluginGuest::BrowserPluginGuest( 189 BrowserPluginGuest::BrowserPluginGuest(
194 int instance_id, 190 int instance_id,
195 bool has_render_view, 191 bool has_render_view,
196 WebContentsImpl* web_contents, 192 WebContentsImpl* web_contents,
197 BrowserPluginGuest* opener) 193 BrowserPluginGuest* opener)
198 : WebContentsObserver(web_contents), 194 : WebContentsObserver(web_contents),
199 embedder_web_contents_(NULL), 195 embedder_web_contents_(NULL),
200 instance_id_(instance_id), 196 instance_id_(instance_id),
201 damage_buffer_sequence_id_(0),
202 damage_buffer_size_(0),
203 damage_buffer_scale_factor_(1.0f),
204 guest_device_scale_factor_(1.0f), 197 guest_device_scale_factor_(1.0f),
205 guest_hang_timeout_( 198 guest_hang_timeout_(
206 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), 199 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)),
207 focused_(false), 200 focused_(false),
208 mouse_locked_(false), 201 mouse_locked_(false),
209 pending_lock_request_(false), 202 pending_lock_request_(false),
210 embedder_visible_(true), 203 embedder_visible_(true),
211 auto_size_enabled_(false), 204 auto_size_enabled_(false),
212 copy_request_id_(0), 205 copy_request_id_(0),
213 next_permission_request_id_(browser_plugin::kInvalidPermissionRequestID), 206 next_permission_request_id_(browser_plugin::kInvalidPermissionRequestID),
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetAutoSize, OnSetSize) 387 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetAutoSize, OnSetSize)
395 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent, 388 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent,
396 OnSetEditCommandsForNextKeyEvent) 389 OnSetEditCommandsForNextKeyEvent)
397 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetFocus, OnSetFocus) 390 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetFocus, OnSetFocus)
398 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetName, OnSetName) 391 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetName, OnSetName)
399 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetContentsOpaque, 392 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetContentsOpaque,
400 OnSetContentsOpaque) 393 OnSetContentsOpaque)
401 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetVisibility, OnSetVisibility) 394 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetVisibility, OnSetVisibility)
402 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UnlockMouse_ACK, OnUnlockMouseAck) 395 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UnlockMouse_ACK, OnUnlockMouseAck)
403 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateGeometry, OnUpdateGeometry) 396 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateGeometry, OnUpdateGeometry)
404 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateRect_ACK, OnUpdateRectACK)
405 IPC_MESSAGE_UNHANDLED(handled = false) 397 IPC_MESSAGE_UNHANDLED(handled = false)
406 IPC_END_MESSAGE_MAP() 398 IPC_END_MESSAGE_MAP()
407 return handled; 399 return handled;
408 } 400 }
409 401
410 void BrowserPluginGuest::Initialize( 402 void BrowserPluginGuest::Initialize(
411 const BrowserPluginHostMsg_Attach_Params& params, 403 const BrowserPluginHostMsg_Attach_Params& params,
412 WebContentsImpl* embedder_web_contents) { 404 WebContentsImpl* embedder_web_contents) {
413 focused_ = params.focused; 405 focused_ = params.focused;
414 guest_visible_ = params.visible; 406 guest_visible_ = params.visible;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 bool BrowserPluginGuest::ShouldFocusPageAfterCrash() { 761 bool BrowserPluginGuest::ShouldFocusPageAfterCrash() {
770 // Rather than managing focus in WebContentsImpl::RenderViewReady, we will 762 // Rather than managing focus in WebContentsImpl::RenderViewReady, we will
771 // manage the focus ourselves. 763 // manage the focus ourselves.
772 return false; 764 return false;
773 } 765 }
774 766
775 WebContentsImpl* BrowserPluginGuest::GetWebContents() { 767 WebContentsImpl* BrowserPluginGuest::GetWebContents() {
776 return static_cast<WebContentsImpl*>(web_contents()); 768 return static_cast<WebContentsImpl*>(web_contents());
777 } 769 }
778 770
779 base::SharedMemory* BrowserPluginGuest::GetDamageBufferFromEmbedder(
780 const BrowserPluginHostMsg_ResizeGuest_Params& params) {
781 if (!attached()) {
782 LOG(WARNING) << "Attempting to map a damage buffer prior to attachment.";
783 return NULL;
784 }
785 #if defined(OS_WIN)
786 base::ProcessHandle handle =
787 embedder_web_contents_->GetRenderProcessHost()->GetHandle();
788 scoped_ptr<base::SharedMemory> shared_buf(
789 new base::SharedMemory(params.damage_buffer_handle, false, handle));
790 #elif defined(OS_POSIX)
791 scoped_ptr<base::SharedMemory> shared_buf(
792 new base::SharedMemory(params.damage_buffer_handle, false));
793 #endif
794 if (!shared_buf->Map(params.damage_buffer_size)) {
795 LOG(WARNING) << "Unable to map the embedder's damage buffer.";
796 return NULL;
797 }
798 return shared_buf.release();
799 }
800
801 void BrowserPluginGuest::SetDamageBuffer(
802 const BrowserPluginHostMsg_ResizeGuest_Params& params) {
803 damage_buffer_.reset(GetDamageBufferFromEmbedder(params));
804 // Sanity check: Verify that we've correctly shared the damage buffer memory
805 // between the embedder and browser processes.
806 DCHECK(!damage_buffer_ ||
807 *static_cast<unsigned int*>(damage_buffer_->memory()) == 0xdeadbeef);
808 damage_buffer_sequence_id_ = params.damage_buffer_sequence_id;
809 damage_buffer_size_ = params.damage_buffer_size;
810 damage_view_size_ = params.view_rect.size();
811 damage_buffer_scale_factor_ = params.scale_factor;
812 }
813
814 gfx::Point BrowserPluginGuest::GetScreenCoordinates( 771 gfx::Point BrowserPluginGuest::GetScreenCoordinates(
815 const gfx::Point& relative_position) const { 772 const gfx::Point& relative_position) const {
816 gfx::Point screen_pos(relative_position); 773 gfx::Point screen_pos(relative_position);
817 screen_pos += guest_window_rect_.OffsetFromOrigin(); 774 screen_pos += guest_window_rect_.OffsetFromOrigin();
818 return screen_pos; 775 return screen_pos;
819 } 776 }
820 777
821 bool BrowserPluginGuest::InAutoSizeBounds(const gfx::Size& size) const { 778 bool BrowserPluginGuest::InAutoSizeBounds(const gfx::Size& size) const {
822 return size.width() <= max_auto_size_.width() && 779 return size.width() <= max_auto_size_.width() &&
823 size.height() <= max_auto_size_.height(); 780 size.height() <= max_auto_size_.height();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); 891 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost();
935 // The guest RenderView should always live in a guest process. 892 // The guest RenderView should always live in a guest process.
936 CHECK(rvh->GetProcess()->IsGuest()); 893 CHECK(rvh->GetProcess()->IsGuest());
937 // TODO(fsamuel): Investigate whether it's possible to update state earlier 894 // TODO(fsamuel): Investigate whether it's possible to update state earlier
938 // here (see http://crbug.com/158151). 895 // here (see http://crbug.com/158151).
939 Send(new InputMsg_SetFocus(routing_id(), focused_)); 896 Send(new InputMsg_SetFocus(routing_id(), focused_));
940 UpdateVisibility(); 897 UpdateVisibility();
941 if (auto_size_enabled_) 898 if (auto_size_enabled_)
942 rvh->EnableAutoResize(min_auto_size_, max_auto_size_); 899 rvh->EnableAutoResize(min_auto_size_, max_auto_size_);
943 else 900 else
944 rvh->DisableAutoResize(damage_view_size_); 901 rvh->DisableAutoResize(full_size_);
945 902
946 Send(new ViewMsg_SetName(routing_id(), name_)); 903 Send(new ViewMsg_SetName(routing_id(), name_));
947 OnSetContentsOpaque(instance_id_, guest_opaque_); 904 OnSetContentsOpaque(instance_id_, guest_opaque_);
948 905
949 RenderWidgetHostImpl::From(rvh)-> 906 RenderWidgetHostImpl::From(rvh)->
950 set_hung_renderer_delay_ms(guest_hang_timeout_); 907 set_hung_renderer_delay_ms(guest_hang_timeout_);
951 } 908 }
952 909
953 void BrowserPluginGuest::RenderProcessGone(base::TerminationStatus status) { 910 void BrowserPluginGuest::RenderProcessGone(base::TerminationStatus status) {
954 SendMessageToEmbedder(new BrowserPluginMsg_GuestGone(instance_id())); 911 SendMessageToEmbedder(new BrowserPluginMsg_GuestGone(instance_id()));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 case BrowserPluginHostMsg_ReclaimCompositorResources::ID: 947 case BrowserPluginHostMsg_ReclaimCompositorResources::ID:
991 case BrowserPluginHostMsg_ResizeGuest::ID: 948 case BrowserPluginHostMsg_ResizeGuest::ID:
992 case BrowserPluginHostMsg_SetAutoSize::ID: 949 case BrowserPluginHostMsg_SetAutoSize::ID:
993 case BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent::ID: 950 case BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent::ID:
994 case BrowserPluginHostMsg_SetFocus::ID: 951 case BrowserPluginHostMsg_SetFocus::ID:
995 case BrowserPluginHostMsg_SetName::ID: 952 case BrowserPluginHostMsg_SetName::ID:
996 case BrowserPluginHostMsg_SetContentsOpaque::ID: 953 case BrowserPluginHostMsg_SetContentsOpaque::ID:
997 case BrowserPluginHostMsg_SetVisibility::ID: 954 case BrowserPluginHostMsg_SetVisibility::ID:
998 case BrowserPluginHostMsg_UnlockMouse_ACK::ID: 955 case BrowserPluginHostMsg_UnlockMouse_ACK::ID:
999 case BrowserPluginHostMsg_UpdateGeometry::ID: 956 case BrowserPluginHostMsg_UpdateGeometry::ID:
1000 case BrowserPluginHostMsg_UpdateRect_ACK::ID:
1001 return true; 957 return true;
1002 default: 958 default:
1003 return false; 959 return false;
1004 } 960 }
1005 } 961 }
1006 962
1007 bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) { 963 bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) {
1008 bool handled = true; 964 bool handled = true;
1009 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message) 965 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message)
1010 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, 966 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 render_widget_host->NotifyScreenInfoChanged(); 1269 render_widget_host->NotifyScreenInfoChanged();
1314 } 1270 }
1315 } 1271 }
1316 // When autosize is turned off and as a result there is a layout change, we 1272 // When autosize is turned off and as a result there is a layout change, we
1317 // send a sizechanged event. 1273 // send a sizechanged event.
1318 if (!auto_size_enabled_ && last_seen_auto_size_enabled_ && 1274 if (!auto_size_enabled_ && last_seen_auto_size_enabled_ &&
1319 !params.view_rect.size().IsEmpty() && delegate_) { 1275 !params.view_rect.size().IsEmpty() && delegate_) {
1320 delegate_->SizeChanged(last_seen_view_size_, params.view_rect.size()); 1276 delegate_->SizeChanged(last_seen_view_size_, params.view_rect.size());
1321 last_seen_auto_size_enabled_ = false; 1277 last_seen_auto_size_enabled_ = false;
1322 } 1278 }
1323 // Invalid damage buffer means we are in HW compositing mode, 1279 // Just resize the WebContents and repaint if needed.
1324 // so just resize the WebContents and repaint if needed. 1280 full_size_ = params.view_rect.size();
1325 if (base::SharedMemory::IsHandleValid(params.damage_buffer_handle))
1326 SetDamageBuffer(params);
1327 if (!params.view_rect.size().IsEmpty()) 1281 if (!params.view_rect.size().IsEmpty())
1328 GetWebContents()->GetView()->SizeContents(params.view_rect.size()); 1282 GetWebContents()->GetView()->SizeContents(params.view_rect.size());
1329 if (params.repaint) 1283 if (params.repaint)
1330 Send(new ViewMsg_Repaint(routing_id(), params.view_rect.size())); 1284 Send(new ViewMsg_Repaint(routing_id(), params.view_rect.size()));
1331 } 1285 }
1332 1286
1333 void BrowserPluginGuest::OnSetFocus(int instance_id, bool focused) { 1287 void BrowserPluginGuest::OnSetFocus(int instance_id, bool focused) {
1334 focused_ = focused; 1288 focused_ = focused;
1335 Send(new InputMsg_SetFocus(routing_id(), focused)); 1289 Send(new InputMsg_SetFocus(routing_id(), focused));
1336 if (!focused && mouse_locked_) 1290 if (!focused && mouse_locked_)
(...skipping 26 matching lines...) Expand all
1363 max_auto_size_ = auto_size_params.max_size; 1317 max_auto_size_ = auto_size_params.max_size;
1364 min_auto_size_ = auto_size_params.min_size; 1318 min_auto_size_ = auto_size_params.min_size;
1365 if (auto_size_enabled_ && (!old_auto_size_enabled || 1319 if (auto_size_enabled_ && (!old_auto_size_enabled ||
1366 (old_max_size != max_auto_size_) || 1320 (old_max_size != max_auto_size_) ||
1367 (old_min_size != min_auto_size_))) { 1321 (old_min_size != min_auto_size_))) {
1368 RecordAction( 1322 RecordAction(
1369 base::UserMetricsAction("BrowserPlugin.Guest.EnableAutoResize")); 1323 base::UserMetricsAction("BrowserPlugin.Guest.EnableAutoResize"));
1370 GetWebContents()->GetRenderViewHost()->EnableAutoResize( 1324 GetWebContents()->GetRenderViewHost()->EnableAutoResize(
1371 min_auto_size_, max_auto_size_); 1325 min_auto_size_, max_auto_size_);
1372 // TODO(fsamuel): If we're changing autosize parameters, then we force 1326 // TODO(fsamuel): If we're changing autosize parameters, then we force
1373 // the guest to completely repaint itself, because BrowserPlugin has 1327 // the guest to completely repaint itself.
1374 // allocated a new damage buffer and expects a full frame of pixels. 1328 // Ideally, we shouldn't need to do this unless |max_auto_size_| has
1375 // Ideally, we shouldn't need to do this because we shouldn't need to 1329 // changed.
1376 // allocate a new damage buffer unless |max_auto_size_| has changed.
1377 // However, even in that case, layout may not change and so we may 1330 // However, even in that case, layout may not change and so we may
1378 // not get a full frame worth of pixels. 1331 // not get a full frame worth of pixels.
1379 Send(new ViewMsg_Repaint(routing_id(), max_auto_size_)); 1332 Send(new ViewMsg_Repaint(routing_id(), max_auto_size_));
1380 } else if (!auto_size_enabled_ && old_auto_size_enabled) { 1333 } else if (!auto_size_enabled_ && old_auto_size_enabled) {
1381 GetWebContents()->GetRenderViewHost()->DisableAutoResize( 1334 GetWebContents()->GetRenderViewHost()->DisableAutoResize(
1382 resize_guest_params.view_rect.size()); 1335 resize_guest_params.view_rect.size());
1383 } 1336 }
1384 OnResizeGuest(instance_id_, resize_guest_params); 1337 OnResizeGuest(instance_id_, resize_guest_params);
1385 } 1338 }
1386 1339
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 1371
1419 void BrowserPluginGuest::OnUnlockMouseAck(int instance_id) { 1372 void BrowserPluginGuest::OnUnlockMouseAck(int instance_id) {
1420 // mouse_locked_ could be false here if the lock attempt was cancelled due 1373 // mouse_locked_ could be false here if the lock attempt was cancelled due
1421 // to window focus, or for various other reasons before the guest was informed 1374 // to window focus, or for various other reasons before the guest was informed
1422 // of the lock's success. 1375 // of the lock's success.
1423 if (mouse_locked_) 1376 if (mouse_locked_)
1424 Send(new ViewMsg_MouseLockLost(routing_id())); 1377 Send(new ViewMsg_MouseLockLost(routing_id()));
1425 mouse_locked_ = false; 1378 mouse_locked_ = false;
1426 } 1379 }
1427 1380
1428 void BrowserPluginGuest::OnUpdateRectACK(
1429 int instance_id,
1430 const BrowserPluginHostMsg_AutoSize_Params& auto_size_params,
1431 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params) {
1432 OnSetSize(instance_id_, auto_size_params, resize_guest_params);
1433 }
1434
1435 void BrowserPluginGuest::OnCopyFromCompositingSurfaceAck( 1381 void BrowserPluginGuest::OnCopyFromCompositingSurfaceAck(
1436 int instance_id, 1382 int instance_id,
1437 int request_id, 1383 int request_id,
1438 const SkBitmap& bitmap) { 1384 const SkBitmap& bitmap) {
1439 CHECK(copy_request_callbacks_.count(request_id)); 1385 CHECK(copy_request_callbacks_.count(request_id));
1440 if (!copy_request_callbacks_.count(request_id)) 1386 if (!copy_request_callbacks_.count(request_id))
1441 return; 1387 return;
1442 const CopyRequestCallback& callback = copy_request_callbacks_[request_id]; 1388 const CopyRequestCallback& callback = copy_request_callbacks_[request_id];
1443 callback.Run(!bitmap.empty() && !bitmap.isNull(), bitmap); 1389 callback.Run(!bitmap.empty() && !bitmap.isNull(), bitmap);
1444 copy_request_callbacks_.erase(request_id); 1390 copy_request_callbacks_.erase(request_id);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 event.type == blink::WebGestureEvent::GesturePinchEnd; 1469 event.type == blink::WebGestureEvent::GesturePinchEnd;
1524 } 1470 }
1525 1471
1526 void BrowserPluginGuest::OnUpdateRect( 1472 void BrowserPluginGuest::OnUpdateRect(
1527 const ViewHostMsg_UpdateRect_Params& params) { 1473 const ViewHostMsg_UpdateRect_Params& params) {
1528 BrowserPluginMsg_UpdateRect_Params relay_params; 1474 BrowserPluginMsg_UpdateRect_Params relay_params;
1529 relay_params.view_size = params.view_size; 1475 relay_params.view_size = params.view_size;
1530 relay_params.scale_factor = params.scale_factor; 1476 relay_params.scale_factor = params.scale_factor;
1531 relay_params.is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack( 1477 relay_params.is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack(
1532 params.flags); 1478 params.flags);
1533 relay_params.needs_ack = false;
1534 1479
1535 bool size_changed = last_seen_view_size_ != params.view_size; 1480 bool size_changed = last_seen_view_size_ != params.view_size;
1536 gfx::Size old_size = last_seen_view_size_; 1481 gfx::Size old_size = last_seen_view_size_;
1537 last_seen_view_size_ = params.view_size; 1482 last_seen_view_size_ = params.view_size;
1538 1483
1539 if ((auto_size_enabled_ || last_seen_auto_size_enabled_) && 1484 if ((auto_size_enabled_ || last_seen_auto_size_enabled_) &&
1540 size_changed && delegate_) { 1485 size_changed && delegate_) {
1541 delegate_->SizeChanged(old_size, last_seen_view_size_); 1486 delegate_->SizeChanged(old_size, last_seen_view_size_);
1542 } 1487 }
1543 last_seen_auto_size_enabled_ = auto_size_enabled_; 1488 last_seen_auto_size_enabled_ = auto_size_enabled_;
1544 1489
1545 relay_params.damage_buffer_sequence_id = 0;
1546 SendMessageToEmbedder( 1490 SendMessageToEmbedder(
1547 new BrowserPluginMsg_UpdateRect(instance_id(), relay_params)); 1491 new BrowserPluginMsg_UpdateRect(instance_id(), relay_params));
1548 } 1492 }
1549 1493
1550 void BrowserPluginGuest::OnTextInputTypeChanged(ui::TextInputType type, 1494 void BrowserPluginGuest::OnTextInputTypeChanged(ui::TextInputType type,
1551 ui::TextInputMode input_mode, 1495 ui::TextInputMode input_mode,
1552 bool can_compose_inline) { 1496 bool can_compose_inline) {
1553 // Save the state of text input so we can restore it on focus. 1497 // Save the state of text input so we can restore it on focus.
1554 last_text_input_type_ = type; 1498 last_text_input_type_ = type;
1555 last_input_mode_ = input_mode; 1499 last_input_mode_ = input_mode;
(...skipping 25 matching lines...) Expand all
1581 const GURL& url) { 1525 const GURL& url) {
1582 if (!url.is_valid()) { 1526 if (!url.is_valid()) {
1583 callback.Run(false); 1527 callback.Run(false);
1584 return; 1528 return;
1585 } 1529 }
1586 1530
1587 delegate_->CanDownload(request_method, url, callback); 1531 delegate_->CanDownload(request_method, url, callback);
1588 } 1532 }
1589 1533
1590 } // namespace content 1534 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698