Chromium Code Reviews| Index: components/sync_sessions/revisit/typed_url_page_revisit_observer.h |
| diff --git a/components/sync_sessions/revisit/typed_url_page_revisit_observer.h b/components/sync_sessions/revisit/typed_url_page_revisit_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..da2d7dd1303b1122bebc9399e0197486ef033a4c |
| --- /dev/null |
| +++ b/components/sync_sessions/revisit/typed_url_page_revisit_observer.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_SYNC_SESSIONS_REVISIT_TYPED_URL_PAGE_REVISIT_OBSERVER_H_ |
| +#define COMPONENTS_SYNC_SESSIONS_REVISIT_TYPED_URL_PAGE_REVISIT_OBSERVER_H_ |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/task/cancelable_task_tracker.h" |
| +#include "components/sync_sessions/revisit/page_visit_observer.h" |
| + |
| +class GURL; |
| + |
| +namespace history { |
| +class HistoryService; |
| +} // namespace history |
| + |
| +namespace sync_sessions { |
| + |
| +class HistoryService; |
|
stanisc
2015/10/13 21:53:33
Second forward declaration for HistoryService. See
skym
2015/10/13 22:25:14
Done.
|
| + |
| +// This class's job is to respond to OnPageVisit events and launch a task to |
| +// the history thread to perform the requisite checks and instrumentation. It is |
| +// important that this object is created and called on the same thread, since it |
| +// creates and owns a weak pointer to the HistoryService. |
|
stanisc
2015/10/13 21:53:33
Nit: it is OK to own a weak pointer to another obj
skym
2015/10/13 22:25:14
Done.
|
| +class TypedUrlPageRevisitObserver : public PageVisitObserver { |
| + public: |
| + explicit TypedUrlPageRevisitObserver(history::HistoryService* history); |
| + ~TypedUrlPageRevisitObserver() override; |
| + void OnPageVisit(const GURL& url, |
| + const PageVisitObserver::TransitionType transition) override; |
| + |
| + private: |
| + const base::WeakPtr<history::HistoryService> history_; |
| + // This is never used to cancel tasks, but required by the history interface. |
| + base::CancelableTaskTracker task_tracker_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TypedUrlPageRevisitObserver); |
| +}; |
| + |
| +} // namespace sync_sessions |
| + |
| +#endif // COMPONENTS_SYNC_SESSIONS_REVISIT_TYPED_URL_PAGE_REVISIT_OBSERVER_H_ |