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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_guest.cc

Issue 554773002: BrowserPlugin: Remove BrowserPluginGuest::ToGuestRect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 6 years, 3 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
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind_helpers.h" 5 #include "base/bind_helpers.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/browser/browser_plugin/browser_plugin_guest.h" 9 #include "content/browser/browser_plugin/browser_plugin_guest.h"
10 #include "content/browser/frame_host/render_widget_host_view_guest.h" 10 #include "content/browser/frame_host/render_widget_host_view_guest.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 #endif 121 #endif
122 122
123 gfx::Rect RenderWidgetHostViewGuest::GetViewBounds() const { 123 gfx::Rect RenderWidgetHostViewGuest::GetViewBounds() const {
124 if (!guest_) 124 if (!guest_)
125 return gfx::Rect(); 125 return gfx::Rect();
126 126
127 RenderWidgetHostViewBase* rwhv = GetGuestRenderWidgetHostView(); 127 RenderWidgetHostViewBase* rwhv = GetGuestRenderWidgetHostView();
128 gfx::Rect embedder_bounds; 128 gfx::Rect embedder_bounds;
129 if (rwhv) 129 if (rwhv)
130 embedder_bounds = rwhv->GetViewBounds(); 130 embedder_bounds = rwhv->GetViewBounds();
131 gfx::Rect shifted_rect = guest_->ToGuestRect(embedder_bounds); 131 return gfx::Rect(
132 shifted_rect.set_width(size_.width()); 132 guest_->GetScreenCoordinates(embedder_bounds.origin()), size_);
133 shifted_rect.set_height(size_.height());
134 return shifted_rect;
135 } 133 }
136 134
137 void RenderWidgetHostViewGuest::RenderProcessGone( 135 void RenderWidgetHostViewGuest::RenderProcessGone(
138 base::TerminationStatus status, 136 base::TerminationStatus status,
139 int error_code) { 137 int error_code) {
140 platform_view_->RenderProcessGone(status, error_code); 138 platform_view_->RenderProcessGone(status, error_code);
141 // Destroy the guest view instance only, so we don't end up calling 139 // Destroy the guest view instance only, so we don't end up calling
142 // platform_view_->Destroy(). 140 // platform_view_->Destroy().
143 DestroyGuestView(); 141 DestroyGuestView();
144 } 142 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 const gfx::Range& range, 288 const gfx::Range& range,
291 const std::vector<gfx::Rect>& character_bounds) { 289 const std::vector<gfx::Rect>& character_bounds) {
292 if (!guest_) 290 if (!guest_)
293 return; 291 return;
294 292
295 RenderWidgetHostViewBase* rwhv = GetGuestRenderWidgetHostView(); 293 RenderWidgetHostViewBase* rwhv = GetGuestRenderWidgetHostView();
296 if (!rwhv) 294 if (!rwhv)
297 return; 295 return;
298 std::vector<gfx::Rect> guest_character_bounds; 296 std::vector<gfx::Rect> guest_character_bounds;
299 for (size_t i = 0; i < character_bounds.size(); ++i) { 297 for (size_t i = 0; i < character_bounds.size(); ++i) {
300 gfx::Rect guest_rect = guest_->ToGuestRect(character_bounds[i]); 298 guest_character_bounds.push_back(gfx::Rect(
301 guest_character_bounds.push_back(guest_rect); 299 guest_->GetScreenCoordinates(character_bounds[i].origin()),
300 character_bounds[i].size()));
302 } 301 }
303 // Forward the information to embedding RWHV. 302 // Forward the information to embedding RWHV.
304 rwhv->ImeCompositionRangeChanged(range, guest_character_bounds); 303 rwhv->ImeCompositionRangeChanged(range, guest_character_bounds);
305 } 304 }
306 #endif 305 #endif
307 306
308 void RenderWidgetHostViewGuest::SelectionChanged(const base::string16& text, 307 void RenderWidgetHostViewGuest::SelectionChanged(const base::string16& text,
309 size_t offset, 308 size_t offset,
310 const gfx::Range& range) { 309 const gfx::Range& range) {
311 platform_view_->SelectionChanged(text, offset, range); 310 platform_view_->SelectionChanged(text, offset, range);
312 } 311 }
313 312
314 void RenderWidgetHostViewGuest::SelectionBoundsChanged( 313 void RenderWidgetHostViewGuest::SelectionBoundsChanged(
315 const ViewHostMsg_SelectionBounds_Params& params) { 314 const ViewHostMsg_SelectionBounds_Params& params) {
316 if (!guest_) 315 if (!guest_)
317 return; 316 return;
318 317
319 RenderWidgetHostViewBase* rwhv = GetGuestRenderWidgetHostView(); 318 RenderWidgetHostViewBase* rwhv = GetGuestRenderWidgetHostView();
320 if (!rwhv) 319 if (!rwhv)
321 return; 320 return;
322 ViewHostMsg_SelectionBounds_Params guest_params(params); 321 ViewHostMsg_SelectionBounds_Params guest_params(params);
323 guest_params.anchor_rect = guest_->ToGuestRect(params.anchor_rect); 322 guest_params.anchor_rect.set_origin(
324 guest_params.focus_rect = guest_->ToGuestRect(params.focus_rect); 323 guest_->GetScreenCoordinates(params.anchor_rect.origin()));
324 guest_params.focus_rect.set_origin(
325 guest_->GetScreenCoordinates(params.focus_rect.origin()));
325 rwhv->SelectionBoundsChanged(guest_params); 326 rwhv->SelectionBoundsChanged(guest_params);
326 } 327 }
327 328
328 void RenderWidgetHostViewGuest::CopyFromCompositingSurface( 329 void RenderWidgetHostViewGuest::CopyFromCompositingSurface(
329 const gfx::Rect& src_subrect, 330 const gfx::Rect& src_subrect,
330 const gfx::Size& dst_size, 331 const gfx::Size& dst_size,
331 const base::Callback<void(bool, const SkBitmap&)>& callback, 332 const base::Callback<void(bool, const SkBitmap&)>& callback,
332 const SkColorType color_type) { 333 const SkColorType color_type) {
333 CHECK(guest_); 334 CHECK(guest_);
334 guest_->CopyFromCompositingSurface(src_subrect, dst_size, callback); 335 guest_->CopyFromCompositingSurface(src_subrect, dst_size, callback);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 return kN32_SkColorType; 524 return kN32_SkColorType;
524 } 525 }
525 526
526 RenderWidgetHostViewBase* 527 RenderWidgetHostViewBase*
527 RenderWidgetHostViewGuest::GetGuestRenderWidgetHostView() const { 528 RenderWidgetHostViewGuest::GetGuestRenderWidgetHostView() const {
528 return static_cast<RenderWidgetHostViewBase*>( 529 return static_cast<RenderWidgetHostViewBase*>(
529 guest_->GetEmbedderRenderWidgetHostView()); 530 guest_->GetEmbedderRenderWidgetHostView());
530 } 531 }
531 532
532 } // namespace content 533 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698