OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Given a HandleId |handle_id|, return a new handle for the same | 89 // Given a HandleId |handle_id|, return a new handle for the same |
90 // registration. | 90 // registration. |
91 scoped_ptr<BackgroundSyncRegistrationHandle> DuplicateRegistrationHandle( | 91 scoped_ptr<BackgroundSyncRegistrationHandle> DuplicateRegistrationHandle( |
92 BackgroundSyncRegistrationHandle::HandleId handle_id); | 92 BackgroundSyncRegistrationHandle::HandleId handle_id); |
93 | 93 |
94 // ServiceWorkerContextObserver overrides. | 94 // ServiceWorkerContextObserver overrides. |
95 void OnRegistrationDeleted(int64 registration_id, | 95 void OnRegistrationDeleted(int64 registration_id, |
96 const GURL& pattern) override; | 96 const GURL& pattern) override; |
97 void OnStorageWiped() override; | 97 void OnStorageWiped() override; |
98 | 98 |
| 99 BackgroundSyncNetworkObserver* GetNetworkObserverForTesting() { |
| 100 return network_observer_.get(); |
| 101 } |
| 102 |
99 protected: | 103 protected: |
100 // A registration might be referenced by the client longer than | 104 // A registration might be referenced by the client longer than |
101 // the BackgroundSyncManager needs to keep track of it (e.g., the event has | 105 // the BackgroundSyncManager needs to keep track of it (e.g., the event has |
102 // finished firing). The BackgroundSyncManager reference counts its | 106 // finished firing). The BackgroundSyncManager reference counts its |
103 // registrations internally and every BackgroundSyncRegistrationHandle has a | 107 // registrations internally and every BackgroundSyncRegistrationHandle has a |
104 // unique handle id which maps to a locally maintained (in | 108 // unique handle id which maps to a locally maintained (in |
105 // client_registration_ids_) scoped_refptr. | 109 // client_registration_ids_) scoped_refptr. |
106 class RefCountedRegistration; | 110 class RefCountedRegistration; |
107 | 111 |
108 explicit BackgroundSyncManager( | 112 explicit BackgroundSyncManager( |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 registration_handle_ids_; | 343 registration_handle_ids_; |
340 | 344 |
341 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; | 345 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; |
342 | 346 |
343 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); | 347 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); |
344 }; | 348 }; |
345 | 349 |
346 } // namespace content | 350 } // namespace content |
347 | 351 |
348 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 352 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
OLD | NEW |