#include "base/observer_list.h"
#include "base/scoped_observer.h"
#include "base/threading/non_thread_safe.h"
+#include "components/keyed_service/core/keyed_service.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/browser/warning_set.h"
// conflicting modifications of network requests by extensions, slow extensions,
// etc.) trigger a warning badge in the UI and and provide means to resolve
// them. This class must be used on the UI thread only.
-class WarningService : public ExtensionRegistryObserver,
+class WarningService : public KeyedService,
+ public ExtensionRegistryObserver,
public base::NonThreadSafe {
public:
class Observer {
// |browser_context| may be NULL for testing. In this case, be sure to not
// insert any warnings.
explicit WarningService(content::BrowserContext* browser_context);
- virtual ~WarningService();
+ ~WarningService() override;
+
+ // Get the instance of the WarningService for |browser_context|.
+ // Redirected in incognito.
+ static WarningService* Get(content::BrowserContext* browser_context);
// Clears all warnings of types contained in |types| and notifies observers
// of the changed warnings.
void NotifyWarningsChanged();
// ExtensionRegistryObserver implementation.
- virtual void OnExtensionUnloaded(content::BrowserContext* browser_context,
- const Extension* extension,
- UnloadedExtensionInfo::Reason reason)
- OVERRIDE;
+ void OnExtensionUnloaded(content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) override;
// Currently existing warnings.
WarningSet warnings_;