| 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 #ifndef CHROME_BROWSER_SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ | 6 #define CHROME_BROWSER_SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" |
| 11 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 12 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 15 | 16 |
| 16 namespace browser_sync { | 17 namespace browser_sync { |
| 17 | 18 |
| 18 // A class to monitor usage of extensions APIs to send to sync servers, with | 19 // A class to monitor usage of extensions APIs to send to sync servers, with |
| 19 // the ability to purge data once sync servers have acknowledged it (successful | 20 // the ability to purge data once sync servers have acknowledged it (successful |
| 20 // commit response). | 21 // commit response). |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // swapping. This is done mutually exclusively w.r.t methods of this class. | 53 // swapping. This is done mutually exclusively w.r.t methods of this class. |
| 53 void GetAndClearRecords(Records* buffer); | 54 void GetAndClearRecords(Records* buffer); |
| 54 | 55 |
| 55 // Add |records| piece-wise (by extension id) to the set of active records. | 56 // Add |records| piece-wise (by extension id) to the set of active records. |
| 56 // This is done mutually exclusively w.r.t the methods of this class. | 57 // This is done mutually exclusively w.r.t the methods of this class. |
| 57 void PutRecords(const Records& records); | 58 void PutRecords(const Records& records); |
| 58 | 59 |
| 59 // content::NotificationObserver implementation. Called on |ui_loop_|. | 60 // content::NotificationObserver implementation. Called on |ui_loop_|. |
| 60 virtual void Observe(int type, | 61 virtual void Observe(int type, |
| 61 const content::NotificationSource& source, | 62 const content::NotificationSource& source, |
| 62 const content::NotificationDetails& details); | 63 const content::NotificationDetails& details) OVERRIDE; |
| 63 private: | 64 private: |
| 64 Records records_; | 65 Records records_; |
| 65 mutable base::Lock records_lock_; | 66 mutable base::Lock records_lock_; |
| 66 | 67 |
| 67 // Used only from UI loop. | 68 // Used only from UI loop. |
| 68 content::NotificationRegistrar registrar_; | 69 content::NotificationRegistrar registrar_; |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 } // namespace browser_sync | 72 } // namespace browser_sync |
| 72 | 73 |
| 73 #endif // CHROME_BROWSER_SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ | 74 #endif // CHROME_BROWSER_SYNC_UTIL_EXTENSIONS_ACTIVITY_MONITOR_H_ |
| OLD | NEW |