OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // requirement violations. If this vector is non-empty, requirements checking | 30 // requirement violations. If this vector is non-empty, requirements checking |
31 // failed. This should only be called once. |callback| will always be invoked | 31 // failed. This should only be called once. |callback| will always be invoked |
32 // asynchronously on the UI thread. |callback| will only be called once, and | 32 // asynchronously on the UI thread. |callback| will only be called once, and |
33 // will be reset after called. | 33 // will be reset after called. |
34 void Check(scoped_refptr<const Extension> extension, | 34 void Check(scoped_refptr<const Extension> extension, |
35 base::Callback<void(std::vector<std::string> requirement)> callback); | 35 base::Callback<void(std::vector<std::string> requirement)> callback); |
36 | 36 |
37 private: | 37 private: |
38 // Callbacks for the GPUFeatureChecker. | 38 // Callbacks for the GPUFeatureChecker. |
39 void SetWebGLAvailability(bool available); | 39 void SetWebGLAvailability(bool available); |
40 void SetCSS3DAvailability(bool available); | |
41 | 40 |
42 void MaybeRunCallback(); | 41 void MaybeRunCallback(); |
43 | 42 |
44 std::vector<std::string> errors_; | 43 std::vector<std::string> errors_; |
45 | 44 |
46 // Every requirement that needs to be resolved asynchronously will add to | 45 // Every requirement that needs to be resolved asynchronously will add to |
47 // this counter. When the counter is depleted, the callback will be run. | 46 // this counter. When the counter is depleted, the callback will be run. |
48 int pending_requirement_checks_; | 47 int pending_requirement_checks_; |
49 | 48 |
50 scoped_refptr<GPUFeatureChecker> webgl_checker_; | 49 scoped_refptr<GPUFeatureChecker> webgl_checker_; |
51 scoped_refptr<GPUFeatureChecker> css3d_checker_; | |
52 | 50 |
53 base::Callback<void(std::vector<std::string> requirement_errorss)> callback_; | 51 base::Callback<void(std::vector<std::string> requirement_errorss)> callback_; |
54 }; | 52 }; |
55 | 53 |
56 } // namespace extensions | 54 } // namespace extensions |
57 | 55 |
58 #endif // CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ | 56 #endif // CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ |
OLD | NEW |