Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: components/sync_sessions/revisit/typed_url_page_revisit_observer.h

Issue 1399053004: [Sync] Adding revisit logic for typed URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698