| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 registrar_.Add(this, NotificationType::TOP_SITES_UPDATED, | 1450 registrar_.Add(this, NotificationType::TOP_SITES_UPDATED, |
| 1451 Source<history::TopSites>(top_sites_)); | 1451 Source<history::TopSites>(top_sites_)); |
| 1452 if (top_sites_->loaded()) { | 1452 if (top_sites_->loaded()) { |
| 1453 OnTopSitesLoaded(); | 1453 OnTopSitesLoaded(); |
| 1454 } else { | 1454 } else { |
| 1455 registrar_.Add(this, NotificationType::TOP_SITES_LOADED, | 1455 registrar_.Add(this, NotificationType::TOP_SITES_LOADED, |
| 1456 Source<Profile>(automation_->profile())); | 1456 Source<Profile>(automation_->profile())); |
| 1457 } | 1457 } |
| 1458 } | 1458 } |
| 1459 | 1459 |
| 1460 NTPInfoObserver::~NTPInfoObserver() {} |
| 1461 |
| 1460 void NTPInfoObserver::Observe(NotificationType type, | 1462 void NTPInfoObserver::Observe(NotificationType type, |
| 1461 const NotificationSource& source, | 1463 const NotificationSource& source, |
| 1462 const NotificationDetails& details) { | 1464 const NotificationDetails& details) { |
| 1463 if (type == NotificationType::TOP_SITES_LOADED) { | 1465 if (type == NotificationType::TOP_SITES_LOADED) { |
| 1464 OnTopSitesLoaded(); | 1466 OnTopSitesLoaded(); |
| 1465 } else if (type == NotificationType::TOP_SITES_UPDATED) { | 1467 } else if (type == NotificationType::TOP_SITES_UPDATED) { |
| 1466 Details<CancelableRequestProvider::Handle> request_details(details); | 1468 Details<CancelableRequestProvider::Handle> request_details(details); |
| 1467 if (request_ == *request_details.ptr()) { | 1469 if (request_ == *request_details.ptr()) { |
| 1468 top_sites_->GetMostVisitedURLs( | 1470 top_sites_->GetMostVisitedURLs( |
| 1469 consumer_, | 1471 consumer_, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 this, &OnNotificationBalloonCountObserver::OnBalloonCollectionChanged)); | 1530 this, &OnNotificationBalloonCountObserver::OnBalloonCollectionChanged)); |
| 1529 } | 1531 } |
| 1530 | 1532 |
| 1531 void OnNotificationBalloonCountObserver::OnBalloonCollectionChanged() { | 1533 void OnNotificationBalloonCountObserver::OnBalloonCollectionChanged() { |
| 1532 if (static_cast<int>(collection_->GetActiveBalloons().size()) == count_) { | 1534 if (static_cast<int>(collection_->GetActiveBalloons().size()) == count_) { |
| 1533 collection_->set_on_collection_changed_callback(NULL); | 1535 collection_->set_on_collection_changed_callback(NULL); |
| 1534 reply_.SendSuccess(NULL); | 1536 reply_.SendSuccess(NULL); |
| 1535 delete this; | 1537 delete this; |
| 1536 } | 1538 } |
| 1537 } | 1539 } |
| OLD | NEW |