| OLD | NEW |
| 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 "content/browser/web_contents/aura/overscroll_navigation_overlay.h" | 5 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 : UmaNavigationType::FORWARD_TOUCHSCREEN; | 64 : UmaNavigationType::FORWARD_TOUCHSCREEN; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Records UMA historgram and also user action for the cancelled overscroll. | 67 // Records UMA historgram and also user action for the cancelled overscroll. |
| 68 void RecordCancelled(OverscrollNavigationOverlay::NavigationDirection direction, | 68 void RecordCancelled(OverscrollNavigationOverlay::NavigationDirection direction, |
| 69 OverscrollSource source) { | 69 OverscrollSource source) { |
| 70 UMA_HISTOGRAM_ENUMERATION("Overscroll.Cancelled3", | 70 UMA_HISTOGRAM_ENUMERATION("Overscroll.Cancelled3", |
| 71 GetUmaNavigationType(direction, source), | 71 GetUmaNavigationType(direction, source), |
| 72 NAVIGATION_TYPE_COUNT); | 72 NAVIGATION_TYPE_COUNT); |
| 73 if (direction == OverscrollNavigationOverlay::BACK) | 73 if (direction == OverscrollNavigationOverlay::BACK) |
| 74 RecordAction(base::UserMetricsAction("Overscroll_Cancelled.Back")); | 74 base::RecordAction(base::UserMetricsAction("Overscroll_Cancelled.Back")); |
| 75 else | 75 else |
| 76 RecordAction(base::UserMetricsAction("Overscroll_Cancelled.Forward")); | 76 base::RecordAction(base::UserMetricsAction("Overscroll_Cancelled.Forward")); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace | 79 } // namespace |
| 80 | 80 |
| 81 // Responsible for fading out and deleting the layer of the overlay window. | 81 // Responsible for fading out and deleting the layer of the overlay window. |
| 82 class OverlayDismissAnimator | 82 class OverlayDismissAnimator |
| 83 : public ui::LayerAnimationObserver { | 83 : public ui::LayerAnimationObserver { |
| 84 public: | 84 public: |
| 85 // Takes ownership of the layer. | 85 // Takes ownership of the layer. |
| 86 explicit OverlayDismissAnimator(std::unique_ptr<ui::Layer> layer) | 86 explicit OverlayDismissAnimator(std::unique_ptr<ui::Layer> layer) |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 RecordCancelled(direction_, owa_->overscroll_source()); | 278 RecordCancelled(direction_, owa_->overscroll_source()); |
| 279 loading_complete_ = true; | 279 loading_complete_ = true; |
| 280 } | 280 } |
| 281 | 281 |
| 282 if (navigated) { | 282 if (navigated) { |
| 283 UMA_HISTOGRAM_ENUMERATION( | 283 UMA_HISTOGRAM_ENUMERATION( |
| 284 "Overscroll.Navigated3", | 284 "Overscroll.Navigated3", |
| 285 GetUmaNavigationType(direction_, owa_->overscroll_source()), | 285 GetUmaNavigationType(direction_, owa_->overscroll_source()), |
| 286 NAVIGATION_TYPE_COUNT); | 286 NAVIGATION_TYPE_COUNT); |
| 287 if (direction_ == BACK) | 287 if (direction_ == BACK) |
| 288 RecordAction(base::UserMetricsAction("Overscroll_Navigated.Back")); | 288 base::RecordAction(base::UserMetricsAction("Overscroll_Navigated.Back")); |
| 289 else | 289 else |
| 290 RecordAction(base::UserMetricsAction("Overscroll_Navigated.Forward")); | 290 base::RecordAction(base::UserMetricsAction("Overscroll_Navigated.Forward")
); |
| 291 StartObserving(); | 291 StartObserving(); |
| 292 } | 292 } |
| 293 | 293 |
| 294 direction_ = NONE; | 294 direction_ = NONE; |
| 295 StopObservingIfDone(); | 295 StopObservingIfDone(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void OverscrollNavigationOverlay::OnOverscrollCancelled() { | 298 void OverscrollNavigationOverlay::OnOverscrollCancelled() { |
| 299 RecordCancelled(direction_, owa_->overscroll_source()); | 299 RecordCancelled(direction_, owa_->overscroll_source()); |
| 300 aura::Window* main_window = GetMainWindow(); | 300 aura::Window* main_window = GetMainWindow(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 317 | 317 |
| 318 void OverscrollNavigationOverlay::DidStopLoading() { | 318 void OverscrollNavigationOverlay::DidStopLoading() { |
| 319 // Don't compare URLs in this case - it's possible they won't match if | 319 // Don't compare URLs in this case - it's possible they won't match if |
| 320 // a gesture-nav initiated navigation was interrupted by some other in-site | 320 // a gesture-nav initiated navigation was interrupted by some other in-site |
| 321 // navigation (e.g., from a script, or from a bookmark). | 321 // navigation (e.g., from a script, or from a bookmark). |
| 322 loading_complete_ = true; | 322 loading_complete_ = true; |
| 323 StopObservingIfDone(); | 323 StopObservingIfDone(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 } // namespace content | 326 } // namespace content |
| OLD | NEW |