OLD | NEW |
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/pickle.h" | 10 #include "base/pickle.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 DISALLOW_COPY_AND_ASSIGN(EmbedderVisibilityObserver); | 72 DISALLOW_COPY_AND_ASSIGN(EmbedderVisibilityObserver); |
73 }; | 73 }; |
74 | 74 |
75 BrowserPluginGuest::BrowserPluginGuest(bool has_render_view, | 75 BrowserPluginGuest::BrowserPluginGuest(bool has_render_view, |
76 WebContentsImpl* web_contents, | 76 WebContentsImpl* web_contents, |
77 BrowserPluginGuestDelegate* delegate) | 77 BrowserPluginGuestDelegate* delegate) |
78 : WebContentsObserver(web_contents), | 78 : WebContentsObserver(web_contents), |
79 owner_web_contents_(nullptr), | 79 owner_web_contents_(nullptr), |
80 attached_(false), | 80 attached_(false), |
| 81 has_attached_since_surface_set_(false), |
81 browser_plugin_instance_id_(browser_plugin::kInstanceIDNone), | 82 browser_plugin_instance_id_(browser_plugin::kInstanceIDNone), |
82 focused_(false), | 83 focused_(false), |
83 mouse_locked_(false), | 84 mouse_locked_(false), |
84 pending_lock_request_(false), | 85 pending_lock_request_(false), |
85 guest_visible_(false), | 86 guest_visible_(false), |
86 embedder_visible_(true), | 87 embedder_visible_(true), |
87 is_full_page_plugin_(false), | 88 is_full_page_plugin_(false), |
88 has_render_view_(has_render_view), | 89 has_render_view_(has_render_view), |
89 is_in_destruction_(false), | 90 is_in_destruction_(false), |
90 initialized_(false), | 91 initialized_(false), |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 SendMessageToEmbedder( | 398 SendMessageToEmbedder( |
398 new BrowserPluginMsg_CompositorFrameSwapped( | 399 new BrowserPluginMsg_CompositorFrameSwapped( |
399 browser_plugin_instance_id(), *last_pending_frame_)); | 400 browser_plugin_instance_id(), *last_pending_frame_)); |
400 } | 401 } |
401 | 402 |
402 void BrowserPluginGuest::SetChildFrameSurface( | 403 void BrowserPluginGuest::SetChildFrameSurface( |
403 const cc::SurfaceId& surface_id, | 404 const cc::SurfaceId& surface_id, |
404 const gfx::Size& frame_size, | 405 const gfx::Size& frame_size, |
405 float scale_factor, | 406 float scale_factor, |
406 const cc::SurfaceSequence& sequence) { | 407 const cc::SurfaceSequence& sequence) { |
| 408 has_attached_since_surface_set_ = false; |
407 SendMessageToEmbedder(new BrowserPluginMsg_SetChildFrameSurface( | 409 SendMessageToEmbedder(new BrowserPluginMsg_SetChildFrameSurface( |
408 browser_plugin_instance_id(), surface_id, frame_size, scale_factor, | 410 browser_plugin_instance_id(), surface_id, frame_size, scale_factor, |
409 sequence)); | 411 sequence)); |
410 } | 412 } |
411 | 413 |
412 void BrowserPluginGuest::OnSatisfySequence( | 414 void BrowserPluginGuest::OnSatisfySequence( |
413 int instance_id, | 415 int instance_id, |
414 const cc::SurfaceSequence& sequence) { | 416 const cc::SurfaceSequence& sequence) { |
415 std::vector<uint32_t> sequences; | 417 std::vector<uint32_t> sequences; |
416 sequences.push_back(sequence.sequence); | 418 sequences.push_back(sequence.sequence); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); | 706 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); |
705 if (!web_contents()->GetRenderViewHost()->GetView()) { | 707 if (!web_contents()->GetRenderViewHost()->GetView()) { |
706 web_contents_view->CreateViewForWidget( | 708 web_contents_view->CreateViewForWidget( |
707 web_contents()->GetRenderViewHost(), true); | 709 web_contents()->GetRenderViewHost(), true); |
708 } | 710 } |
709 } | 711 } |
710 | 712 |
711 InitInternal(params, embedder_web_contents); | 713 InitInternal(params, embedder_web_contents); |
712 | 714 |
713 attached_ = true; | 715 attached_ = true; |
| 716 has_attached_since_surface_set_ = true; |
714 SendQueuedMessages(); | 717 SendQueuedMessages(); |
715 | 718 |
716 delegate_->DidAttach(GetGuestProxyRoutingID()); | 719 delegate_->DidAttach(GetGuestProxyRoutingID()); |
717 | 720 |
718 has_render_view_ = true; | 721 has_render_view_ = true; |
719 | 722 |
720 // Enable input method for guest if it's enabled for the embedder. | 723 // Enable input method for guest if it's enabled for the embedder. |
721 if (static_cast<RenderViewHostImpl*>( | 724 if (static_cast<RenderViewHostImpl*>( |
722 owner_web_contents_->GetRenderViewHost())->input_method_active()) { | 725 owner_web_contents_->GetRenderViewHost())->input_method_active()) { |
723 RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( | 726 RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 void BrowserPluginGuest::OnImeCompositionRangeChanged( | 972 void BrowserPluginGuest::OnImeCompositionRangeChanged( |
970 const gfx::Range& range, | 973 const gfx::Range& range, |
971 const std::vector<gfx::Rect>& character_bounds) { | 974 const std::vector<gfx::Rect>& character_bounds) { |
972 static_cast<RenderWidgetHostViewBase*>( | 975 static_cast<RenderWidgetHostViewBase*>( |
973 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( | 976 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( |
974 range, character_bounds); | 977 range, character_bounds); |
975 } | 978 } |
976 #endif | 979 #endif |
977 | 980 |
978 } // namespace content | 981 } // namespace content |
OLD | NEW |