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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 base::Bind(&IndexedDBInternalsUI::OnOriginsReady, | 117 base::Bind(&IndexedDBInternalsUI::OnOriginsReady, |
118 base::Unretained(this), | 118 base::Unretained(this), |
119 base::Passed(&info_list), | 119 base::Passed(&info_list), |
120 is_incognito ? base::FilePath() : context_path)); | 120 is_incognito ? base::FilePath() : context_path)); |
121 } | 121 } |
122 | 122 |
123 void IndexedDBInternalsUI::OnOriginsReady( | 123 void IndexedDBInternalsUI::OnOriginsReady( |
124 std::unique_ptr<base::ListValue> origins, | 124 std::unique_ptr<base::ListValue> origins, |
125 const base::FilePath& path) { | 125 const base::FilePath& path) { |
126 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 126 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
127 web_ui()->CallJavascriptFunction( | 127 web_ui()->CallJavascriptFunctionUnsafe("indexeddb.onOriginsReady", *origins, |
128 "indexeddb.onOriginsReady", *origins, base::StringValue(path.value())); | 128 base::StringValue(path.value())); |
129 } | 129 } |
130 | 130 |
131 static void FindContext(const base::FilePath& partition_path, | 131 static void FindContext(const base::FilePath& partition_path, |
132 StoragePartition** result_partition, | 132 StoragePartition** result_partition, |
133 scoped_refptr<IndexedDBContextImpl>* result_context, | 133 scoped_refptr<IndexedDBContextImpl>* result_context, |
134 StoragePartition* storage_partition) { | 134 StoragePartition* storage_partition) { |
135 if (storage_partition->GetPath() == partition_path) { | 135 if (storage_partition->GetPath() == partition_path) { |
136 *result_partition = storage_partition; | 136 *result_partition = storage_partition; |
137 *result_context = static_cast<IndexedDBContextImpl*>( | 137 *result_context = static_cast<IndexedDBContextImpl*>( |
138 storage_partition->GetIndexedDBContext()); | 138 storage_partition->GetIndexedDBContext()); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
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()->CallJavascriptFunction( | 272 web_ui()->CallJavascriptFunctionUnsafe( |
273 "indexeddb.onForcedClose", base::StringValue(partition_path.value()), | 273 "indexeddb.onForcedClose", base::StringValue(partition_path.value()), |
274 base::StringValue(origin.Serialize()), | 274 base::StringValue(origin.Serialize()), |
275 base::FundamentalValue(static_cast<double>(connection_count))); | 275 base::FundamentalValue(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, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 size_t connection_count, | 350 size_t connection_count, |
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()->CallJavascriptFunction( | 360 web_ui()->CallJavascriptFunctionUnsafe( |
361 "indexeddb.onOriginDownloadReady", | 361 "indexeddb.onOriginDownloadReady", |
362 base::StringValue(partition_path.value()), | 362 base::StringValue(partition_path.value()), |
363 base::StringValue(origin.Serialize()), | 363 base::StringValue(origin.Serialize()), |
364 base::FundamentalValue(static_cast<double>(connection_count))); | 364 base::FundamentalValue(static_cast<double>(connection_count))); |
365 } | 365 } |
366 | 366 |
367 } // namespace content | 367 } // namespace content |
OLD | NEW |