OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 20 matching lines...) Expand all Loading... |
31 #include "chrome/browser/download/download_util.h" | 31 #include "chrome/browser/download/download_util.h" |
32 #include "chrome/browser/extensions/extension_service.h" | 32 #include "chrome/browser/extensions/extension_service.h" |
33 #include "chrome/browser/extensions/file_manager_util.h" | 33 #include "chrome/browser/extensions/file_manager_util.h" |
34 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
35 #include "chrome/browser/tabs/tab_strip_model.h" | 35 #include "chrome/browser/tabs/tab_strip_model.h" |
36 #include "chrome/browser/ui/browser.h" | 36 #include "chrome/browser/ui/browser.h" |
37 #include "chrome/browser/ui/browser_list.h" | 37 #include "chrome/browser/ui/browser_list.h" |
38 #include "chrome/browser/ui/browser_window.h" | 38 #include "chrome/browser/ui/browser_window.h" |
39 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 39 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
40 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 40 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
41 #include "chrome/browser/ui/webui/fileicon_source_chromeos.h" | 41 #include "chrome/browser/ui/webui/fileicon_source.h" |
42 #include "chrome/common/chrome_paths.h" | 42 #include "chrome/common/chrome_paths.h" |
43 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
44 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
45 #include "content/browser/renderer_host/render_view_host.h" | 45 #include "content/browser/renderer_host/render_view_host.h" |
46 #include "content/public/browser/download_item.h" | 46 #include "content/public/browser/download_item.h" |
47 #include "content/public/browser/download_manager.h" | 47 #include "content/public/browser/download_manager.h" |
48 #include "content/public/browser/navigation_controller.h" | 48 #include "content/public/browser/navigation_controller.h" |
49 #include "content/public/browser/render_view_host_delegate.h" | 49 #include "content/public/browser/render_view_host_delegate.h" |
50 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
51 #include "content/public/browser/web_ui.h" | 51 #include "content/public/browser/web_ui.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 ActiveDownloadsHandler::~ActiveDownloadsHandler() { | 175 ActiveDownloadsHandler::~ActiveDownloadsHandler() { |
176 for (size_t i = 0; i < downloads_.size(); ++i) { | 176 for (size_t i = 0; i < downloads_.size(); ++i) { |
177 downloads_[i]->RemoveObserver(this); | 177 downloads_[i]->RemoveObserver(this); |
178 } | 178 } |
179 download_manager_->RemoveObserver(this); | 179 download_manager_->RemoveObserver(this); |
180 } | 180 } |
181 | 181 |
182 void ActiveDownloadsHandler::RegisterMessages() { | 182 void ActiveDownloadsHandler::RegisterMessages() { |
183 profile_ = Profile::FromWebUI(web_ui()); | 183 profile_ = Profile::FromWebUI(web_ui()); |
184 profile_->GetChromeURLDataManager()->AddDataSource(new FileIconSourceCros()); | 184 profile_->GetChromeURLDataManager()->AddDataSource(new FileIconSource()); |
185 | 185 |
186 web_ui()->RegisterMessageCallback("getDownloads", | 186 web_ui()->RegisterMessageCallback("getDownloads", |
187 base::Bind(&ActiveDownloadsHandler::HandleGetDownloads, | 187 base::Bind(&ActiveDownloadsHandler::HandleGetDownloads, |
188 base::Unretained(this))); | 188 base::Unretained(this))); |
189 web_ui()->RegisterMessageCallback("pauseToggleDownload", | 189 web_ui()->RegisterMessageCallback("pauseToggleDownload", |
190 base::Bind(&ActiveDownloadsHandler::HandlePauseToggleDownload, | 190 base::Bind(&ActiveDownloadsHandler::HandlePauseToggleDownload, |
191 base::Unretained(this))); | 191 base::Unretained(this))); |
192 web_ui()->RegisterMessageCallback("allowDownload", | 192 web_ui()->RegisterMessageCallback("allowDownload", |
193 base::Bind(&ActiveDownloadsHandler::HandleAllowDownload, | 193 base::Bind(&ActiveDownloadsHandler::HandleAllowDownload, |
194 base::Unretained(this))); | 194 base::Unretained(this))); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return (*it); | 391 return (*it); |
392 } | 392 } |
393 } | 393 } |
394 } | 394 } |
395 return NULL; | 395 return NULL; |
396 } | 396 } |
397 | 397 |
398 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { | 398 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { |
399 return handler_->downloads(); | 399 return handler_->downloads(); |
400 } | 400 } |
OLD | NEW |