summaryrefslogtreecommitdiffstats
path: root/chrome/browser/visitedlink_event_listener.h
blob: 00a73920cf8a5c1cff6117515c1c449b182cb278 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2009 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.

// VisitedLinkEventListener broadcasts link coloring database updates to all
// processes. It also coalesces the updates to avoid excessive broadcasting of
// messages to the renderers.

#ifndef CHROME_BROWSER_VISITEDLINK_EVENT_LISTENER_H_
#define CHROME_BROWSER_VISITEDLINK_EVENT_LISTENER_H_
#pragma once

#include "base/timer.h"
#include "chrome/browser/visitedlink_master.h"

namespace base {
class SharedMemory;
}

class VisitedLinkEventListener : public VisitedLinkMaster::Listener {
 public:
  VisitedLinkEventListener();
  virtual ~VisitedLinkEventListener();

  virtual void NewTable(base::SharedMemory* table_memory);
  virtual void Add(VisitedLinkMaster::Fingerprint fingerprint);
  virtual void Reset();

 private:
  void CommitVisitedLinks();

  base::OneShotTimer<VisitedLinkEventListener> coalesce_timer_;
  VisitedLinkCommon::Fingerprints pending_visited_links_;

  DISALLOW_COPY_AND_ASSIGN(VisitedLinkEventListener);
};

#endif  // CHROME_BROWSER_VISITEDLINK_EVENT_LISTENER_H_