OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_HISTORY_CORE_BROWSER_HISTORY_SERVICE_OBSERVER_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_OBSERVER_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_OBSERVER_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_OBSERVER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/history/core/browser/history_types.h" | 9 #include "components/history/core/browser/history_types.h" |
10 | 10 |
11 class HistoryService; | 11 class HistoryService; |
12 | 12 |
13 namespace history { | 13 namespace history { |
14 | 14 |
15 class HistoryServiceObserver { | 15 class HistoryServiceObserver { |
16 public: | 16 public: |
17 HistoryServiceObserver() {} | 17 HistoryServiceObserver() {} |
18 virtual ~HistoryServiceObserver() {} | 18 virtual ~HistoryServiceObserver() {} |
19 | 19 |
| 20 // Called when user visits an URL. |
| 21 // |
| 22 // The |row| ID will be set to the value that is currently in effect in the |
| 23 // main history database. |redirects| is the list of redirects leading up to |
| 24 // the URL. If we have a redirect chain A -> B -> C and user is visiting C, |
| 25 // then |redirects[0]=B| and |redirects[1]=A|. If there are no redirects, |
| 26 // |redirects| is an empty vector. |
| 27 virtual void OnURLVisited(HistoryService* history_service, |
| 28 ui::PageTransition transition, |
| 29 const URLRow& row, |
| 30 const RedirectList& redirects, |
| 31 base::Time visit_time) {} |
| 32 |
20 // Called on changes to the VisitDatabase. | 33 // Called on changes to the VisitDatabase. |
21 virtual void OnAddVisit(HistoryService* history_service, | 34 virtual void OnAddVisit(HistoryService* history_service, |
22 const BriefVisitInfo& info) {} | 35 const BriefVisitInfo& info) {} |
23 | 36 |
24 private: | 37 private: |
25 DISALLOW_COPY_AND_ASSIGN(HistoryServiceObserver); | 38 DISALLOW_COPY_AND_ASSIGN(HistoryServiceObserver); |
26 }; | 39 }; |
27 | 40 |
28 } // namespace history | 41 } // namespace history |
29 | 42 |
30 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_OBSERVER_H_ | 43 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_OBSERVER_H_ |
OLD | NEW |