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/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1274 // WebContentsViewAura, OverscrollControllerDelegate implementation: | 1274 // WebContentsViewAura, OverscrollControllerDelegate implementation: |
1275 | 1275 |
1276 gfx::Rect WebContentsViewAura::GetVisibleBounds() const { | 1276 gfx::Rect WebContentsViewAura::GetVisibleBounds() const { |
1277 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); | 1277 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
1278 if (!rwhv || !rwhv->IsShowing()) | 1278 if (!rwhv || !rwhv->IsShowing()) |
1279 return gfx::Rect(); | 1279 return gfx::Rect(); |
1280 | 1280 |
1281 return rwhv->GetViewBounds(); | 1281 return rwhv->GetViewBounds(); |
1282 } | 1282 } |
1283 | 1283 |
1284 void WebContentsViewAura::OnOverscrollUpdate(float delta_x, float delta_y) { | 1284 bool WebContentsViewAura::OnOverscrollUpdate(float delta_x, float delta_y) { |
1285 if (current_overscroll_gesture_ == OVERSCROLL_NONE) | 1285 if (current_overscroll_gesture_ == OVERSCROLL_NONE) |
1286 return; | 1286 return false; |
1287 | 1287 |
1288 aura::Window* target = GetWindowToAnimateForOverscroll(); | 1288 aura::Window* target = GetWindowToAnimateForOverscroll(); |
1289 gfx::Vector2d translate = GetTranslationForOverscroll(delta_x, delta_y); | 1289 gfx::Vector2d translate = GetTranslationForOverscroll(delta_x, delta_y); |
1290 gfx::Transform transform; | 1290 gfx::Transform transform; |
1291 | 1291 |
1292 // Vertical overscrolls don't participate in the navigation gesture. | 1292 // Vertical overscrolls don't participate in the navigation gesture. |
1293 if (current_overscroll_gesture_ != OVERSCROLL_NORTH && | 1293 if (current_overscroll_gesture_ != OVERSCROLL_NORTH && |
1294 current_overscroll_gesture_ != OVERSCROLL_SOUTH) { | 1294 current_overscroll_gesture_ != OVERSCROLL_SOUTH) { |
1295 transform.Translate(translate.x(), translate.y()); | 1295 transform.Translate(translate.x(), translate.y()); |
1296 target->SetTransform(transform); | 1296 target->SetTransform(transform); |
1297 UpdateOverscrollWindowBrightness(delta_x); | 1297 UpdateOverscrollWindowBrightness(delta_x); |
1298 } | 1298 } |
1299 | 1299 |
1300 OverscrollUpdateForWebContentsDelegate(translate.y()); | 1300 OverscrollUpdateForWebContentsDelegate(translate.y()); |
1301 return translate.x() || translate.y(); | |
sadrul
2014/08/18 22:54:09
return !translate.IsZero();
tdresser
2014/08/19 12:51:37
Done.
| |
1301 } | 1302 } |
1302 | 1303 |
1303 void WebContentsViewAura::OnOverscrollComplete(OverscrollMode mode) { | 1304 void WebContentsViewAura::OnOverscrollComplete(OverscrollMode mode) { |
1304 UMA_HISTOGRAM_ENUMERATION("Overscroll.Completed", mode, OVERSCROLL_COUNT); | 1305 UMA_HISTOGRAM_ENUMERATION("Overscroll.Completed", mode, OVERSCROLL_COUNT); |
1305 OverscrollUpdateForWebContentsDelegate(0); | 1306 OverscrollUpdateForWebContentsDelegate(0); |
1306 NavigationControllerImpl& controller = web_contents_->GetController(); | 1307 NavigationControllerImpl& controller = web_contents_->GetController(); |
1307 if (ShouldNavigateForward(controller, mode) || | 1308 if (ShouldNavigateForward(controller, mode) || |
1308 ShouldNavigateBack(controller, mode)) { | 1309 ShouldNavigateBack(controller, mode)) { |
1309 CompleteOverscrollNavigation(mode); | 1310 CompleteOverscrollNavigation(mode); |
1310 return; | 1311 return; |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1617 if (visible) { | 1618 if (visible) { |
1618 if (!web_contents_->should_normally_be_visible()) | 1619 if (!web_contents_->should_normally_be_visible()) |
1619 web_contents_->WasShown(); | 1620 web_contents_->WasShown(); |
1620 } else { | 1621 } else { |
1621 if (web_contents_->should_normally_be_visible()) | 1622 if (web_contents_->should_normally_be_visible()) |
1622 web_contents_->WasHidden(); | 1623 web_contents_->WasHidden(); |
1623 } | 1624 } |
1624 } | 1625 } |
1625 | 1626 |
1626 } // namespace content | 1627 } // namespace content |
OLD | NEW |