| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 299   dlm->DownloadUrl(dl_params.Pass()); | 299   dlm->DownloadUrl(dl_params.Pass()); | 
| 300 } | 300 } | 
| 301 | 301 | 
| 302 // The entire purpose of this class is to delete the temp file after | 302 // The entire purpose of this class is to delete the temp file after | 
| 303 // the download is complete. | 303 // the download is complete. | 
| 304 class FileDeleter : public DownloadItem::Observer { | 304 class FileDeleter : public DownloadItem::Observer { | 
| 305  public: | 305  public: | 
| 306   explicit FileDeleter(const base::FilePath& temp_dir) : temp_dir_(temp_dir) {} | 306   explicit FileDeleter(const base::FilePath& temp_dir) : temp_dir_(temp_dir) {} | 
| 307   virtual ~FileDeleter(); | 307   virtual ~FileDeleter(); | 
| 308 | 308 | 
| 309   virtual void OnDownloadUpdated(DownloadItem* download) OVERRIDE; | 309   virtual void OnDownloadUpdated(DownloadItem* download) override; | 
| 310   virtual void OnDownloadOpened(DownloadItem* item) OVERRIDE {} | 310   virtual void OnDownloadOpened(DownloadItem* item) override {} | 
| 311   virtual void OnDownloadRemoved(DownloadItem* item) OVERRIDE {} | 311   virtual void OnDownloadRemoved(DownloadItem* item) override {} | 
| 312   virtual void OnDownloadDestroyed(DownloadItem* item) OVERRIDE {} | 312   virtual void OnDownloadDestroyed(DownloadItem* item) override {} | 
| 313 | 313 | 
| 314  private: | 314  private: | 
| 315   const base::FilePath temp_dir_; | 315   const base::FilePath temp_dir_; | 
| 316 | 316 | 
| 317   DISALLOW_COPY_AND_ASSIGN(FileDeleter); | 317   DISALLOW_COPY_AND_ASSIGN(FileDeleter); | 
| 318 }; | 318 }; | 
| 319 | 319 | 
| 320 void FileDeleter::OnDownloadUpdated(DownloadItem* item) { | 320 void FileDeleter::OnDownloadUpdated(DownloadItem* item) { | 
| 321   switch (item->GetState()) { | 321   switch (item->GetState()) { | 
| 322     case DownloadItem::IN_PROGRESS: | 322     case DownloadItem::IN_PROGRESS: | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 355 | 355 | 
| 356   item->AddObserver(new FileDeleter(temp_path)); | 356   item->AddObserver(new FileDeleter(temp_path)); | 
| 357   web_ui()->CallJavascriptFunction( | 357   web_ui()->CallJavascriptFunction( | 
| 358       "indexeddb.onOriginDownloadReady", | 358       "indexeddb.onOriginDownloadReady", | 
| 359       base::StringValue(partition_path.value()), | 359       base::StringValue(partition_path.value()), | 
| 360       base::StringValue(origin_url.spec()), | 360       base::StringValue(origin_url.spec()), | 
| 361       base::FundamentalValue(static_cast<double>(connection_count))); | 361       base::FundamentalValue(static_cast<double>(connection_count))); | 
| 362 } | 362 } | 
| 363 | 363 | 
| 364 }  // namespace content | 364 }  // namespace content | 
| OLD | NEW | 
|---|