Index: chrome/browser/chromeos/arc/page_transition_util.cc |
diff --git a/chrome/browser/chromeos/arc/page_transition_util.cc b/chrome/browser/chromeos/arc/page_transition_util.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..79f6385feafc666d4cd469123c43c439d2069b7f |
--- /dev/null |
+++ b/chrome/browser/chromeos/arc/page_transition_util.cc |
@@ -0,0 +1,32 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/chromeos/arc/page_transition_util.h" |
+ |
+namespace arc { |
+ |
+bool ShouldIgnoreNavigation(ui::PageTransition page_transition) { |
+ // Mask out any redirect qualifiers - this method handles navigation from |
+ // redirect and non-redirect navigations equivalently. |
+ page_transition = ui::PageTransitionFromInt( |
+ page_transition & ~ui::PAGE_TRANSITION_IS_REDIRECT_MASK); |
+ |
+ if (!ui::PageTransitionCoreTypeIs(page_transition, |
+ ui::PAGE_TRANSITION_LINK)) { |
+ // Do not handle the |url| if this event wasn't spawned by the user clicking |
+ // on a link. |
+ return true; |
+ } |
+ |
+ if (ui::PageTransitionGetQualifier(page_transition) != 0) { |
+ // Qualifiers indicate that this navigation was the result of a click on a |
+ // forward/back button, or typing in the URL bar, etc. Don't handle any of |
+ // those types of navigations. |
+ return true; |
+ } |
+ |
+ return false; |
+} |
+ |
+} // namespace arc |