summaryrefslogtreecommitdiffstats
path: root/chrome/browser/in_process_webkit/indexed_db_context.h
blob: 95f6536e9c15feddadefbb48a6f6550d21cd9e00 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2010 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_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_
#define CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_
#pragma once

#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/scoped_ptr.h"

class FilePath;
class WebKitContext;

namespace WebKit {
class WebIDBFactory;
}

class IndexedDBContext {
 public:
  explicit IndexedDBContext(WebKitContext* webkit_context);
  ~IndexedDBContext();

  WebKit::WebIDBFactory* GetIDBFactory();

  // The indexed db directory.
  static const FilePath::CharType kIndexedDBDirectory[];

  // The indexed db file extension.
  static const FilePath::CharType kIndexedDBExtension[];

  // Get the file name of the indexed db file for the given origin.
  FilePath GetIndexedDBFilePath(const string16& origin_id) const;

  // Deletes all idb files except for those on the url scheme
  // |url_scheme_to_be_skipped|.
  static void ClearLocalState(const FilePath& profile_path,
                              const char* url_scheme_to_be_skipped);

  // Deletes a single indexed db file.
  void DeleteIndexedDBFile(const FilePath& file_path);

  // Deletes all indexed db files for the given origin.
  void DeleteIndexedDBForOrigin(const string16& origin_id);

 private:
  scoped_ptr<WebKit::WebIDBFactory> idb_factory_;

  // We're owned by this WebKit context.
  WebKitContext* webkit_context_;

  DISALLOW_COPY_AND_ASSIGN(IndexedDBContext);
};

#endif  // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_