OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_SYNC_DRIVER_CURRENT_TAB_MATCHER_H_ | |
6 #define COMPONENTS_SYNC_DRIVER_CURRENT_TAB_MATCHER_H_ | |
7 | |
8 #include "base/gtest_prod_util.h" | |
9 #include "components/sessions/core/session_types.h" | |
10 #include "components/sync_driver/revisit/page_equality.h" | |
11 #include "components/sync_driver/revisit/page_visit_observer.h" | |
12 | |
13 namespace sync_driver { | |
14 | |
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 | |
17 // finding multiple matches, the most recently modified will be chosen. | |
18 class CurrentTabMatcher { | |
19 public: | |
20 explicit CurrentTabMatcher(const PageEquality& page_equality); | |
21 void Check(const sessions::SessionTab* tab); | |
22 void Emit(const PageVisitObserver::TransitionType transition); | |
23 | |
24 private: | |
25 FRIEND_TEST_ALL_PREFIXES(CurrentTabMatcherTest, Timestamp); | |
26 | |
27 const PageEquality page_equality_; | |
28 const sessions::SessionTab* most_recent_match_ = nullptr; | |
29 | |
30 DISALLOW_COPY_AND_ASSIGN(CurrentTabMatcher); | |
31 }; | |
32 | |
33 } // namespace sync_driver | |
34 | |
35 #endif // COMPONENTS_SYNC_DRIVER_CURRENT_TAB_MATCHER_H_ | |
OLD | NEW |