| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/dom_ui/downloads_dom_handler.h" | 5 #include "chrome/browser/dom_ui/downloads_dom_handler.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm) | 47 DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm) |
| 48 : search_text_(), | 48 : search_text_(), |
| 49 download_manager_(dlm), | 49 download_manager_(dlm), |
| 50 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 50 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 51 // Create our fileicon data source. | 51 // Create our fileicon data source. |
| 52 BrowserThread::PostTask( | 52 BrowserThread::PostTask( |
| 53 BrowserThread::IO, FROM_HERE, | 53 BrowserThread::IO, FROM_HERE, |
| 54 NewRunnableMethod( | 54 NewRunnableMethod( |
| 55 Singleton<ChromeURLDataManager>::get(), | 55 ChromeURLDataManager::GetInstance(), |
| 56 &ChromeURLDataManager::AddDataSource, | 56 &ChromeURLDataManager::AddDataSource, |
| 57 make_scoped_refptr(new FileIconSource()))); | 57 make_scoped_refptr(new FileIconSource()))); |
| 58 } | 58 } |
| 59 | 59 |
| 60 DownloadsDOMHandler::~DownloadsDOMHandler() { | 60 DownloadsDOMHandler::~DownloadsDOMHandler() { |
| 61 ClearDownloadItems(); | 61 ClearDownloadItems(); |
| 62 download_manager_->RemoveObserver(this); | 62 download_manager_->RemoveObserver(this); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // DownloadsDOMHandler, public: ----------------------------------------------- | 65 // DownloadsDOMHandler, public: ----------------------------------------------- |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 return NULL; | 241 return NULL; |
| 242 } | 242 } |
| 243 | 243 |
| 244 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { | 244 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { |
| 245 int id; | 245 int id; |
| 246 if (ExtractIntegerValue(args, &id)) { | 246 if (ExtractIntegerValue(args, &id)) { |
| 247 return GetDownloadById(id); | 247 return GetDownloadById(id); |
| 248 } | 248 } |
| 249 return NULL; | 249 return NULL; |
| 250 } | 250 } |
| OLD | NEW |