Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2008)

Unified Diff: extensions/browser/warning_service.h

Issue 503033002: Move ExtensionWarningService and ExtensionsWarningSet to extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@3_web_view_internal
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/mock_extension_system.cc ('k') | extensions/browser/warning_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/warning_service.h
diff --git a/chrome/browser/extensions/extension_warning_service.h b/extensions/browser/warning_service.h
similarity index 64%
rename from chrome/browser/extensions/extension_warning_service.h
rename to extensions/browser/warning_service.h
index c311859dd9202764241591b74d46b96b262fb9de..f675e1f469ed9dacf311eaf44e02dc1b5356c885 100644
--- a/chrome/browser/extensions/extension_warning_service.h
+++ b/extensions/browser/warning_service.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_SERVICE_H_
-#define CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_SERVICE_H_
+#ifndef EXTENSIONS_BROWSER_WARNING_SERVICE_H_
+#define EXTENSIONS_BROWSER_WARNING_SERVICE_H_
#include <set>
#include <string>
@@ -12,14 +12,13 @@
#include "base/observer_list.h"
#include "base/scoped_observer.h"
#include "base/threading/non_thread_safe.h"
-#include "chrome/browser/extensions/extension_warning_set.h"
#include "extensions/browser/extension_registry_observer.h"
+#include "extensions/browser/warning_set.h"
// TODO(battre) Remove the Extension prefix.
-class Profile;
-
namespace content {
+class BrowserContext;
class NotificationDetails;
class NotificationSource;
}
@@ -32,40 +31,39 @@ 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 ExtensionWarningService : public ExtensionRegistryObserver,
- public base::NonThreadSafe {
+class WarningService : public ExtensionRegistryObserver,
+ public base::NonThreadSafe {
public:
class Observer {
public:
virtual void ExtensionWarningsChanged() = 0;
};
- // |profile| may be NULL for testing. In this case, be sure to not insert
- // any warnings.
- explicit ExtensionWarningService(Profile* profile);
- virtual ~ExtensionWarningService();
+ // |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();
// Clears all warnings of types contained in |types| and notifies observers
// of the changed warnings.
- void ClearWarnings(const std::set<ExtensionWarning::WarningType>& types);
+ void ClearWarnings(const std::set<Warning::WarningType>& types);
// Returns all types of warnings effecting extension |extension_id|.
- std::set<ExtensionWarning::WarningType> GetWarningTypesAffectingExtension(
+ std::set<Warning::WarningType> GetWarningTypesAffectingExtension(
const std::string& extension_id) const;
// Returns all localized warnings for extension |extension_id| in |result|.
std::vector<std::string> GetWarningMessagesForExtension(
const std::string& extension_id) const;
- const ExtensionWarningSet& warnings() const { return warnings_; }
+ const WarningSet& warnings() const { return warnings_; }
// Adds a set of warnings and notifies observers if any warning is new.
- void AddWarnings(const ExtensionWarningSet& warnings);
+ void AddWarnings(const WarningSet& warnings);
- // Notifies the ExtensionWarningService of profile |profile_id| that new
- // |warnings| occurred and triggers a warning badge.
- static void NotifyWarningsOnUI(void* profile_id,
- const ExtensionWarningSet& warnings);
+ // Notifies the WarningService of browser_context |browser_context_id| that
+ // new |warnings| occurred and triggers a warning badge.
+ static void NotifyWarningsOnUI(void* profile_id, const WarningSet& warnings);
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
@@ -80,9 +78,9 @@ class ExtensionWarningService : public ExtensionRegistryObserver,
OVERRIDE;
// Currently existing warnings.
- ExtensionWarningSet warnings_;
+ WarningSet warnings_;
- Profile* profile_;
+ content::BrowserContext* const browser_context_;
// Listen to extension unloaded notifications.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
@@ -93,4 +91,4 @@ class ExtensionWarningService : public ExtensionRegistryObserver,
} // namespace extensions
-#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_SERVICE_H_
+#endif // EXTENSIONS_BROWSER_WARNING_SERVICE_H_
« no previous file with comments | « extensions/browser/mock_extension_system.cc ('k') | extensions/browser/warning_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698