| 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/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 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 AutomationProviderDownloadItemObserver:: | 1450 AutomationProviderDownloadItemObserver:: |
| 1451 ~AutomationProviderDownloadItemObserver() {} | 1451 ~AutomationProviderDownloadItemObserver() {} |
| 1452 | 1452 |
| 1453 void AutomationProviderDownloadItemObserver::OnDownloadUpdated( | 1453 void AutomationProviderDownloadItemObserver::OnDownloadUpdated( |
| 1454 DownloadItem* download) { | 1454 DownloadItem* download) { |
| 1455 interrupted_ |= download->IsInterrupted(); | 1455 interrupted_ |= download->IsInterrupted(); |
| 1456 // If any download was interrupted, on the next update each outstanding | 1456 // If any download was interrupted, on the next update each outstanding |
| 1457 // download is cancelled. | 1457 // download is cancelled. |
| 1458 if (interrupted_) { | 1458 if (interrupted_) { |
| 1459 // |Cancel()| does nothing if |download| is already interrupted. | 1459 // |Cancel()| does nothing if |download| is already interrupted. |
| 1460 download->Cancel(true); | 1460 download->Cancel(); |
| 1461 RemoveAndCleanupOnLastEntry(download); | 1461 RemoveAndCleanupOnLastEntry(download); |
| 1462 } | 1462 } |
| 1463 | 1463 |
| 1464 if (download->IsComplete()) | 1464 if (download->IsComplete()) |
| 1465 RemoveAndCleanupOnLastEntry(download); | 1465 RemoveAndCleanupOnLastEntry(download); |
| 1466 } | 1466 } |
| 1467 | 1467 |
| 1468 // We don't want to send multiple messages, as the behavior is undefined. | 1468 // We don't want to send multiple messages, as the behavior is undefined. |
| 1469 // Set |interrupted_| on error, and on the last download completed/ | 1469 // Set |interrupted_| on error, and on the last download completed/ |
| 1470 // interrupted, send either an error or a success message. | 1470 // interrupted, send either an error or a success message. |
| (...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2587 void DragTargetDropAckNotificationObserver::Observe( | 2587 void DragTargetDropAckNotificationObserver::Observe( |
| 2588 NotificationType type, | 2588 NotificationType type, |
| 2589 const NotificationSource& source, | 2589 const NotificationSource& source, |
| 2590 const NotificationDetails& details) { | 2590 const NotificationDetails& details) { |
| 2591 if (automation_) { | 2591 if (automation_) { |
| 2592 AutomationJSONReply(automation_, | 2592 AutomationJSONReply(automation_, |
| 2593 reply_message_.release()).SendSuccess(NULL); | 2593 reply_message_.release()).SendSuccess(NULL); |
| 2594 } | 2594 } |
| 2595 delete this; | 2595 delete this; |
| 2596 } | 2596 } |
| OLD | NEW |