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