summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/app_notification_storage.h
blob: 2ca1e54895604d33accc14dc338c4c7f5c8a4b2e (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
39
40
41
42
43
// Copyright (c) 2011 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 CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_STORAGE_H__
#define CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_STORAGE_H__
#pragma once

#include <set>

#include "chrome/browser/extensions/app_notification.h"

class FilePath;

// Represents storage for app notifications for a particular extension id.
//
// IMPORTANT NOTE: Instances of this class should only be used on the FILE
// thread.
class AppNotificationStorage {
 public:
  // Must be called on the FILE thread. The storage will be created at |path|.
  static AppNotificationStorage* Create(const FilePath& path);

  virtual ~AppNotificationStorage();

  // Get the set of extension id's that have entries, putting them into
  // |result|.
  virtual bool GetExtensionIds(std::set<std::string>* result) = 0;

  // Gets the list of stored notifications for extension_id. On success, writes
  // results into |result|. On error, returns false.
  virtual bool Get(const std::string& extension_id,
                   AppNotificationList* result) = 0;

  // Writes the |list| for |extension_id| into storage.
  virtual bool Set(const std::string& extension_id,
                   const AppNotificationList& list) = 0;

  // Deletes all data for |extension_id|.
  virtual bool Delete(const std::string& extension_id) = 0;
};

#endif  // CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_STORAGE_H__