| 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/automation/automation_provider_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 download_manager_->AddObserver(this); // Will call initial ModelChanged(). | 1429 download_manager_->AddObserver(this); // Will call initial ModelChanged(). |
| 1430 } | 1430 } |
| 1431 | 1431 |
| 1432 AllDownloadsCompleteObserver::~AllDownloadsCompleteObserver() {} | 1432 AllDownloadsCompleteObserver::~AllDownloadsCompleteObserver() {} |
| 1433 | 1433 |
| 1434 void AllDownloadsCompleteObserver::ModelChanged(DownloadManager* manager) { | 1434 void AllDownloadsCompleteObserver::ModelChanged(DownloadManager* manager) { |
| 1435 DCHECK_EQ(manager, download_manager_); | 1435 DCHECK_EQ(manager, download_manager_); |
| 1436 // The set of downloads in the download manager has changed. If there are | 1436 // The set of downloads in the download manager has changed. If there are |
| 1437 // any new downloads that are still in progress, add them to the pending list. | 1437 // any new downloads that are still in progress, add them to the pending list. |
| 1438 std::vector<DownloadItem*> downloads; | 1438 std::vector<DownloadItem*> downloads; |
| 1439 download_manager_->GetAllDownloads(FilePath(), &downloads); | 1439 download_manager_->GetAllDownloads(&downloads); |
| 1440 for (std::vector<DownloadItem*>::iterator it = downloads.begin(); | 1440 for (std::vector<DownloadItem*>::iterator it = downloads.begin(); |
| 1441 it != downloads.end(); ++it) { | 1441 it != downloads.end(); ++it) { |
| 1442 if ((*it)->GetState() == DownloadItem::IN_PROGRESS && | 1442 if ((*it)->GetState() == DownloadItem::IN_PROGRESS && |
| 1443 pre_download_ids_.find((*it)->GetId()) == pre_download_ids_.end()) { | 1443 pre_download_ids_.find((*it)->GetId()) == pre_download_ids_.end()) { |
| 1444 (*it)->AddObserver(this); | 1444 (*it)->AddObserver(this); |
| 1445 pending_downloads_.insert(*it); | 1445 pending_downloads_.insert(*it); |
| 1446 } | 1446 } |
| 1447 } | 1447 } |
| 1448 ReplyIfNecessary(); | 1448 ReplyIfNecessary(); |
| 1449 } | 1449 } |
| (...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2857 if (automation_) { | 2857 if (automation_) { |
| 2858 AutomationJSONReply(automation_, reply_message_.release()) | 2858 AutomationJSONReply(automation_, reply_message_.release()) |
| 2859 .SendSuccess(NULL); | 2859 .SendSuccess(NULL); |
| 2860 } | 2860 } |
| 2861 delete this; | 2861 delete this; |
| 2862 } | 2862 } |
| 2863 } else { | 2863 } else { |
| 2864 NOTREACHED(); | 2864 NOTREACHED(); |
| 2865 } | 2865 } |
| 2866 } | 2866 } |
| OLD | NEW |