| 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 COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_SHUTDOWN_NOTIFIER_H_ | 5 #ifndef COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_SHUTDOWN_NOTIFIER_H_ |
| 6 #define COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_SHUTDOWN_NOTIFIER_H_ | 6 #define COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_SHUTDOWN_NOTIFIER_H_ |
| 7 | 7 |
| 8 #include "base/callback_list.h" | 8 #include "base/callback_list.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/keyed_service/core/keyed_service.h" | 11 #include "components/keyed_service/core/keyed_service.h" |
| 11 | 12 |
| 12 // This is a helper class for objects that depend on one or more keyed services, | 13 // This is a helper class for objects that depend on one or more keyed services, |
| 13 // but which cannot be keyed services themselves, for example because they don't | 14 // but which cannot be keyed services themselves, for example because they don't |
| 14 // correspond 1:1 to a context, or because they have a different lifetime. | 15 // correspond 1:1 to a context, or because they have a different lifetime. |
| 15 // | 16 // |
| 16 // To use this class, add a factory class and declare the dependencies there. | 17 // To use this class, add a factory class and declare the dependencies there. |
| 17 // This class (being a KeyedService itself) will be shut down before its | 18 // This class (being a KeyedService itself) will be shut down before its |
| 18 // dependencies and notify its observers. | 19 // dependencies and notify its observers. |
| 19 class KEYED_SERVICE_EXPORT KeyedServiceShutdownNotifier : public KeyedService { | 20 class KEYED_SERVICE_EXPORT KeyedServiceShutdownNotifier : public KeyedService { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 31 private: | 32 private: |
| 32 // KeyedService implementation: | 33 // KeyedService implementation: |
| 33 void Shutdown() override; | 34 void Shutdown() override; |
| 34 | 35 |
| 35 base::CallbackList<void()> callback_list_; | 36 base::CallbackList<void()> callback_list_; |
| 36 | 37 |
| 37 DISALLOW_COPY_AND_ASSIGN(KeyedServiceShutdownNotifier); | 38 DISALLOW_COPY_AND_ASSIGN(KeyedServiceShutdownNotifier); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 #endif // COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_SHUTDOWN_NOTIFIER_H_ | 41 #endif // COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_SHUTDOWN_NOTIFIER_H_ |
| OLD | NEW |