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 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 15 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
15 #include "content/grit/content_resources.h" | 16 #include "content/grit/content_resources.h" |
16 #include "content/public/browser/browser_context.h" | 17 #include "content/public/browser/browser_context.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 306 |
306 // This is how to watch for the download to finish: first wait for it | 307 // This is how to watch for the download to finish: first wait for it |
307 // to start, then attach a DownloadItem::Observer to observe the | 308 // to start, then attach a DownloadItem::Observer to observe the |
308 // state change to the finished state. | 309 // state change to the finished state. |
309 dl_params->set_callback(base::Bind(&IndexedDBInternalsUI::OnDownloadStarted, | 310 dl_params->set_callback(base::Bind(&IndexedDBInternalsUI::OnDownloadStarted, |
310 base::Unretained(this), | 311 base::Unretained(this), |
311 partition_path, | 312 partition_path, |
312 origin_url, | 313 origin_url, |
313 temp_path, | 314 temp_path, |
314 connection_count)); | 315 connection_count)); |
315 dlm->DownloadUrl(dl_params.Pass()); | 316 dlm->DownloadUrl(std::move(dl_params)); |
316 } | 317 } |
317 | 318 |
318 // The entire purpose of this class is to delete the temp file after | 319 // The entire purpose of this class is to delete the temp file after |
319 // the download is complete. | 320 // the download is complete. |
320 class FileDeleter : public DownloadItem::Observer { | 321 class FileDeleter : public DownloadItem::Observer { |
321 public: | 322 public: |
322 explicit FileDeleter(const base::FilePath& temp_dir) : temp_dir_(temp_dir) {} | 323 explicit FileDeleter(const base::FilePath& temp_dir) : temp_dir_(temp_dir) {} |
323 ~FileDeleter() override; | 324 ~FileDeleter() override; |
324 | 325 |
325 void OnDownloadUpdated(DownloadItem* download) override; | 326 void OnDownloadUpdated(DownloadItem* download) override; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 372 |
372 item->AddObserver(new FileDeleter(temp_path)); | 373 item->AddObserver(new FileDeleter(temp_path)); |
373 web_ui()->CallJavascriptFunction( | 374 web_ui()->CallJavascriptFunction( |
374 "indexeddb.onOriginDownloadReady", | 375 "indexeddb.onOriginDownloadReady", |
375 base::StringValue(partition_path.value()), | 376 base::StringValue(partition_path.value()), |
376 base::StringValue(origin_url.spec()), | 377 base::StringValue(origin_url.spec()), |
377 base::FundamentalValue(static_cast<double>(connection_count))); | 378 base::FundamentalValue(static_cast<double>(connection_count))); |
378 } | 379 } |
379 | 380 |
380 } // namespace content | 381 } // namespace content |
OLD | NEW |