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/filebrowse_ui.h" | 5 #include "chrome/browser/dom_ui/filebrowse_ui.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 const std::string& path); | 119 const std::string& path); |
120 #endif | 120 #endif |
121 | 121 |
122 // DownloadItem::Observer interface | 122 // DownloadItem::Observer interface |
123 virtual void OnDownloadUpdated(DownloadItem* download); | 123 virtual void OnDownloadUpdated(DownloadItem* download); |
124 virtual void OnDownloadFileCompleted(DownloadItem* download) { } | 124 virtual void OnDownloadFileCompleted(DownloadItem* download) { } |
125 virtual void OnDownloadOpened(DownloadItem* download) { } | 125 virtual void OnDownloadOpened(DownloadItem* download) { } |
126 | 126 |
127 // DownloadManager::Observer interface | 127 // DownloadManager::Observer interface |
128 virtual void ModelChanged(); | 128 virtual void ModelChanged(); |
129 virtual void SetDownloads(std::vector<DownloadItem*>& downloads); | 129 |
| 130 void OnSearchDownloadsComplete(std::vector<DownloadItem*> downloads); |
130 | 131 |
131 // Callback for the "getRoots" message. | 132 // Callback for the "getRoots" message. |
132 void HandleGetRoots(const Value* value); | 133 void HandleGetRoots(const Value* value); |
133 | 134 |
134 void GetChildrenForPath(FilePath& path, bool is_refresh); | 135 void GetChildrenForPath(FilePath& path, bool is_refresh); |
135 | 136 |
136 void OnURLFetchComplete(const URLFetcher* source, | 137 void OnURLFetchComplete(const URLFetcher* source, |
137 const GURL& url, | 138 const GURL& url, |
138 const URLRequestStatus& status, | 139 const URLRequestStatus& status, |
139 int response_code, | 140 int response_code, |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 | 963 |
963 void FilebrowseHandler::HandleGetDownloads(const Value* value) { | 964 void FilebrowseHandler::HandleGetDownloads(const Value* value) { |
964 ModelChanged(); | 965 ModelChanged(); |
965 } | 966 } |
966 | 967 |
967 void FilebrowseHandler::ModelChanged() { | 968 void FilebrowseHandler::ModelChanged() { |
968 ClearDownloadItems(); | 969 ClearDownloadItems(); |
969 download_manager_->GetAllDownloads(this, FilePath()); | 970 download_manager_->GetAllDownloads(this, FilePath()); |
970 } | 971 } |
971 | 972 |
972 void FilebrowseHandler::SetDownloads(std::vector<DownloadItem*>& downloads) { | 973 void FilebrowseHandler::OnSearchDownloadsComplete( |
| 974 std::vector<DownloadItem*> downloads) { |
973 ClearDownloadItems(); | 975 ClearDownloadItems(); |
974 std::vector<DownloadItem*> new_downloads; | 976 std::vector<DownloadItem*> new_downloads; |
975 // Scan for any in progress downloads and add ourself to them as an observer. | 977 // Scan for any in progress downloads and add ourself to them as an observer. |
976 for (DownloadList::iterator it = downloads.begin(); | 978 for (DownloadList::iterator it = downloads.begin(); |
977 it != downloads.end(); ++it) { | 979 it != downloads.end(); ++it) { |
978 DownloadItem* download = *it; | 980 DownloadItem* download = *it; |
979 // We want to know what happens as the download progresses and be notified | 981 // We want to know what happens as the download progresses and be notified |
980 // when the user validates the dangerous download. | 982 // when the user validates the dangerous download. |
981 if (download->state() == DownloadItem::IN_PROGRESS || | 983 if (download->state() == DownloadItem::IN_PROGRESS || |
982 download->safety_state() == DownloadItem::DANGEROUS) { | 984 download->safety_state() == DownloadItem::DANGEROUS) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 } | 1153 } |
1152 } | 1154 } |
1153 | 1155 |
1154 return NULL; | 1156 return NULL; |
1155 } | 1157 } |
1156 | 1158 |
1157 const int FileBrowseUI::kPopupWidth = 250; | 1159 const int FileBrowseUI::kPopupWidth = 250; |
1158 const int FileBrowseUI::kPopupHeight = 300; | 1160 const int FileBrowseUI::kPopupHeight = 300; |
1159 const int FileBrowseUI::kSmallPopupWidth = 250; | 1161 const int FileBrowseUI::kSmallPopupWidth = 250; |
1160 const int FileBrowseUI::kSmallPopupHeight = 50; | 1162 const int FileBrowseUI::kSmallPopupHeight = 50; |
OLD | NEW |