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<base::ListValue> info_list(static_cast<IndexedDBContextImpl*>( | 90 IndexedDBContextImpl* context_impl = |
91 context.get())->GetAllOriginsDetails()); | 91 static_cast<IndexedDBContextImpl*>(context.get()); |
92 | 92 |
93 BrowserThread::PostTask(BrowserThread::UI, | 93 scoped_ptr<base::ListValue> info_list(context_impl->GetAllOriginsDetails()); |
94 FROM_HERE, | 94 bool is_incognito = context_impl->is_incognito(); |
95 base::Bind(&IndexedDBInternalsUI::OnOriginsReady, | 95 |
96 base::Unretained(this), | 96 BrowserThread::PostTask( |
97 base::Passed(&info_list), | 97 BrowserThread::UI, |
98 context_path)); | 98 FROM_HERE, |
| 99 base::Bind(&IndexedDBInternalsUI::OnOriginsReady, |
| 100 base::Unretained(this), |
| 101 base::Passed(&info_list), |
| 102 is_incognito ? base::FilePath() : context_path)); |
99 } | 103 } |
100 | 104 |
101 void IndexedDBInternalsUI::OnOriginsReady(scoped_ptr<base::ListValue> origins, | 105 void IndexedDBInternalsUI::OnOriginsReady(scoped_ptr<base::ListValue> origins, |
102 const base::FilePath& path) { | 106 const base::FilePath& path) { |
103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
104 web_ui()->CallJavascriptFunction( | 108 web_ui()->CallJavascriptFunction( |
105 "indexeddb.onOriginsReady", *origins, base::StringValue(path.value())); | 109 "indexeddb.onOriginsReady", *origins, base::StringValue(path.value())); |
106 } | 110 } |
107 | 111 |
108 static void FindContext(const base::FilePath& partition_path, | 112 static void FindContext(const base::FilePath& partition_path, |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 356 |
353 item->AddObserver(new FileDeleter(temp_path)); | 357 item->AddObserver(new FileDeleter(temp_path)); |
354 web_ui()->CallJavascriptFunction( | 358 web_ui()->CallJavascriptFunction( |
355 "indexeddb.onOriginDownloadReady", | 359 "indexeddb.onOriginDownloadReady", |
356 base::StringValue(partition_path.value()), | 360 base::StringValue(partition_path.value()), |
357 base::StringValue(origin_url.spec()), | 361 base::StringValue(origin_url.spec()), |
358 base::FundamentalValue(static_cast<double>(connection_count))); | 362 base::FundamentalValue(static_cast<double>(connection_count))); |
359 } | 363 } |
360 | 364 |
361 } // namespace content | 365 } // namespace content |
OLD | NEW |