summaryrefslogtreecommitdiff
path: root/chromium/content/browser/indexed_db/indexed_db_internals_ui.h
blob: 90467deecb3cbb30c5506a264c1f10e5d91b9c0e (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright (c) 2013 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 CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_INTERNALS_UI_H_
#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_INTERNALS_UI_H_

#include <stddef.h>

#include <vector>

#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/download_interrupt_reasons.h"
#include "content/public/browser/indexed_db_context.h"
#include "content/public/browser/web_ui_controller.h"

namespace base {
class ListValue;
}

namespace content {

class DownloadItem;
class IndexedDBContextImpl;
class StoragePartition;

// The implementation for the chrome://indexeddb-internals page.
class IndexedDBInternalsUI : public WebUIController {
 public:
  explicit IndexedDBInternalsUI(WebUI* web_ui);
  ~IndexedDBInternalsUI() override;

 private:
  void GetAllOrigins(const base::ListValue* args);
  void GetAllOriginsOnIndexedDBThread(scoped_refptr<IndexedDBContext> context,
                                      const base::FilePath& context_path);
  void OnOriginsReady(scoped_ptr<base::ListValue> origins,
                      const base::FilePath& path);

  void AddContextFromStoragePartition(StoragePartition* partition);

  void DownloadOriginData(const base::ListValue* args);
  void DownloadOriginDataOnIndexedDBThread(
      const base::FilePath& partition_path,
      const scoped_refptr<IndexedDBContextImpl> context,
      const GURL& origin_url);
  void OnDownloadDataReady(const base::FilePath& partition_path,
                           const GURL& origin_url,
                           const base::FilePath temp_path,
                           const base::FilePath zip_path,
                           size_t connection_count);
  void OnDownloadStarted(const base::FilePath& partition_path,
                         const GURL& origin_url,
                         const base::FilePath& temp_path,
                         size_t connection_count,
                         DownloadItem* item,
                         DownloadInterruptReason interrupt_reason);

  void ForceCloseOrigin(const base::ListValue* args);
  void ForceCloseOriginOnIndexedDBThread(
      const base::FilePath& partition_path,
      const scoped_refptr<IndexedDBContextImpl> context,
      const GURL& origin_url);
  void OnForcedClose(const base::FilePath& partition_path,
                     const GURL& origin_url,
                     size_t connection_count);
  bool GetOriginContext(const base::FilePath& path,
                        const GURL& origin_url,
                        scoped_refptr<IndexedDBContextImpl>* context);
  bool GetOriginData(const base::ListValue* args,
                     base::FilePath* path,
                     GURL* origin_url,
                     scoped_refptr<IndexedDBContextImpl>* context);

  DISALLOW_COPY_AND_ASSIGN(IndexedDBInternalsUI);
};

}  // namespace content

#endif  // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_INTERNALS_UI_H_