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/download/download_completion_observer_win.h" | 5 #include "chrome/browser/download/download_completion_observer_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 L"", | 76 L"", |
77 notification_id.c_str()); | 77 notification_id.c_str()); |
78 } | 78 } |
79 } | 79 } |
80 DCHECK(ContainsKey(download_items_, download)); | 80 DCHECK(ContainsKey(download_items_, download)); |
81 download_items_.erase(download); | 81 download_items_.erase(download); |
82 download->RemoveObserver(this); | 82 download->RemoveObserver(this); |
83 break; | 83 break; |
84 } | 84 } |
85 | 85 |
86 case DownloadItem::REMOVING: | |
87 case DownloadItem::INTERRUPTED: | 86 case DownloadItem::INTERRUPTED: |
88 case DownloadItem::CANCELLED: { | 87 case DownloadItem::CANCELLED: { |
89 DCHECK(ContainsKey(download_items_, download)); | 88 DCHECK(ContainsKey(download_items_, download)); |
90 download_items_.erase(download); | 89 download_items_.erase(download); |
91 download->RemoveObserver(this); | 90 download->RemoveObserver(this); |
92 break; | 91 break; |
93 } | 92 } |
94 | 93 |
95 default: | 94 default: |
96 break; | 95 break; |
97 } | 96 } |
98 } | 97 } |
99 | 98 |
| 99 void DownloadCompletionObserver::OnDownloadDestroyed(DownloadItem* download) { |
| 100 DCHECK(ContainsKey(download_items_, download)); |
| 101 download_items_.erase(download); |
| 102 download->RemoveObserver(this); |
| 103 } |
| 104 |
100 void DownloadCompletionObserver::ClearDownloadItems() { | 105 void DownloadCompletionObserver::ClearDownloadItems() { |
101 for (std::set<DownloadItem*>::iterator it = download_items_.begin(); | 106 for (std::set<DownloadItem*>::iterator it = download_items_.begin(); |
102 it != download_items_.end(); ++it) { | 107 it != download_items_.end(); ++it) { |
103 (*it)->RemoveObserver(this); | 108 (*it)->RemoveObserver(this); |
104 } | 109 } |
105 download_items_.clear(); | 110 download_items_.clear(); |
106 } | 111 } |
OLD | NEW |