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 CHROME_BROWSER_SYNC_SESSIONS_PAGE_REVISIT_BROADCASTER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SESSIONS_PAGE_REVISIT_BROADCASTER_H_ |
6 #define CHROME_BROWSER_SYNC_SESSIONS_PAGE_REVISIT_BROADCASTER_H_ | 6 #define CHROME_BROWSER_SYNC_SESSIONS_PAGE_REVISIT_BROADCASTER_H_ |
7 | 7 |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "components/sync_driver/revisit/page_visit_observer.h" | 9 #include "components/sync_sessions/revisit/page_visit_observer.h" |
10 #include "ui/base/page_transition_types.h" | 10 #include "ui/base/page_transition_types.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 class Profile; | 13 class Profile; |
14 class PrefService; | 14 class PrefService; |
15 | 15 |
16 namespace browser_sync { | 16 namespace browser_sync { |
17 | 17 |
18 class SessionsSyncManager; | 18 class SessionsSyncManager; |
19 | 19 |
20 // This class has the job of creating and holding onto the PageVisitObservers | 20 // This class has the job of creating and holding onto the PageVisitObservers |
21 // that are to be notified on page change for purposes of instrumenting | 21 // that are to be notified on page change for purposes of instrumenting |
22 // revisists. | 22 // revisists. |
23 class PageRevisitBroadcaster { | 23 class PageRevisitBroadcaster { |
24 public: | 24 public: |
25 PageRevisitBroadcaster(SessionsSyncManager* manager, Profile* profile); | 25 PageRevisitBroadcaster(SessionsSyncManager* manager, Profile* profile); |
26 ~PageRevisitBroadcaster(); | 26 ~PageRevisitBroadcaster(); |
27 | 27 |
28 // Broadcasts to all observers the given page visit event. Should only be | 28 // Broadcasts to all observers the given page visit event. Should only be |
29 // called when the url changes. | 29 // called when the url changes. |
30 void OnPageVisit(const GURL& url, const ui::PageTransition transition); | 30 void OnPageVisit(const GURL& url, const ui::PageTransition transition); |
31 | 31 |
32 private: | 32 private: |
33 friend class PageRevisitBroadcasterTest; | 33 friend class PageRevisitBroadcasterTest; |
34 | 34 |
35 // We convert between enums here for a couple reasons. We don't want to force | 35 // We convert between enums here for a couple reasons. We don't want to force |
36 // observers to depend on ui/, and the high bit masks don't work for emitting | 36 // observers to depend on ui/, and the high bit masks don't work for emitting |
37 // histograms. Some of the high bit masks correspond to cases we're | 37 // histograms. Some of the high bit masks correspond to cases we're |
38 // particularly interested in and want to treat as first class values. | 38 // particularly interested in and want to treat as first class values. |
39 static sync_driver::PageVisitObserver::TransitionType ConvertTransitionEnum( | 39 static sync_sessions::PageVisitObserver::TransitionType ConvertTransitionEnum( |
40 const ui::PageTransition original); | 40 const ui::PageTransition original); |
41 | 41 |
42 ScopedVector<sync_driver::PageVisitObserver> revisit_observers_; | 42 ScopedVector<sync_sessions::PageVisitObserver> revisit_observers_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(PageRevisitBroadcaster); | 44 DISALLOW_COPY_AND_ASSIGN(PageRevisitBroadcaster); |
45 }; | 45 }; |
46 | 46 |
47 } // namespace browser_sync | 47 } // namespace browser_sync |
48 | 48 |
49 #endif // CHROME_BROWSER_SYNC_SESSIONS_PAGE_REVISIT_BROADCASTER_H_ | 49 #endif // CHROME_BROWSER_SYNC_SESSIONS_PAGE_REVISIT_BROADCASTER_H_ |
OLD | NEW |