| 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_SESSIONS_REVISIT_BOOKMARKS_PAGE_REVISIT_OBSERVER_H_ | 5 #ifndef COMPONENTS_SYNC_SESSIONS_REVISIT_BOOKMARKS_PAGE_REVISIT_OBSERVER_H_ |
| 6 #define COMPONENTS_SYNC_SESSIONS_REVISIT_BOOKMARKS_PAGE_REVISIT_OBSERVER_H_ | 6 #define COMPONENTS_SYNC_SESSIONS_REVISIT_BOOKMARKS_PAGE_REVISIT_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 virtual ~BookmarksByUrlProvider() {} | 30 virtual ~BookmarksByUrlProvider() {} |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 // Responds to OnPageVisit events by looking for bookmarks with matching URLs, | 33 // Responds to OnPageVisit events by looking for bookmarks with matching URLs, |
| 34 // and emits metrics about the results. If multiple bookmarks match, the most | 34 // and emits metrics about the results. If multiple bookmarks match, the most |
| 35 // recently created one is used. Currently there isn't enough information to | 35 // recently created one is used. Currently there isn't enough information to |
| 36 // determine modificatoin times or remote vs local. This observer does all | 36 // determine modificatoin times or remote vs local. This observer does all |
| 37 // processing in task/thread, which is okay since it only accesses values in | 37 // processing in task/thread, which is okay since it only accesses values in |
| 38 // memory. Potential slow downs could occur when it fails to get bookmarks lock | 38 // memory. Potential slow downs could occur when it fails to get bookmarks lock |
| 39 // and when the number of matching Bookmarks for a single URL is very large. | 39 // and when the number of matching Bookmarks for a single URL is very large. |
| 40 class BookmarksPageRevisitObserver : public sync_sessions::PageVisitObserver { | 40 class BookmarksPageRevisitObserver : public PageVisitObserver { |
| 41 public: | 41 public: |
| 42 explicit BookmarksPageRevisitObserver( | 42 explicit BookmarksPageRevisitObserver( |
| 43 std::unique_ptr<BookmarksByUrlProvider> provider); | 43 std::unique_ptr<BookmarksByUrlProvider> provider); |
| 44 ~BookmarksPageRevisitObserver() override; | 44 ~BookmarksPageRevisitObserver() override; |
| 45 void OnPageVisit(const GURL& url, const TransitionType transition) override; | 45 void OnPageVisit(const GURL& url, const TransitionType transition) override; |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 std::unique_ptr<BookmarksByUrlProvider> provider_; | 48 std::unique_ptr<BookmarksByUrlProvider> provider_; |
| 49 DISALLOW_COPY_AND_ASSIGN(BookmarksPageRevisitObserver); | 49 DISALLOW_COPY_AND_ASSIGN(BookmarksPageRevisitObserver); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } // namespace sync_sessions | 52 } // namespace sync_sessions |
| 53 | 53 |
| 54 #endif // COMPONENTS_SYNC_SESSIONS_REVISIT_BOOKMARKS_PAGE_REVISIT_OBSERVER_H_ | 54 #endif // COMPONENTS_SYNC_SESSIONS_REVISIT_BOOKMARKS_PAGE_REVISIT_OBSERVER_H_ |
| OLD | NEW |