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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 base::Bind(&IndexedDBInternalsUI::AddContextFromStoragePartition, | 80 base::Bind(&IndexedDBInternalsUI::AddContextFromStoragePartition, |
81 base::Unretained(this)); | 81 base::Unretained(this)); |
82 BrowserContext::ForEachStoragePartition(browser_context, cb); | 82 BrowserContext::ForEachStoragePartition(browser_context, cb); |
83 } | 83 } |
84 | 84 |
85 void IndexedDBInternalsUI::GetAllOriginsOnIndexedDBThread( | 85 void IndexedDBInternalsUI::GetAllOriginsOnIndexedDBThread( |
86 scoped_refptr<IndexedDBContext> context, | 86 scoped_refptr<IndexedDBContext> context, |
87 const base::FilePath& context_path) { | 87 const base::FilePath& context_path) { |
88 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 88 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); |
89 | 89 |
90 scoped_ptr<ListValue> info_list(static_cast<IndexedDBContextImpl*>( | 90 scoped_ptr<base::ListValue> info_list(static_cast<IndexedDBContextImpl*>( |
91 context.get())->GetAllOriginsDetails()); | 91 context.get())->GetAllOriginsDetails()); |
92 | 92 |
93 BrowserThread::PostTask(BrowserThread::UI, | 93 BrowserThread::PostTask(BrowserThread::UI, |
94 FROM_HERE, | 94 FROM_HERE, |
95 base::Bind(&IndexedDBInternalsUI::OnOriginsReady, | 95 base::Bind(&IndexedDBInternalsUI::OnOriginsReady, |
96 base::Unretained(this), | 96 base::Unretained(this), |
97 base::Passed(&info_list), | 97 base::Passed(&info_list), |
98 context_path)); | 98 context_path)); |
99 } | 99 } |
100 | 100 |
101 void IndexedDBInternalsUI::OnOriginsReady(scoped_ptr<ListValue> origins, | 101 void IndexedDBInternalsUI::OnOriginsReady(scoped_ptr<base::ListValue> origins, |
102 const base::FilePath& path) { | 102 const base::FilePath& path) { |
103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
104 web_ui()->CallJavascriptFunction( | 104 web_ui()->CallJavascriptFunction( |
105 "indexeddb.onOriginsReady", *origins, base::StringValue(path.value())); | 105 "indexeddb.onOriginsReady", *origins, base::StringValue(path.value())); |
106 } | 106 } |
107 | 107 |
108 static void FindContext(const base::FilePath& partition_path, | 108 static void FindContext(const base::FilePath& partition_path, |
109 StoragePartition** result_partition, | 109 StoragePartition** result_partition, |
110 scoped_refptr<IndexedDBContextImpl>* result_context, | 110 scoped_refptr<IndexedDBContextImpl>* result_context, |
111 StoragePartition* storage_partition) { | 111 StoragePartition* storage_partition) { |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 348 |
349 item->AddObserver(new FileDeleter(temp_path)); | 349 item->AddObserver(new FileDeleter(temp_path)); |
350 web_ui()->CallJavascriptFunction( | 350 web_ui()->CallJavascriptFunction( |
351 "indexeddb.onOriginDownloadReady", | 351 "indexeddb.onOriginDownloadReady", |
352 base::StringValue(partition_path.value()), | 352 base::StringValue(partition_path.value()), |
353 base::StringValue(origin_url.spec()), | 353 base::StringValue(origin_url.spec()), |
354 base::FundamentalValue(double(connection_count))); | 354 base::FundamentalValue(double(connection_count))); |
355 } | 355 } |
356 | 356 |
357 } // namespace content | 357 } // namespace content |
OLD | NEW |