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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 scoped_refptr<IndexedDBContextImpl>* context) { | 145 scoped_refptr<IndexedDBContextImpl>* context) { |
146 // search the origins to find the right context | 146 // search the origins to find the right context |
147 BrowserContext* browser_context = | 147 BrowserContext* browser_context = |
148 web_ui()->GetWebContents()->GetBrowserContext(); | 148 web_ui()->GetWebContents()->GetBrowserContext(); |
149 | 149 |
150 StoragePartition* result_partition; | 150 StoragePartition* result_partition; |
151 BrowserContext::StoragePartitionCallback cb = | 151 BrowserContext::StoragePartitionCallback cb = |
152 base::Bind(&FindContext, path, &result_partition, context); | 152 base::Bind(&FindContext, path, &result_partition, context); |
153 BrowserContext::ForEachStoragePartition(browser_context, cb); | 153 BrowserContext::ForEachStoragePartition(browser_context, cb); |
154 | 154 |
155 if (!result_partition || !(*context)) | 155 if (!result_partition || !(context->get())) |
156 return false; | 156 return false; |
157 | 157 |
158 return true; | 158 return true; |
159 } | 159 } |
160 | 160 |
161 void IndexedDBInternalsUI::DownloadOriginData(const base::ListValue* args) { | 161 void IndexedDBInternalsUI::DownloadOriginData(const base::ListValue* args) { |
162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
163 | 163 |
164 base::FilePath partition_path; | 164 base::FilePath partition_path; |
165 GURL origin_url; | 165 GURL origin_url; |
166 scoped_refptr<IndexedDBContextImpl> context; | 166 scoped_refptr<IndexedDBContextImpl> context; |
167 if (!GetOriginData(args, &partition_path, &origin_url, &context)) | 167 if (!GetOriginData(args, &partition_path, &origin_url, &context)) |
168 return; | 168 return; |
169 | 169 |
170 DCHECK(context); | 170 DCHECK(context.get()); |
171 context->TaskRunner()->PostTask( | 171 context->TaskRunner()->PostTask( |
172 FROM_HERE, | 172 FROM_HERE, |
173 base::Bind(&IndexedDBInternalsUI::DownloadOriginDataOnIndexedDBThread, | 173 base::Bind(&IndexedDBInternalsUI::DownloadOriginDataOnIndexedDBThread, |
174 base::Unretained(this), | 174 base::Unretained(this), |
175 partition_path, | 175 partition_path, |
176 context, | 176 context, |
177 origin_url)); | 177 origin_url)); |
178 } | 178 } |
179 | 179 |
180 void IndexedDBInternalsUI::ForceCloseOrigin(const base::ListValue* args) { | 180 void IndexedDBInternalsUI::ForceCloseOrigin(const base::ListValue* args) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 356 |
357 item->AddObserver(new FileDeleter(temp_path)); | 357 item->AddObserver(new FileDeleter(temp_path)); |
358 web_ui()->CallJavascriptFunction( | 358 web_ui()->CallJavascriptFunction( |
359 "indexeddb.onOriginDownloadReady", | 359 "indexeddb.onOriginDownloadReady", |
360 base::StringValue(partition_path.value()), | 360 base::StringValue(partition_path.value()), |
361 base::StringValue(origin_url.spec()), | 361 base::StringValue(origin_url.spec()), |
362 base::FundamentalValue(static_cast<double>(connection_count))); | 362 base::FundamentalValue(static_cast<double>(connection_count))); |
363 } | 363 } |
364 | 364 |
365 } // namespace content | 365 } // namespace content |
OLD | NEW |