| 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_ = |
| 214 Profile::FromBrowserContext(web_ui->tab_contents()->browser_context()); |
| 214 profile_->GetChromeURLDataManager()->AddDataSource(new FileIconSourceCros()); | 215 profile_->GetChromeURLDataManager()->AddDataSource(new FileIconSourceCros()); |
| 215 tab_contents_ = web_ui->tab_contents(); | 216 tab_contents_ = web_ui->tab_contents(); |
| 216 return WebUIMessageHandler::Attach(web_ui); | 217 return WebUIMessageHandler::Attach(web_ui); |
| 217 } | 218 } |
| 218 | 219 |
| 219 void ActiveDownloadsHandler::Init() { | 220 void ActiveDownloadsHandler::Init() { |
| 220 download_manager_ = profile_->GetDownloadManager(); | 221 download_manager_ = profile_->GetDownloadManager(); |
| 221 download_manager_->AddObserver(this); | 222 download_manager_->AddObserver(this); |
| 222 } | 223 } |
| 223 | 224 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 return (*it); | 431 return (*it); |
| 431 } | 432 } |
| 432 } | 433 } |
| 433 } | 434 } |
| 434 return NULL; | 435 return NULL; |
| 435 } | 436 } |
| 436 | 437 |
| 437 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { | 438 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { |
| 438 return handler_->downloads(); | 439 return handler_->downloads(); |
| 439 } | 440 } |
| OLD | NEW |