| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 const base::FilePath& partition_path, | 279 const base::FilePath& partition_path, |
| 280 const Origin& origin, | 280 const Origin& origin, |
| 281 const base::FilePath temp_path, | 281 const base::FilePath temp_path, |
| 282 const base::FilePath zip_path, | 282 const base::FilePath zip_path, |
| 283 size_t connection_count) { | 283 size_t connection_count) { |
| 284 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 284 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 285 const GURL url = GURL(FILE_PATH_LITERAL("file://") + zip_path.value()); | 285 const GURL url = GURL(FILE_PATH_LITERAL("file://") + zip_path.value()); |
| 286 BrowserContext* browser_context = | 286 BrowserContext* browser_context = |
| 287 web_ui()->GetWebContents()->GetBrowserContext(); | 287 web_ui()->GetWebContents()->GetBrowserContext(); |
| 288 std::unique_ptr<DownloadUrlParameters> dl_params( | 288 std::unique_ptr<DownloadUrlParameters> dl_params( |
| 289 DownloadUrlParameters::FromWebContents(web_ui()->GetWebContents(), url)); | 289 DownloadUrlParameters::CreateForWebContentsMainFrame( |
| 290 web_ui()->GetWebContents(), url)); |
| 290 DownloadManager* dlm = BrowserContext::GetDownloadManager(browser_context); | 291 DownloadManager* dlm = BrowserContext::GetDownloadManager(browser_context); |
| 291 | 292 |
| 292 const GURL referrer(web_ui()->GetWebContents()->GetLastCommittedURL()); | 293 const GURL referrer(web_ui()->GetWebContents()->GetLastCommittedURL()); |
| 293 dl_params->set_referrer(content::Referrer::SanitizeForRequest( | 294 dl_params->set_referrer(content::Referrer::SanitizeForRequest( |
| 294 url, content::Referrer(referrer, blink::WebReferrerPolicyDefault))); | 295 url, content::Referrer(referrer, blink::WebReferrerPolicyDefault))); |
| 295 | 296 |
| 296 // This is how to watch for the download to finish: first wait for it | 297 // This is how to watch for the download to finish: first wait for it |
| 297 // to start, then attach a DownloadItem::Observer to observe the | 298 // to start, then attach a DownloadItem::Observer to observe the |
| 298 // state change to the finished state. | 299 // state change to the finished state. |
| 299 dl_params->set_callback(base::Bind(&IndexedDBInternalsUI::OnDownloadStarted, | 300 dl_params->set_callback(base::Bind(&IndexedDBInternalsUI::OnDownloadStarted, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 358 |
| 358 item->AddObserver(new FileDeleter(temp_path)); | 359 item->AddObserver(new FileDeleter(temp_path)); |
| 359 web_ui()->CallJavascriptFunction( | 360 web_ui()->CallJavascriptFunction( |
| 360 "indexeddb.onOriginDownloadReady", | 361 "indexeddb.onOriginDownloadReady", |
| 361 base::StringValue(partition_path.value()), | 362 base::StringValue(partition_path.value()), |
| 362 base::StringValue(origin.Serialize()), | 363 base::StringValue(origin.Serialize()), |
| 363 base::FundamentalValue(static_cast<double>(connection_count))); | 364 base::FundamentalValue(static_cast<double>(connection_count))); |
| 364 } | 365 } |
| 365 | 366 |
| 366 } // namespace content | 367 } // namespace content |
| OLD | NEW |