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/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 if (web_contents_->GetDelegate() && | 1346 if (web_contents_->GetDelegate() && |
1347 !web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse) && | 1347 !web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse) && |
1348 delegate_.get()) { | 1348 delegate_.get()) { |
1349 delegate_->TakeFocus(reverse); | 1349 delegate_->TakeFocus(reverse); |
1350 } | 1350 } |
1351 } | 1351 } |
1352 | 1352 |
1353 //////////////////////////////////////////////////////////////////////////////// | 1353 //////////////////////////////////////////////////////////////////////////////// |
1354 // WebContentsViewAura, OverscrollControllerDelegate implementation: | 1354 // WebContentsViewAura, OverscrollControllerDelegate implementation: |
1355 | 1355 |
| 1356 gfx::Rect WebContentsViewAura::GetVisibleBounds() const { |
| 1357 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
| 1358 if (!rwhv || !rwhv->IsShowing()) |
| 1359 return gfx::Rect(); |
| 1360 |
| 1361 return rwhv->GetViewBounds(); |
| 1362 } |
| 1363 |
1356 void WebContentsViewAura::OnOverscrollUpdate(float delta_x, float delta_y) { | 1364 void WebContentsViewAura::OnOverscrollUpdate(float delta_x, float delta_y) { |
1357 if (current_overscroll_gesture_ == OVERSCROLL_NONE) | 1365 if (current_overscroll_gesture_ == OVERSCROLL_NONE) |
1358 return; | 1366 return; |
1359 | 1367 |
1360 aura::Window* target = GetWindowToAnimateForOverscroll(); | 1368 aura::Window* target = GetWindowToAnimateForOverscroll(); |
1361 ui::ScopedLayerAnimationSettings settings(target->layer()->GetAnimator()); | 1369 ui::ScopedLayerAnimationSettings settings(target->layer()->GetAnimator()); |
1362 settings.SetPreemptionStrategy(ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET); | 1370 settings.SetPreemptionStrategy(ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET); |
1363 gfx::Vector2d translate = GetTranslationForOverscroll(delta_x, delta_y); | 1371 gfx::Vector2d translate = GetTranslationForOverscroll(delta_x, delta_y); |
1364 gfx::Transform transform; | 1372 gfx::Transform transform; |
1365 | 1373 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 event.location(), | 1645 event.location(), |
1638 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1646 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1639 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1647 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1640 if (drag_dest_delegate_) | 1648 if (drag_dest_delegate_) |
1641 drag_dest_delegate_->OnDrop(); | 1649 drag_dest_delegate_->OnDrop(); |
1642 current_drop_data_.reset(); | 1650 current_drop_data_.reset(); |
1643 return current_drag_op_; | 1651 return current_drag_op_; |
1644 } | 1652 } |
1645 | 1653 |
1646 } // namespace content | 1654 } // namespace content |
OLD | NEW |