ApplicationImpl cleanup, part 1:
[chromium-blink-merge.git] / content / public / browser / indexed_db_context.h
blob136c30c3a25c164b882ad8ff32c84bd38bc34524
1 // Copyright (c) 2012 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.
5 #ifndef CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_
6 #define CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/files/file_path.h"
13 #include "base/memory/ref_counted.h"
14 #include "content/common/content_export.h"
15 #include "content/public/browser/indexed_db_info.h"
17 namespace base {
18 class SequencedTaskRunner;
21 namespace content {
23 // Represents the per-BrowserContext IndexedDB data.
24 // Call these methods only via the exposed TaskRunner.
25 class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> {
26 public:
27 // Only call the below methods by posting to this TaskRunner.
28 virtual base::SequencedTaskRunner* TaskRunner() const = 0;
30 // Methods used in response to QuotaManager requests.
31 virtual std::vector<IndexedDBInfo> GetAllOriginsInfo() = 0;
32 virtual int64 GetOriginDiskUsage(const GURL& origin_url) = 0;
34 // Deletes all indexed db files for the given origin.
35 virtual void DeleteForOrigin(const GURL& origin_url) = 0;
37 // Copies the indexed db files from this context to another. The
38 // indexed db directory in the destination context needs to be empty.
39 virtual void CopyOriginData(const GURL& origin_url,
40 IndexedDBContext* dest_context) = 0;
42 // Get the file name of the local storage file for the given origin.
43 virtual base::FilePath GetFilePathForTesting(
44 const std::string& origin_id) const = 0;
45 // Set the task runner for tests if browser main loop is not initialized.
46 virtual void SetTaskRunnerForTesting(
47 base::SequencedTaskRunner* task_runner) = 0;
49 protected:
50 friend class base::RefCountedThreadSafe<IndexedDBContext>;
51 virtual ~IndexedDBContext() {}
54 } // namespace content
56 #endif // CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_