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

Unified Diff: extensions/browser/requirements_checker.h

Issue 2783813002: Move ChromeRequirementsChecker to //extensions as a PreloadCheck (Closed)
Patch Set: SKIP: comments, tests Created 3 years, 9 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
Index: extensions/browser/requirements_checker.h
diff --git a/extensions/browser/requirements_checker.h b/extensions/browser/requirements_checker.h
index 8844157e1d8333afb84912180ff09496fa8e5ead..951e1e1684dddc898f96371c3f5b19de15cdd175 100644
--- a/extensions/browser/requirements_checker.h
+++ b/extensions/browser/requirements_checker.h
@@ -5,10 +5,14 @@
#ifndef EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_
#define EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_
-#include <vector>
-
-#include "base/callback.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "extensions/browser/preload_check.h"
+
+namespace content {
+class GpuFeatureChecker;
+}
namespace extensions {
class Extension;
@@ -17,20 +21,28 @@ class Extension;
// asynchronous process that involves several threads, but the public interface
// of this class (including constructor and destructor) must only be used on
// the UI thread.
-class RequirementsChecker {
+class RequirementsChecker : public PreloadCheck {
public:
- virtual ~RequirementsChecker() {}
-
- using RequirementsCheckedCallback =
- base::Callback<void(const std::vector<std::string>& /* requirements */)>;
-
- // The vector passed to the callback are any localized errors describing
- // requirement violations. If this vector is non-empty, requirements checking
- // failed. This should only be called once. |callback| will always be invoked
- // asynchronously on the UI thread. |callback| will only be called once, and
- // will be reset after called.
- virtual void Check(const scoped_refptr<const Extension>& extension,
- const RequirementsCheckedCallback& callback) = 0;
+ explicit RequirementsChecker(const Extension* extension);
+ ~RequirementsChecker() override;
+
+ // PreloadCheck:
+ void Start(ResultCallback callback) override;
+ // Joins multiple errors into a space-separated string.
+ base::string16 GetErrorMessage() const override;
+
+ private:
+ // Callback for the GpuFeatureChecker.
+ void OnGetWebGLAvailability(bool available);
+
+ scoped_refptr<content::GpuFeatureChecker> webgl_checker_;
+
+ ResultCallback callback_;
+ Errors errors_;
+
+ base::WeakPtrFactory<RequirementsChecker> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(RequirementsChecker);
};
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698