| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sync/glue/extensions_activity_monitor.h" | 5 #include "chrome/browser/sync/glue/extensions_activity_monitor.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" | 9 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 11 #include "content/public/browser/notification_service.h" | 11 #include "content/public/browser/notification_service.h" |
| 12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
| 13 #include "sync/util/extensions_activity.h" | 13 #include "sync/util/extensions_activity.h" |
| 14 | 14 |
| 15 using content::BrowserThread; | 15 using content::BrowserThread; |
| 16 | 16 |
| 17 namespace browser_sync { | 17 namespace browser_sync { |
| 18 | 18 |
| 19 ExtensionsActivityMonitor::ExtensionsActivityMonitor() | 19 ExtensionsActivityMonitor::ExtensionsActivityMonitor() |
| 20 : extensions_activity_(new syncer::ExtensionsActivity()) { | 20 : extensions_activity_(new syncer::ExtensionsActivity()) { |
| 21 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 21 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 22 // It would be nice if we could specify a Source for each specific function | 22 // It would be nice if we could specify a Source for each specific function |
| 23 // we wanted to observe, but the actual function objects are allocated on | 23 // we wanted to observe, but the actual function objects are allocated on |
| 24 // the fly so there is no reliable object to point to (same problem if we | 24 // the fly so there is no reliable object to point to (same problem if we |
| 25 // wanted to use the string name). Thus, we use all sources and filter in | 25 // wanted to use the string name). Thus, we use all sources and filter in |
| 26 // Observe. | 26 // Observe. |
| 27 registrar_.Add(this, | 27 registrar_.Add(this, |
| 28 chrome::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, | 28 extensions::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, |
| 29 content::NotificationService::AllSources()); | 29 content::NotificationService::AllSources()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 ExtensionsActivityMonitor::~ExtensionsActivityMonitor() { | 32 ExtensionsActivityMonitor::~ExtensionsActivityMonitor() { |
| 33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void ExtensionsActivityMonitor::Observe( | 36 void ExtensionsActivityMonitor::Observe( |
| 37 int type, | 37 int type, |
| 38 const content::NotificationSource& source, | 38 const content::NotificationSource& source, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 50 extensions_activity_->UpdateRecord(extension->id()); | 50 extensions_activity_->UpdateRecord(extension->id()); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 const scoped_refptr<syncer::ExtensionsActivity>& | 54 const scoped_refptr<syncer::ExtensionsActivity>& |
| 55 ExtensionsActivityMonitor::GetExtensionsActivity() { | 55 ExtensionsActivityMonitor::GetExtensionsActivity() { |
| 56 return extensions_activity_; | 56 return extensions_activity_; |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace browser_sync | 59 } // namespace browser_sync |
| OLD | NEW |