1// Copyright (c) 2013 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. 4 5#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_INTERNALS_UI_H_ 6#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_INTERNALS_UI_H_ 7 8#include <vector> 9 10#include "base/memory/ref_counted.h" 11#include "base/memory/scoped_ptr.h" 12#include "content/public/browser/download_interrupt_reasons.h" 13#include "content/public/browser/indexed_db_context.h" 14#include "content/public/browser/web_ui_controller.h" 15 16namespace base { 17class ListValue; 18} 19 20namespace content { 21 22class DownloadItem; 23class IndexedDBContextImpl; 24class StoragePartition; 25 26// The implementation for the chrome://indexeddb-internals page. 27class IndexedDBInternalsUI : public WebUIController { 28 public: 29 explicit IndexedDBInternalsUI(WebUI* web_ui); 30 virtual ~IndexedDBInternalsUI(); 31 32 private: 33 void GetAllOrigins(const base::ListValue* args); 34 void GetAllOriginsOnIndexedDBThread(scoped_refptr<IndexedDBContext> context, 35 const base::FilePath& context_path); 36 void OnOriginsReady(scoped_ptr<base::ListValue> origins, 37 const base::FilePath& path); 38 39 void AddContextFromStoragePartition(StoragePartition* partition); 40 41 void DownloadOriginData(const base::ListValue* args); 42 void DownloadOriginDataOnIndexedDBThread( 43 const base::FilePath& partition_path, 44 const scoped_refptr<IndexedDBContextImpl> context, 45 const GURL& origin_url); 46 void OnDownloadDataReady(const base::FilePath& partition_path, 47 const GURL& origin_url, 48 const base::FilePath temp_path, 49 const base::FilePath zip_path, 50 size_t connection_count); 51 void OnDownloadStarted(const base::FilePath& partition_path, 52 const GURL& origin_url, 53 const base::FilePath& temp_path, 54 size_t connection_count, 55 DownloadItem* item, 56 DownloadInterruptReason interrupt_reason); 57 58 void ForceCloseOrigin(const base::ListValue* args); 59 void ForceCloseOriginOnIndexedDBThread( 60 const base::FilePath& partition_path, 61 const scoped_refptr<IndexedDBContextImpl> context, 62 const GURL& origin_url); 63 void OnForcedClose(const base::FilePath& partition_path, 64 const GURL& origin_url, 65 size_t connection_count); 66 bool GetOriginContext(const base::FilePath& path, 67 const GURL& origin_url, 68 scoped_refptr<IndexedDBContextImpl>* context); 69 bool GetOriginData(const base::ListValue* args, 70 base::FilePath* path, 71 GURL* origin_url, 72 scoped_refptr<IndexedDBContextImpl>* context); 73 74 DISALLOW_COPY_AND_ASSIGN(IndexedDBInternalsUI); 75}; 76 77} // namespace content 78 79#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_INTERNALS_UI_H_ 80