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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 BrowserPluginGuestDelegate* delegate) | 74 BrowserPluginGuestDelegate* delegate) |
75 : WebContentsObserver(web_contents), | 75 : WebContentsObserver(web_contents), |
76 embedder_web_contents_(NULL), | 76 embedder_web_contents_(NULL), |
77 browser_plugin_instance_id_(browser_plugin::kInstanceIDNone), | 77 browser_plugin_instance_id_(browser_plugin::kInstanceIDNone), |
78 guest_device_scale_factor_(1.0f), | 78 guest_device_scale_factor_(1.0f), |
79 focused_(false), | 79 focused_(false), |
80 mouse_locked_(false), | 80 mouse_locked_(false), |
81 pending_lock_request_(false), | 81 pending_lock_request_(false), |
82 guest_visible_(false), | 82 guest_visible_(false), |
83 embedder_visible_(true), | 83 embedder_visible_(true), |
| 84 is_full_page_plugin_(false), |
84 copy_request_id_(0), | 85 copy_request_id_(0), |
85 has_render_view_(has_render_view), | 86 has_render_view_(has_render_view), |
86 is_in_destruction_(false), | 87 is_in_destruction_(false), |
87 last_text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 88 last_text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
88 last_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 89 last_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
89 last_can_compose_inline_(true), | 90 last_can_compose_inline_(true), |
90 guest_proxy_routing_id_(MSG_ROUTING_NONE), | 91 guest_proxy_routing_id_(MSG_ROUTING_NONE), |
91 delegate_(delegate), | 92 delegate_(delegate), |
92 weak_ptr_factory_(this) { | 93 weak_ptr_factory_(this) { |
93 DCHECK(web_contents); | 94 DCHECK(web_contents); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return handled; | 187 return handled; |
187 } | 188 } |
188 | 189 |
189 void BrowserPluginGuest::Initialize( | 190 void BrowserPluginGuest::Initialize( |
190 int browser_plugin_instance_id, | 191 int browser_plugin_instance_id, |
191 const BrowserPluginHostMsg_Attach_Params& params, | 192 const BrowserPluginHostMsg_Attach_Params& params, |
192 WebContentsImpl* embedder_web_contents) { | 193 WebContentsImpl* embedder_web_contents) { |
193 browser_plugin_instance_id_ = browser_plugin_instance_id; | 194 browser_plugin_instance_id_ = browser_plugin_instance_id; |
194 focused_ = params.focused; | 195 focused_ = params.focused; |
195 guest_visible_ = params.visible; | 196 guest_visible_ = params.visible; |
| 197 is_full_page_plugin_ = params.is_full_page_plugin; |
196 guest_window_rect_ = gfx::Rect(params.origin, | 198 guest_window_rect_ = gfx::Rect(params.origin, |
197 params.resize_guest_params.view_size); | 199 params.resize_guest_params.view_size); |
198 | 200 |
199 WebContentsViewGuest* new_view = | 201 WebContentsViewGuest* new_view = |
200 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); | 202 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); |
201 if (attached()) | 203 if (attached()) |
202 new_view->OnGuestDetached(embedder_web_contents_->GetView()); | 204 new_view->OnGuestDetached(embedder_web_contents_->GetView()); |
203 | 205 |
204 // Once a BrowserPluginGuest has an embedder WebContents, it's considered to | 206 // Once a BrowserPluginGuest has an embedder WebContents, it's considered to |
205 // be attached. | 207 // be attached. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 new BrowserPluginMsg_CompositorFrameSwapped( | 340 new BrowserPluginMsg_CompositorFrameSwapped( |
339 browser_plugin_instance_id(), guest_params)); | 341 browser_plugin_instance_id(), guest_params)); |
340 } | 342 } |
341 | 343 |
342 void BrowserPluginGuest::SetContentsOpaque(bool opaque) { | 344 void BrowserPluginGuest::SetContentsOpaque(bool opaque) { |
343 SendMessageToEmbedder( | 345 SendMessageToEmbedder( |
344 new BrowserPluginMsg_SetContentsOpaque( | 346 new BrowserPluginMsg_SetContentsOpaque( |
345 browser_plugin_instance_id(), opaque)); | 347 browser_plugin_instance_id(), opaque)); |
346 } | 348 } |
347 | 349 |
| 350 bool BrowserPluginGuest::Find(int request_id, |
| 351 const base::string16& search_text, |
| 352 const blink::WebFindOptions& options) { |
| 353 return delegate_->Find(request_id, search_text, options, |
| 354 is_full_page_plugin_); |
| 355 } |
| 356 |
348 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { | 357 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { |
349 return static_cast<WebContentsImpl*>(web_contents()); | 358 return static_cast<WebContentsImpl*>(web_contents()); |
350 } | 359 } |
351 | 360 |
352 gfx::Point BrowserPluginGuest::GetScreenCoordinates( | 361 gfx::Point BrowserPluginGuest::GetScreenCoordinates( |
353 const gfx::Point& relative_position) const { | 362 const gfx::Point& relative_position) const { |
354 if (!attached()) | 363 if (!attached()) |
355 return relative_position; | 364 return relative_position; |
356 | 365 |
357 gfx::Point screen_pos(relative_position); | 366 gfx::Point screen_pos(relative_position); |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 void BrowserPluginGuest::OnImeCompositionRangeChanged( | 813 void BrowserPluginGuest::OnImeCompositionRangeChanged( |
805 const gfx::Range& range, | 814 const gfx::Range& range, |
806 const std::vector<gfx::Rect>& character_bounds) { | 815 const std::vector<gfx::Rect>& character_bounds) { |
807 static_cast<RenderWidgetHostViewBase*>( | 816 static_cast<RenderWidgetHostViewBase*>( |
808 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( | 817 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( |
809 range, character_bounds); | 818 range, character_bounds); |
810 } | 819 } |
811 #endif | 820 #endif |
812 | 821 |
813 } // namespace content | 822 } // namespace content |
OLD | NEW |