| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 size_t connection_count) { | 292 size_t connection_count) { |
| 293 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 293 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 294 const GURL url = GURL(FILE_PATH_LITERAL("file://") + zip_path.value()); | 294 const GURL url = GURL(FILE_PATH_LITERAL("file://") + zip_path.value()); |
| 295 BrowserContext* browser_context = | 295 BrowserContext* browser_context = |
| 296 web_ui()->GetWebContents()->GetBrowserContext(); | 296 web_ui()->GetWebContents()->GetBrowserContext(); |
| 297 scoped_ptr<DownloadUrlParameters> dl_params( | 297 scoped_ptr<DownloadUrlParameters> dl_params( |
| 298 DownloadUrlParameters::FromWebContents(web_ui()->GetWebContents(), url)); | 298 DownloadUrlParameters::FromWebContents(web_ui()->GetWebContents(), url)); |
| 299 DownloadManager* dlm = BrowserContext::GetDownloadManager(browser_context); | 299 DownloadManager* dlm = BrowserContext::GetDownloadManager(browser_context); |
| 300 | 300 |
| 301 const GURL referrer(web_ui()->GetWebContents()->GetLastCommittedURL()); | 301 const GURL referrer(web_ui()->GetWebContents()->GetLastCommittedURL()); |
| 302 dl_params->set_referrer( | 302 dl_params->set_referrer(content::Referrer::SanitizeForRequest( |
| 303 content::Referrer(referrer, blink::WebReferrerPolicyDefault)); | 303 url, content::Referrer(referrer, blink::WebReferrerPolicyDefault))); |
| 304 | 304 |
| 305 // This is how to watch for the download to finish: first wait for it | 305 // This is how to watch for the download to finish: first wait for it |
| 306 // to start, then attach a DownloadItem::Observer to observe the | 306 // to start, then attach a DownloadItem::Observer to observe the |
| 307 // state change to the finished state. | 307 // state change to the finished state. |
| 308 dl_params->set_callback(base::Bind(&IndexedDBInternalsUI::OnDownloadStarted, | 308 dl_params->set_callback(base::Bind(&IndexedDBInternalsUI::OnDownloadStarted, |
| 309 base::Unretained(this), | 309 base::Unretained(this), |
| 310 partition_path, | 310 partition_path, |
| 311 origin_url, | 311 origin_url, |
| 312 temp_path, | 312 temp_path, |
| 313 connection_count)); | 313 connection_count)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 370 |
| 371 item->AddObserver(new FileDeleter(temp_path)); | 371 item->AddObserver(new FileDeleter(temp_path)); |
| 372 web_ui()->CallJavascriptFunction( | 372 web_ui()->CallJavascriptFunction( |
| 373 "indexeddb.onOriginDownloadReady", | 373 "indexeddb.onOriginDownloadReady", |
| 374 base::StringValue(partition_path.value()), | 374 base::StringValue(partition_path.value()), |
| 375 base::StringValue(origin_url.spec()), | 375 base::StringValue(origin_url.spec()), |
| 376 base::FundamentalValue(static_cast<double>(connection_count))); | 376 base::FundamentalValue(static_cast<double>(connection_count))); |
| 377 } | 377 } |
| 378 | 378 |
| 379 } // namespace content | 379 } // namespace content |
| OLD | NEW |