Chromium Code Reviews| Index: chrome/browser/extensions/requirements_checker.h |
| diff --git a/chrome/browser/extensions/requirements_checker.h b/chrome/browser/extensions/requirements_checker.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e37bc825545128d3470a3186c0b7b863dd87f5d4 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/requirements_checker.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "chrome/browser/extensions/extension_service.h" |
| + |
| +class GPUFeatureChecker; |
| + |
| +namespace extensions { |
| +class Extension; |
| + |
| +// This class lives on the UI thread. This includes any calls to AsWeakPtr(). |
|
Aaron Boodman
2012/08/21 23:04:21
extra space after "UI"
Aaron Boodman
2012/08/21 23:04:21
Validates the 'requirements' extension manifest fi
eaugusti
2012/08/24 19:30:52
Done.
|
| +class RequirementsChecker : public base::SupportsWeakPtr<RequirementsChecker> { |
| + public: |
| + RequirementsChecker(); |
| + ~RequirementsChecker(); |
| + |
| + // 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. |
| + void Check(scoped_refptr<const Extension> extension, |
| + base::Callback<void(std::vector<std::string>)> callback); |
| + |
| + private: |
| + // Callbacks for the GPUFeatureChecker. |
| + void SetWebGLAvailability(bool available); |
| + void SetCSS3DAvailability(bool available); |
| + |
| + void MaybeRunCallback(); |
| + |
| + std::vector<std::string> errors_; |
| + |
| + // Every requirement that needs to be resolved asynchronously will add to |
| + // this counter. When the counter is depleted, the callback will be run. |
| + int pending_requirement_checks_; |
| + |
| + scoped_refptr<GPUFeatureChecker> webgl_checker_; |
| + scoped_refptr<GPUFeatureChecker> css3d_checker_; |
| + |
| + base::Callback<void(std::vector<std::string>)> callback_; |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ |