OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_SYNC_DRIVER_CURRENT_TAB_MATCHER_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_CURRENT_TAB_MATCHER_H_ |
6 #define COMPONENTS_SYNC_DRIVER_CURRENT_TAB_MATCHER_H_ | 6 #define COMPONENTS_SYNC_DRIVER_CURRENT_TAB_MATCHER_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "components/sessions/session_types.h" | 9 #include "components/sessions/core/session_types.h" |
10 #include "components/sync_driver/revisit/page_equality.h" | 10 #include "components/sync_driver/revisit/page_equality.h" |
11 #include "components/sync_driver/revisit/page_visit_observer.h" | 11 #include "components/sync_driver/revisit/page_visit_observer.h" |
12 | 12 |
13 namespace sync_driver { | 13 namespace sync_driver { |
14 | 14 |
15 // This class checks the current navigation entry for the given tabs to see if | 15 // This class checks the current navigation entry for the given tabs to see if |
16 // they correspond to the same page we were constructed to look for. Upon | 16 // they correspond to the same page we were constructed to look for. Upon |
17 // finding multiple matches, the most recently modified will be chosen. | 17 // finding multiple matches, the most recently modified will be chosen. |
18 class CurrentTabMatcher { | 18 class CurrentTabMatcher { |
19 public: | 19 public: |
20 explicit CurrentTabMatcher(const PageEquality& page_equality); | 20 explicit CurrentTabMatcher(const PageEquality& page_equality); |
21 void Check(const sessions::SessionTab* tab); | 21 void Check(const sessions::SessionTab* tab); |
22 void Emit(const PageVisitObserver::TransitionType transition); | 22 void Emit(const PageVisitObserver::TransitionType transition); |
23 | 23 |
24 private: | 24 private: |
25 FRIEND_TEST_ALL_PREFIXES(CurrentTabMatcherTest, Timestamp); | 25 FRIEND_TEST_ALL_PREFIXES(CurrentTabMatcherTest, Timestamp); |
26 | 26 |
27 const PageEquality page_equality_; | 27 const PageEquality page_equality_; |
28 const sessions::SessionTab* most_recent_match_ = nullptr; | 28 const sessions::SessionTab* most_recent_match_ = nullptr; |
29 | 29 |
30 DISALLOW_COPY_AND_ASSIGN(CurrentTabMatcher); | 30 DISALLOW_COPY_AND_ASSIGN(CurrentTabMatcher); |
31 }; | 31 }; |
32 | 32 |
33 } // namespace sync_driver | 33 } // namespace sync_driver |
34 | 34 |
35 #endif // COMPONENTS_SYNC_DRIVER_CURRENT_TAB_MATCHER_H_ | 35 #endif // COMPONENTS_SYNC_DRIVER_CURRENT_TAB_MATCHER_H_ |
OLD | NEW |