Index: content/browser/web_contents/aura/overscroll_navigation_overlay.cc |
diff --git a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc |
index 9ed29e924339b8032ffaa67209c409ae64296dca..a262af4c3aa7777fb32d1de307752898064ca2bb 100644 |
--- a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc |
+++ b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc |
@@ -14,7 +14,6 @@ |
#include "content/browser/frame_host/navigation_entry_impl.h" |
#include "content/browser/renderer_host/render_view_host_impl.h" |
#include "content/browser/web_contents/aura/overscroll_window_delegate.h" |
-#include "content/browser/web_contents/aura/uma_navigation_type.h" |
#include "content/browser/web_contents/web_contents_impl.h" |
#include "content/common/view_messages.h" |
#include "content/public/browser/browser_thread.h" |
@@ -48,29 +47,13 @@ bool DoesEntryMatchURL(NavigationEntry* entry, const GURL& url) { |
return false; |
} |
-UmaNavigationType GetUmaNavigationType( |
- OverscrollNavigationOverlay::NavigationDirection direction, |
- OverscrollSource source) { |
- if (direction == OverscrollNavigationOverlay::NONE || |
- source == OverscrollSource::NONE) |
- return NAVIGATION_TYPE_NONE; |
- if (direction == OverscrollNavigationOverlay::BACK) |
- return source == OverscrollSource::TOUCHPAD |
- ? UmaNavigationType::BACK_TOUCHPAD |
- : UmaNavigationType::BACK_TOUCHSCREEN; |
- DCHECK_EQ(direction, OverscrollNavigationOverlay::FORWARD); |
- return source == OverscrollSource::TOUCHPAD |
- ? UmaNavigationType::FORWARD_TOUCHPAD |
- : UmaNavigationType::FORWARD_TOUCHSCREEN; |
-} |
- |
// Records UMA historgram and also user action for the cancelled overscroll. |
-void RecordCancelled(OverscrollNavigationOverlay::NavigationDirection direction, |
+void RecordCancelled(NavigationDirection direction, |
OverscrollSource source) { |
UMA_HISTOGRAM_ENUMERATION("Overscroll.Cancelled3", |
GetUmaNavigationType(direction, source), |
NAVIGATION_TYPE_COUNT); |
- if (direction == OverscrollNavigationOverlay::BACK) |
+ if (direction == NavigationDirection::BACK) |
RecordAction(base::UserMetricsAction("Overscroll_Cancelled.Back")); |
else |
RecordAction(base::UserMetricsAction("Overscroll_Cancelled.Forward")); |
@@ -123,7 +106,7 @@ class OverlayDismissAnimator |
OverscrollNavigationOverlay::OverscrollNavigationOverlay( |
WebContentsImpl* web_contents, |
aura::Window* web_contents_window) |
- : direction_(NONE), |
+ : direction_(NavigationDirection::NONE), |
web_contents_(web_contents), |
loading_complete_(false), |
received_paint_update_(false), |
@@ -187,7 +170,7 @@ std::unique_ptr<aura::Window> OverscrollNavigationOverlay::CreateOverlayWindow( |
window->SetName("OverscrollOverlay"); |
web_contents_window_->AddChild(window.get()); |
aura::Window* event_window = GetMainWindow(); |
- if (direction_ == FORWARD) |
+ if (direction_ == NavigationDirection::FORWARD) |
web_contents_window_->StackChildAbove(window.get(), event_window); |
else |
web_contents_window_->StackChildBelow(window.get(), event_window); |
@@ -204,7 +187,8 @@ const gfx::Image OverscrollNavigationOverlay::GetImageForDirection( |
NavigationDirection direction) const { |
const NavigationControllerImpl& controller = web_contents_->GetController(); |
const NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
- controller.GetEntryAtOffset(direction == FORWARD ? 1 : -1)); |
+ controller.GetEntryAtOffset( |
+ direction == NavigationDirection::FORWARD ? 1 : -1)); |
if (entry && entry->screenshot().get()) { |
std::vector<gfx::ImagePNGRep> image_reps; |
@@ -218,7 +202,7 @@ std::unique_ptr<aura::Window> OverscrollNavigationOverlay::CreateFrontWindow( |
const gfx::Rect& bounds) { |
if (!web_contents_->GetController().CanGoForward()) |
return nullptr; |
- direction_ = FORWARD; |
+ direction_ = NavigationDirection::FORWARD; |
return CreateOverlayWindow(bounds); |
} |
@@ -226,7 +210,7 @@ std::unique_ptr<aura::Window> OverscrollNavigationOverlay::CreateBackWindow( |
const gfx::Rect& bounds) { |
if (!web_contents_->GetController().CanGoBack()) |
return nullptr; |
- direction_ = BACK; |
+ direction_ = NavigationDirection::BACK; |
return CreateOverlayWindow(bounds); |
} |
@@ -247,7 +231,7 @@ void OverscrollNavigationOverlay::OnOverscrollCompleting() { |
void OverscrollNavigationOverlay::OnOverscrollCompleted( |
std::unique_ptr<aura::Window> window) { |
- DCHECK(direction_ != NONE); |
+ DCHECK(direction_ != NavigationDirection::NONE); |
mohsen
2017/07/20 18:00:41
DCHECK_NE()?
mfomitchev
2017/07/21 00:10:07
Done.
|
aura::Window* main_window = GetMainWindow(); |
if (!main_window) { |
RecordCancelled(direction_, owa_->overscroll_source()); |
@@ -266,10 +250,12 @@ void OverscrollNavigationOverlay::OnOverscrollCompleted( |
// during an overscroll gesture and navigating without history produces a |
// crash. |
bool navigated = false; |
- if (direction_ == FORWARD && web_contents_->GetController().CanGoForward()) { |
+ if (direction_ == NavigationDirection::FORWARD && |
+ web_contents_->GetController().CanGoForward()) { |
web_contents_->GetController().GoForward(); |
navigated = true; |
- } else if (direction_ == BACK && web_contents_->GetController().CanGoBack()) { |
+ } else if (direction_ == NavigationDirection::BACK && |
+ web_contents_->GetController().CanGoBack()) { |
web_contents_->GetController().GoBack(); |
navigated = true; |
} else { |
@@ -284,14 +270,14 @@ void OverscrollNavigationOverlay::OnOverscrollCompleted( |
"Overscroll.Navigated3", |
GetUmaNavigationType(direction_, owa_->overscroll_source()), |
NAVIGATION_TYPE_COUNT); |
- if (direction_ == BACK) |
+ if (direction_ == NavigationDirection::BACK) |
RecordAction(base::UserMetricsAction("Overscroll_Navigated.Back")); |
else |
RecordAction(base::UserMetricsAction("Overscroll_Navigated.Forward")); |
StartObserving(); |
} |
- direction_ = NONE; |
+ direction_ = NavigationDirection::NONE; |
StopObservingIfDone(); |
} |
@@ -301,7 +287,7 @@ void OverscrollNavigationOverlay::OnOverscrollCancelled() { |
if (!main_window) |
return; |
main_window->ReleaseCapture(); |
- direction_ = NONE; |
+ direction_ = NavigationDirection::NONE; |
StopObservingIfDone(); |
} |