1// Copyright (c) 2010 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// VisitedLinkEventListener broadcasts link coloring database updates to all
6// processes. It also coalesces the updates to avoid excessive broadcasting of
7// messages to the renderers.
8
9#ifndef CHROME_BROWSER_VISITEDLINK_VISITEDLINK_EVENT_LISTENER_H_
10#define CHROME_BROWSER_VISITEDLINK_VISITEDLINK_EVENT_LISTENER_H_
11#pragma once
12
13#include "base/timer.h"
14#include "chrome/browser/visitedlink/visitedlink_master.h"
15
16namespace base {
17class SharedMemory;
18}
19
20class VisitedLinkEventListener : public VisitedLinkMaster::Listener {
21 public:
22  VisitedLinkEventListener();
23  virtual ~VisitedLinkEventListener();
24
25  virtual void NewTable(base::SharedMemory* table_memory);
26  virtual void Add(VisitedLinkMaster::Fingerprint fingerprint);
27  virtual void Reset();
28
29 private:
30  void CommitVisitedLinks();
31
32  base::OneShotTimer<VisitedLinkEventListener> coalesce_timer_;
33  VisitedLinkCommon::Fingerprints pending_visited_links_;
34
35  DISALLOW_COPY_AND_ASSIGN(VisitedLinkEventListener);
36};
37
38#endif  // CHROME_BROWSER_VISITEDLINK_VISITEDLINK_EVENT_LISTENER_H_
39