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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // Given a HandleId |handle_id|, return a new handle for the same | 92 // Given a HandleId |handle_id|, return a new handle for the same |
93 // registration. | 93 // registration. |
94 scoped_ptr<BackgroundSyncRegistrationHandle> DuplicateRegistrationHandle( | 94 scoped_ptr<BackgroundSyncRegistrationHandle> DuplicateRegistrationHandle( |
95 BackgroundSyncRegistrationHandle::HandleId handle_id); | 95 BackgroundSyncRegistrationHandle::HandleId handle_id); |
96 | 96 |
97 // ServiceWorkerContextObserver overrides. | 97 // ServiceWorkerContextObserver overrides. |
98 void OnRegistrationDeleted(int64 sw_registration_id, | 98 void OnRegistrationDeleted(int64 sw_registration_id, |
99 const GURL& pattern) override; | 99 const GURL& pattern) override; |
100 void OnStorageWiped() override; | 100 void OnStorageWiped() override; |
101 | 101 |
| 102 BackgroundSyncNetworkObserver* GetNetworkObserverForTesting() { |
| 103 return network_observer_.get(); |
| 104 } |
| 105 |
102 protected: | 106 protected: |
103 // A registration might be referenced by the client longer than | 107 // A registration might be referenced by the client longer than |
104 // the BackgroundSyncManager needs to keep track of it (e.g., the event has | 108 // the BackgroundSyncManager needs to keep track of it (e.g., the event has |
105 // finished firing). The BackgroundSyncManager reference counts its | 109 // finished firing). The BackgroundSyncManager reference counts its |
106 // registrations internally and every BackgroundSyncRegistrationHandle has a | 110 // registrations internally and every BackgroundSyncRegistrationHandle has a |
107 // unique handle id which maps to a locally maintained (in | 111 // unique handle id which maps to a locally maintained (in |
108 // client_registration_ids_) scoped_refptr. | 112 // client_registration_ids_) scoped_refptr. |
109 class RefCountedRegistration; | 113 class RefCountedRegistration; |
110 | 114 |
111 explicit BackgroundSyncManager( | 115 explicit BackgroundSyncManager( |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 BackgroundSyncRegistrationHandle::HandleId> registration_handle_ids_; | 360 BackgroundSyncRegistrationHandle::HandleId> registration_handle_ids_; |
357 | 361 |
358 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; | 362 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; |
359 | 363 |
360 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); | 364 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); |
361 }; | 365 }; |
362 | 366 |
363 } // namespace content | 367 } // namespace content |
364 | 368 |
365 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 369 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
OLD | NEW |