| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/active_downloads_ui.h" | 5 #include "chrome/browser/ui/webui/active_downloads_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 203 } |
| 204 | 204 |
| 205 ActiveDownloadsHandler::~ActiveDownloadsHandler() { | 205 ActiveDownloadsHandler::~ActiveDownloadsHandler() { |
| 206 for (size_t i = 0; i < downloads_.size(); ++i) { | 206 for (size_t i = 0; i < downloads_.size(); ++i) { |
| 207 downloads_[i]->RemoveObserver(this); | 207 downloads_[i]->RemoveObserver(this); |
| 208 } | 208 } |
| 209 download_manager_->RemoveObserver(this); | 209 download_manager_->RemoveObserver(this); |
| 210 } | 210 } |
| 211 | 211 |
| 212 WebUIMessageHandler* ActiveDownloadsHandler::Attach(WebUI* web_ui) { | 212 WebUIMessageHandler* ActiveDownloadsHandler::Attach(WebUI* web_ui) { |
| 213 profile_ = web_ui->GetProfile(); | 213 profile_ = Profile::FromWebUI(web_ui); |
| 214 profile_->GetChromeURLDataManager()->AddDataSource(new FileIconSourceCros()); | 214 profile_->GetChromeURLDataManager()->AddDataSource(new FileIconSourceCros()); |
| 215 tab_contents_ = web_ui->tab_contents(); | 215 tab_contents_ = web_ui->tab_contents(); |
| 216 return WebUIMessageHandler::Attach(web_ui); | 216 return WebUIMessageHandler::Attach(web_ui); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void ActiveDownloadsHandler::Init() { | 219 void ActiveDownloadsHandler::Init() { |
| 220 download_manager_ = profile_->GetDownloadManager(); | 220 download_manager_ = profile_->GetDownloadManager(); |
| 221 download_manager_->AddObserver(this); | 221 download_manager_->AddObserver(this); |
| 222 } | 222 } |
| 223 | 223 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 return (*it); | 430 return (*it); |
| 431 } | 431 } |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 return NULL; | 434 return NULL; |
| 435 } | 435 } |
| 436 | 436 |
| 437 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { | 437 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { |
| 438 return handler_->downloads(); | 438 return handler_->downloads(); |
| 439 } | 439 } |
| OLD | NEW |