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/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 gfx::ScaleSize(disambiguation_target_rect_.size(), scale))); | 1273 gfx::ScaleSize(disambiguation_target_rect_.size(), scale))); |
1274 | 1274 |
1275 // Save of a copy of the |last_scroll_offset_| for comparison when the copy | 1275 // Save of a copy of the |last_scroll_offset_| for comparison when the copy |
1276 // callback fires, to ensure that we haven't scrolled. | 1276 // callback fires, to ensure that we haven't scrolled. |
1277 disambiguation_scroll_offset_ = last_scroll_offset_; | 1277 disambiguation_scroll_offset_ = last_scroll_offset_; |
1278 | 1278 |
1279 CopyFromCompositingSurface( | 1279 CopyFromCompositingSurface( |
1280 disambiguation_target_rect_, | 1280 disambiguation_target_rect_, |
1281 zoomed_size, | 1281 zoomed_size, |
1282 base::Bind(&RenderWidgetHostViewAura::DisambiguationPopupRendered, | 1282 base::Bind(&RenderWidgetHostViewAura::DisambiguationPopupRendered, |
1283 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr | 1283 weak_ptr_factory_.GetWeakPtr()), |
1284 <RenderWidgetHostViewAura>(this)), | 1284 kN32_SkColorType); |
1285 kN32_SkColorType); | |
1286 } | 1285 } |
1287 | 1286 |
1288 void RenderWidgetHostViewAura::DisambiguationPopupRendered( | 1287 void RenderWidgetHostViewAura::DisambiguationPopupRendered( |
1289 const SkBitmap& result, | 1288 const SkBitmap& result, |
1290 ReadbackResponse response) { | 1289 ReadbackResponse response) { |
1291 if ((response != READBACK_SUCCESS) || | 1290 if ((response != READBACK_SUCCESS) || |
1292 disambiguation_scroll_offset_ != last_scroll_offset_) | 1291 disambiguation_scroll_offset_ != last_scroll_offset_) |
1293 return; | 1292 return; |
1294 | 1293 |
1295 // Use RenderViewHostDelegate to get to the WebContentsViewAura, which will | 1294 // Use RenderViewHostDelegate to get to the WebContentsViewAura, which will |
1296 // actually show the disambiguation popup. | 1295 // actually show the disambiguation popup. |
1297 RenderViewHostDelegate* delegate = NULL; | 1296 RenderViewHostDelegate* delegate = NULL; |
1298 if (host_->IsRenderView()) | 1297 if (host_->IsRenderView()) |
1299 delegate = RenderViewHost::From(host_)->GetDelegate(); | 1298 delegate = RenderViewHost::From(host_)->GetDelegate(); |
1300 RenderViewHostDelegateView* delegate_view = NULL; | 1299 RenderViewHostDelegateView* delegate_view = NULL; |
1301 if (delegate) { | 1300 if (delegate) { |
1302 delegate_view = delegate->GetDelegateView(); | 1301 delegate_view = delegate->GetDelegateView(); |
1303 if (delegate->IsVirtualKeyboardRequested()) | 1302 if (delegate->IsVirtualKeyboardRequested()) |
1304 return; | 1303 return; |
1305 } | 1304 } |
1306 if (delegate_view) { | 1305 if (delegate_view) { |
1307 delegate_view->ShowDisambiguationPopup( | 1306 delegate_view->ShowDisambiguationPopup( |
1308 disambiguation_target_rect_, | 1307 disambiguation_target_rect_, |
1309 result, | 1308 result, |
1310 base::Bind(&RenderWidgetHostViewAura::ProcessDisambiguationGesture, | 1309 base::Bind(&RenderWidgetHostViewAura::ProcessDisambiguationGesture, |
1311 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr | 1310 weak_ptr_factory_.GetWeakPtr()), |
1312 <RenderWidgetHostViewAura>(this)), | |
1313 base::Bind(&RenderWidgetHostViewAura::ProcessDisambiguationMouse, | 1311 base::Bind(&RenderWidgetHostViewAura::ProcessDisambiguationMouse, |
1314 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr | 1312 weak_ptr_factory_.GetWeakPtr())); |
1315 <RenderWidgetHostViewAura>(this))); | |
1316 } | 1313 } |
1317 } | 1314 } |
1318 | 1315 |
1319 void RenderWidgetHostViewAura::HideDisambiguationPopup() { | 1316 void RenderWidgetHostViewAura::HideDisambiguationPopup() { |
1320 RenderViewHostDelegate* delegate = NULL; | 1317 RenderViewHostDelegate* delegate = NULL; |
1321 if (host_->IsRenderView()) | 1318 if (host_->IsRenderView()) |
1322 delegate = RenderViewHost::From(host_)->GetDelegate(); | 1319 delegate = RenderViewHost::From(host_)->GetDelegate(); |
1323 RenderViewHostDelegateView* delegate_view = NULL; | 1320 RenderViewHostDelegateView* delegate_view = NULL; |
1324 if (delegate) | 1321 if (delegate) |
1325 delegate_view = delegate->GetDelegateView(); | 1322 delegate_view = delegate->GetDelegateView(); |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2578 | 2575 |
2579 //////////////////////////////////////////////////////////////////////////////// | 2576 //////////////////////////////////////////////////////////////////////////////// |
2580 // RenderWidgetHostViewBase, public: | 2577 // RenderWidgetHostViewBase, public: |
2581 | 2578 |
2582 // static | 2579 // static |
2583 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2580 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2584 GetScreenInfoForWindow(results, NULL); | 2581 GetScreenInfoForWindow(results, NULL); |
2585 } | 2582 } |
2586 | 2583 |
2587 } // namespace content | 2584 } // namespace content |
OLD | NEW |