blob: 9a5fdef91fdc59144f485c1183ca62677ac472a1 [file] [log] [blame]
// Copyright (c) 2012 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.
#pragma once
#include <map>
#include <string>
#include "base/basictypes.h"
namespace browser_sync {
// An interface to monitor usage of extensions APIs to send to sync
// servers, with the ability to purge data once sync servers have
// acknowledged it (successful commit response).
// All abstract methods are called from the sync thread.
class ExtensionsActivityMonitor {
// A data record of activity performed by extension |extension_id|.
struct Record {
// The human-readable ID identifying the extension responsible
// for the activity reported in this Record.
std::string extension_id;
// How many times the extension successfully invoked a write
// operation through the bookmarks API since the last CommitMessage.
uint32 bookmark_write_count;
typedef std::map<std::string, Record> Records;
// Fill |buffer| with all current records and then clear the
// internal records.
virtual void GetAndClearRecords(Records* buffer) = 0;
// Merge |records| with the current set of records, adding the
// bookmark write counts for common Records.
virtual void PutRecords(const Records& records) = 0;
virtual ~ExtensionsActivityMonitor();
} // namespace browser_sync