| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/indexed_db/indexed_db_internals_ui.h" | 5 #include "content/browser/indexed_db/indexed_db_internals_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 base::Unretained(this), | 119 base::Unretained(this), |
| 120 base::Passed(&info_list), | 120 base::Passed(&info_list), |
| 121 is_incognito ? base::FilePath() : context_path)); | 121 is_incognito ? base::FilePath() : context_path)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void IndexedDBInternalsUI::OnOriginsReady( | 124 void IndexedDBInternalsUI::OnOriginsReady( |
| 125 std::unique_ptr<base::ListValue> origins, | 125 std::unique_ptr<base::ListValue> origins, |
| 126 const base::FilePath& path) { | 126 const base::FilePath& path) { |
| 127 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 127 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 128 web_ui()->CallJavascriptFunctionUnsafe("indexeddb.onOriginsReady", *origins, | 128 web_ui()->CallJavascriptFunctionUnsafe("indexeddb.onOriginsReady", *origins, |
| 129 base::StringValue(path.value())); | 129 base::Value(path.value())); |
| 130 } | 130 } |
| 131 | 131 |
| 132 static void FindContext(const base::FilePath& partition_path, | 132 static void FindContext(const base::FilePath& partition_path, |
| 133 StoragePartition** result_partition, | 133 StoragePartition** result_partition, |
| 134 scoped_refptr<IndexedDBContextImpl>* result_context, | 134 scoped_refptr<IndexedDBContextImpl>* result_context, |
| 135 StoragePartition* storage_partition) { | 135 StoragePartition* storage_partition) { |
| 136 if (storage_partition->GetPath() == partition_path) { | 136 if (storage_partition->GetPath() == partition_path) { |
| 137 *result_partition = storage_partition; | 137 *result_partition = storage_partition; |
| 138 *result_context = static_cast<IndexedDBContextImpl*>( | 138 *result_context = static_cast<IndexedDBContextImpl*>( |
| 139 storage_partition->GetIndexedDBContext()); | 139 storage_partition->GetIndexedDBContext()); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 BrowserThread::PostTask( | 263 BrowserThread::PostTask( |
| 264 BrowserThread::UI, FROM_HERE, | 264 BrowserThread::UI, FROM_HERE, |
| 265 base::Bind(&IndexedDBInternalsUI::OnForcedClose, base::Unretained(this), | 265 base::Bind(&IndexedDBInternalsUI::OnForcedClose, base::Unretained(this), |
| 266 partition_path, origin, connection_count)); | 266 partition_path, origin, connection_count)); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void IndexedDBInternalsUI::OnForcedClose(const base::FilePath& partition_path, | 269 void IndexedDBInternalsUI::OnForcedClose(const base::FilePath& partition_path, |
| 270 const Origin& origin, | 270 const Origin& origin, |
| 271 size_t connection_count) { | 271 size_t connection_count) { |
| 272 web_ui()->CallJavascriptFunctionUnsafe( | 272 web_ui()->CallJavascriptFunctionUnsafe( |
| 273 "indexeddb.onForcedClose", base::StringValue(partition_path.value()), | 273 "indexeddb.onForcedClose", base::Value(partition_path.value()), |
| 274 base::StringValue(origin.Serialize()), | 274 base::Value(origin.Serialize()), |
| 275 base::Value(static_cast<double>(connection_count))); | 275 base::Value(static_cast<double>(connection_count))); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void IndexedDBInternalsUI::OnDownloadDataReady( | 278 void IndexedDBInternalsUI::OnDownloadDataReady( |
| 279 const base::FilePath& partition_path, | 279 const base::FilePath& partition_path, |
| 280 const Origin& origin, | 280 const Origin& origin, |
| 281 const base::FilePath temp_path, | 281 const base::FilePath temp_path, |
| 282 const base::FilePath zip_path, | 282 const base::FilePath zip_path, |
| 283 size_t connection_count) { | 283 size_t connection_count) { |
| 284 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 284 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 DownloadItem* item, | 351 DownloadItem* item, |
| 352 DownloadInterruptReason interrupt_reason) { | 352 DownloadInterruptReason interrupt_reason) { |
| 353 if (interrupt_reason != DOWNLOAD_INTERRUPT_REASON_NONE) { | 353 if (interrupt_reason != DOWNLOAD_INTERRUPT_REASON_NONE) { |
| 354 LOG(ERROR) << "Error downloading database dump: " | 354 LOG(ERROR) << "Error downloading database dump: " |
| 355 << DownloadInterruptReasonToString(interrupt_reason); | 355 << DownloadInterruptReasonToString(interrupt_reason); |
| 356 return; | 356 return; |
| 357 } | 357 } |
| 358 | 358 |
| 359 item->AddObserver(new FileDeleter(temp_path)); | 359 item->AddObserver(new FileDeleter(temp_path)); |
| 360 web_ui()->CallJavascriptFunctionUnsafe( | 360 web_ui()->CallJavascriptFunctionUnsafe( |
| 361 "indexeddb.onOriginDownloadReady", | 361 "indexeddb.onOriginDownloadReady", base::Value(partition_path.value()), |
| 362 base::StringValue(partition_path.value()), | 362 base::Value(origin.Serialize()), |
| 363 base::StringValue(origin.Serialize()), | |
| 364 base::Value(static_cast<double>(connection_count))); | 363 base::Value(static_cast<double>(connection_count))); |
| 365 } | 364 } |
| 366 | 365 |
| 367 } // namespace content | 366 } // namespace content |
| OLD | NEW |