| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/arc/intent_helper/page_transition_util.h" | 5 #include "components/arc/intent_helper/page_transition_util.h" |
| 6 | 6 |
| 7 namespace arc { | 7 namespace arc { |
| 8 | 8 |
| 9 namespace { | |
| 10 | |
| 11 ui::PageTransition MaskOutPageTransition(ui::PageTransition page_transition, | |
| 12 ui::PageTransition mask) { | |
| 13 return ui::PageTransitionFromInt(page_transition & ~mask); | |
| 14 } | |
| 15 | |
| 16 } // namespace | |
| 17 | |
| 18 bool ShouldIgnoreNavigation(ui::PageTransition page_transition, | 9 bool ShouldIgnoreNavigation(ui::PageTransition page_transition, |
| 19 bool allow_form_submit, | 10 bool allow_form_submit, |
| 20 bool allow_client_redirect) { | 11 bool allow_client_redirect) { |
| 21 // |allow_client_redirect| is true only for non-http(s) cases, and for those | 12 // |allow_client_redirect| is true only for non-http(s) cases, and for those |
| 22 // we can ignore the CLIENT/SERVER REDIRECT flags, otherwise mask out the | 13 // we can ignore the CLIENT/SERVER REDIRECT flags, otherwise mask out the |
| 23 // SERVER_REDIRECT flag only. | 14 // SERVER_REDIRECT flag only. |
| 24 page_transition = MaskOutPageTransition( | 15 page_transition = MaskOutPageTransition( |
| 25 page_transition, allow_client_redirect | 16 page_transition, allow_client_redirect |
| 26 ? ui::PAGE_TRANSITION_IS_REDIRECT_MASK | 17 ? ui::PAGE_TRANSITION_IS_REDIRECT_MASK |
| 27 : ui::PAGE_TRANSITION_SERVER_REDIRECT); | 18 : ui::PAGE_TRANSITION_SERVER_REDIRECT); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 if (ui::PageTransitionGetQualifier(page_transition) != 0) { | 30 if (ui::PageTransitionGetQualifier(page_transition) != 0) { |
| 40 // Qualifiers indicate that this navigation was the result of a click on a | 31 // Qualifiers indicate that this navigation was the result of a click on a |
| 41 // forward/back button, or typing in the URL bar. Don't handle any of those | 32 // forward/back button, or typing in the URL bar. Don't handle any of those |
| 42 // types of navigations. | 33 // types of navigations. |
| 43 return true; | 34 return true; |
| 44 } | 35 } |
| 45 | 36 |
| 46 return false; | 37 return false; |
| 47 } | 38 } |
| 48 | 39 |
| 49 ui::PageTransition MaskOutPageTransitionForTesting( | 40 ui::PageTransition MaskOutPageTransition(ui::PageTransition page_transition, |
| 50 ui::PageTransition page_transition, | 41 ui::PageTransition mask) { |
| 51 ui::PageTransition mask) { | 42 return ui::PageTransitionFromInt(page_transition & ~mask); |
| 52 return MaskOutPageTransition(page_transition, mask); | |
| 53 } | 43 } |
| 54 | 44 |
| 55 } // namespace arc | 45 } // namespace arc |
| OLD | NEW |