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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 const scoped_ptr<ContextList> contexts, | 97 const scoped_ptr<ContextList> contexts, |
98 const scoped_ptr<std::vector<base::FilePath> > context_paths) { | 98 const scoped_ptr<std::vector<base::FilePath> > context_paths) { |
99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
100 DCHECK_EQ(contexts->size(), context_paths->size()); | 100 DCHECK_EQ(contexts->size(), context_paths->size()); |
101 | 101 |
102 std::vector<base::FilePath>::const_iterator path_iter = | 102 std::vector<base::FilePath>::const_iterator path_iter = |
103 context_paths->begin(); | 103 context_paths->begin(); |
104 for (ContextList::const_iterator iter = contexts->begin(); | 104 for (ContextList::const_iterator iter = contexts->begin(); |
105 iter != contexts->end(); | 105 iter != contexts->end(); |
106 ++iter, ++path_iter) { | 106 ++iter, ++path_iter) { |
107 IndexedDBContext* context = *iter; | 107 IndexedDBContext* context = iter->get(); |
108 const base::FilePath& context_path = *path_iter; | 108 const base::FilePath& context_path = *path_iter; |
109 | 109 |
110 scoped_ptr<std::vector<IndexedDBInfo> > info_list( | 110 scoped_ptr<std::vector<IndexedDBInfo> > info_list( |
111 new std::vector<IndexedDBInfo>(context->GetAllOriginsInfo())); | 111 new std::vector<IndexedDBInfo>(context->GetAllOriginsInfo())); |
112 std::sort(info_list->begin(), info_list->end(), HostNameComparator); | 112 std::sort(info_list->begin(), info_list->end(), HostNameComparator); |
113 BrowserThread::PostTask(BrowserThread::UI, | 113 BrowserThread::PostTask(BrowserThread::UI, |
114 FROM_HERE, | 114 FROM_HERE, |
115 base::Bind(&IndexedDBInternalsUI::OnOriginsReady, | 115 base::Bind(&IndexedDBInternalsUI::OnOriginsReady, |
116 base::Unretained(this), | 116 base::Unretained(this), |
117 base::Passed(&info_list), | 117 base::Passed(&info_list), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 BrowserContext* browser_context = | 167 BrowserContext* browser_context = |
168 web_ui()->GetWebContents()->GetBrowserContext(); | 168 web_ui()->GetWebContents()->GetBrowserContext(); |
169 | 169 |
170 scoped_refptr<IndexedDBContextImpl> result_context; | 170 scoped_refptr<IndexedDBContextImpl> result_context; |
171 StoragePartition* result_partition; | 171 StoragePartition* result_partition; |
172 scoped_ptr<ContextList> contexts(new ContextList); | 172 scoped_ptr<ContextList> contexts(new ContextList); |
173 BrowserContext::StoragePartitionCallback cb = base::Bind( | 173 BrowserContext::StoragePartitionCallback cb = base::Bind( |
174 &FindContext, partition_path, &result_partition, &result_context); | 174 &FindContext, partition_path, &result_partition, &result_context); |
175 BrowserContext::ForEachStoragePartition(browser_context, cb); | 175 BrowserContext::ForEachStoragePartition(browser_context, cb); |
176 DCHECK(result_partition); | 176 DCHECK(result_partition); |
177 DCHECK(result_context); | 177 DCHECK(result_context.get()); |
178 | 178 |
179 BrowserThread::PostTask( | 179 BrowserThread::PostTask( |
180 BrowserThread::WEBKIT_DEPRECATED, | 180 BrowserThread::WEBKIT_DEPRECATED, |
181 FROM_HERE, | 181 FROM_HERE, |
182 base::Bind(&IndexedDBInternalsUI::DownloadOriginDataOnWebkitThread, | 182 base::Bind(&IndexedDBInternalsUI::DownloadOriginDataOnWebkitThread, |
183 base::Unretained(this), | 183 base::Unretained(this), |
184 result_partition->GetPath(), | 184 result_partition->GetPath(), |
185 result_context, | 185 result_context, |
186 origin_url)); | 186 origin_url)); |
187 } | 187 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 return; | 306 return; |
307 } | 307 } |
308 | 308 |
309 item->AddObserver(new FileDeleter(temp_path)); | 309 item->AddObserver(new FileDeleter(temp_path)); |
310 web_ui()->CallJavascriptFunction("indexeddb.onOriginDownloadReady", | 310 web_ui()->CallJavascriptFunction("indexeddb.onOriginDownloadReady", |
311 base::StringValue(partition_path.value()), | 311 base::StringValue(partition_path.value()), |
312 base::StringValue(origin_url.spec())); | 312 base::StringValue(origin_url.spec())); |
313 } | 313 } |
314 | 314 |
315 } // namespace content | 315 } // namespace content |
OLD | NEW |