Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / extensions / browser / warning_service.h
index f675e1f..5aa9a50 100644 (file)
@@ -12,6 +12,7 @@
 #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"
 
@@ -31,7 +32,8 @@ class ExtensionRegistry;
 // 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 {
@@ -42,7 +44,11 @@ class WarningService : public ExtensionRegistryObserver,
   // |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.
@@ -72,10 +78,9 @@ class WarningService : public ExtensionRegistryObserver,
   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_;