| OLD | NEW |
| 1 // Copyright (c) 2010 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 : target_count_(target_count), | 689 : target_count_(target_count), |
| 690 automation_(automation), | 690 automation_(automation), |
| 691 reply_message_(reply_message) { | 691 reply_message_(reply_message) { |
| 692 registrar_.Add(this, NotificationType::BROWSER_OPENED, | 692 registrar_.Add(this, NotificationType::BROWSER_OPENED, |
| 693 NotificationService::AllSources()); | 693 NotificationService::AllSources()); |
| 694 registrar_.Add(this, NotificationType::BROWSER_CLOSED, | 694 registrar_.Add(this, NotificationType::BROWSER_CLOSED, |
| 695 NotificationService::AllSources()); | 695 NotificationService::AllSources()); |
| 696 } | 696 } |
| 697 | 697 |
| 698 void BrowserCountChangeNotificationObserver::Observe( | 698 void BrowserCountChangeNotificationObserver::Observe( |
| 699 NotificationType type, const NotificationSource& source, | 699 NotificationType type, |
| 700 const NotificationSource& source, |
| 700 const NotificationDetails& details) { | 701 const NotificationDetails& details) { |
| 701 DCHECK(type == NotificationType::BROWSER_OPENED || | 702 DCHECK(type == NotificationType::BROWSER_OPENED || |
| 702 type == NotificationType::BROWSER_CLOSED); | 703 type == NotificationType::BROWSER_CLOSED); |
| 703 int current_count = static_cast<int>(BrowserList::size()); | 704 int current_count = static_cast<int>(BrowserList::size()); |
| 704 if (type == NotificationType::BROWSER_CLOSED) { | 705 if (type == NotificationType::BROWSER_CLOSED) { |
| 705 // At the time of the notification the browser being closed is not removed | 706 // At the time of the notification the browser being closed is not removed |
| 706 // from the list. The real count is one less than the reported count. | 707 // from the list. The real count is one less than the reported count. |
| 707 DCHECK_LT(0, current_count); | 708 DCHECK_LT(0, current_count); |
| 708 current_count--; | 709 current_count--; |
| 709 } | 710 } |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 NotificationService::AllSources()); | 1632 NotificationService::AllSources()); |
| 1632 } | 1633 } |
| 1633 | 1634 |
| 1634 void RendererProcessClosedObserver::Observe( | 1635 void RendererProcessClosedObserver::Observe( |
| 1635 NotificationType type, | 1636 NotificationType type, |
| 1636 const NotificationSource& source, | 1637 const NotificationSource& source, |
| 1637 const NotificationDetails& details) { | 1638 const NotificationDetails& details) { |
| 1638 AutomationJSONReply(automation_, reply_message_).SendSuccess(NULL); | 1639 AutomationJSONReply(automation_, reply_message_).SendSuccess(NULL); |
| 1639 delete this; | 1640 delete this; |
| 1640 } | 1641 } |
| OLD | NEW |