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 delegate_(delegate), | 91 delegate_(delegate), |
91 weak_ptr_factory_(this) { | 92 weak_ptr_factory_(this) { |
92 DCHECK(web_contents); | 93 DCHECK(web_contents); |
93 DCHECK(delegate); | 94 DCHECK(delegate); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 return handled; | 191 return handled; |
191 } | 192 } |
192 | 193 |
193 void BrowserPluginGuest::Initialize( | 194 void BrowserPluginGuest::Initialize( |
194 int browser_plugin_instance_id, | 195 int browser_plugin_instance_id, |
195 const BrowserPluginHostMsg_Attach_Params& params, | 196 const BrowserPluginHostMsg_Attach_Params& params, |
196 WebContentsImpl* embedder_web_contents) { | 197 WebContentsImpl* embedder_web_contents) { |
197 browser_plugin_instance_id_ = browser_plugin_instance_id; | 198 browser_plugin_instance_id_ = browser_plugin_instance_id; |
198 focused_ = params.focused; | 199 focused_ = params.focused; |
199 guest_visible_ = params.visible; | 200 guest_visible_ = params.visible; |
| 201 is_full_page_plugin_ = params.is_full_page_plugin; |
200 guest_window_rect_ = gfx::Rect(params.origin, | 202 guest_window_rect_ = gfx::Rect(params.origin, |
201 params.resize_guest_params.view_size); | 203 params.resize_guest_params.view_size); |
202 | 204 |
203 // Once a BrowserPluginGuest has an embedder WebContents, it's considered to | 205 // Once a BrowserPluginGuest has an embedder WebContents, it's considered to |
204 // be attached. | 206 // be attached. |
205 embedder_web_contents_ = embedder_web_contents; | 207 embedder_web_contents_ = embedder_web_contents; |
206 | 208 |
207 WebContentsViewGuest* new_view = | 209 WebContentsViewGuest* new_view = |
208 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); | 210 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); |
209 new_view->OnGuestInitialized(embedder_web_contents->GetView()); | 211 new_view->OnGuestInitialized(embedder_web_contents->GetView()); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 new BrowserPluginMsg_CompositorFrameSwapped( | 343 new BrowserPluginMsg_CompositorFrameSwapped( |
342 browser_plugin_instance_id(), guest_params)); | 344 browser_plugin_instance_id(), guest_params)); |
343 } | 345 } |
344 | 346 |
345 void BrowserPluginGuest::SetContentsOpaque(bool opaque) { | 347 void BrowserPluginGuest::SetContentsOpaque(bool opaque) { |
346 SendMessageToEmbedder( | 348 SendMessageToEmbedder( |
347 new BrowserPluginMsg_SetContentsOpaque( | 349 new BrowserPluginMsg_SetContentsOpaque( |
348 browser_plugin_instance_id(), opaque)); | 350 browser_plugin_instance_id(), opaque)); |
349 } | 351 } |
350 | 352 |
| 353 bool BrowserPluginGuest::Find(int request_id, |
| 354 const base::string16& search_text, |
| 355 const blink::WebFindOptions& options) { |
| 356 return delegate_->Find(request_id, search_text, options, |
| 357 is_full_page_plugin_); |
| 358 } |
| 359 |
351 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { | 360 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { |
352 return static_cast<WebContentsImpl*>(web_contents()); | 361 return static_cast<WebContentsImpl*>(web_contents()); |
353 } | 362 } |
354 | 363 |
355 gfx::Point BrowserPluginGuest::GetScreenCoordinates( | 364 gfx::Point BrowserPluginGuest::GetScreenCoordinates( |
356 const gfx::Point& relative_position) const { | 365 const gfx::Point& relative_position) const { |
357 if (!attached()) | 366 if (!attached()) |
358 return relative_position; | 367 return relative_position; |
359 | 368 |
360 gfx::Point screen_pos(relative_position); | 369 gfx::Point screen_pos(relative_position); |
(...skipping 443 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 |