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

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: Updated for Stan's comments. 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
« no previous file with comments | « components/sync_sessions/DEPS ('k') | components/sync_sessions/revisit/typed_url_page_revisit_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..972a67098c3c7601ec480bed11d8a63ca892916e
--- /dev/null
+++ b/components/sync_sessions/revisit/typed_url_page_revisit_observer.h
@@ -0,0 +1,41 @@
+// 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 {
+
+// 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 uses a weak pointer to the HistoryService.
+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_
« no previous file with comments | « components/sync_sessions/DEPS ('k') | components/sync_sessions/revisit/typed_url_page_revisit_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698