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

Unified Diff: extensions/browser/requirements_checker.h

Issue 2740853002: Use PreloadCheckGroup in ExtensionInstallChecker. Make RequirementsChecker a PreloadCheck. (Closed)
Patch Set: 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
« no previous file with comments | « extensions/browser/preload_check_group.cc ('k') | extensions/browser/requirements_checker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/requirements_checker.h
diff --git a/extensions/browser/requirements_checker.h b/extensions/browser/requirements_checker.h
index 8844157e1d8333afb84912180ff09496fa8e5ead..13d2660c6d37619c1286fb821ca8aca49e69b11e 100644
--- a/extensions/browser/requirements_checker.h
+++ b/extensions/browser/requirements_checker.h
@@ -5,10 +5,17 @@
#ifndef EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_
#define EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_
+#include <memory>
#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 +24,30 @@ 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;
+ base::string16 GetErrorMessage() const override;
+
+ private:
+ // Callback for the GpuFeatureChecker.
+ void OnGetWebGLAvailability(bool available);
+
+ void RunCallback();
+
+ Errors errors_;
+
+ scoped_refptr<content::GpuFeatureChecker> webgl_checker_;
+
+ ResultCallback callback_;
+
+ base::WeakPtrFactory<RequirementsChecker> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(RequirementsChecker);
};
} // namespace extensions
« no previous file with comments | « extensions/browser/preload_check_group.cc ('k') | extensions/browser/requirements_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698