OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/callback.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/memory/weak_ptr.h" | |
13 #include "chrome/browser/extensions/extension_service.h" | |
14 | |
15 class GPUFeatureChecker; | |
16 | |
17 namespace extensions { | |
18 class Extension; | |
19 | |
20 // 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.
| |
21 class RequirementsChecker : public base::SupportsWeakPtr<RequirementsChecker> { | |
22 public: | |
23 RequirementsChecker(); | |
24 ~RequirementsChecker(); | |
25 | |
26 // The vector passed to the callback are any localized errors describing | |
27 // requirement violations. If this vector is non-empty, requirements checking | |
28 // failed. This should only be called once. |callback| will always be invoked | |
29 // asynchronously on the UI thread. | |
30 void Check(scoped_refptr<const Extension> extension, | |
31 base::Callback<void(std::vector<std::string>)> callback); | |
32 | |
33 private: | |
34 // Callbacks for the GPUFeatureChecker. | |
35 void SetWebGLAvailability(bool available); | |
36 void SetCSS3DAvailability(bool available); | |
37 | |
38 void MaybeRunCallback(); | |
39 | |
40 std::vector<std::string> errors_; | |
41 | |
42 // Every requirement that needs to be resolved asynchronously will add to | |
43 // this counter. When the counter is depleted, the callback will be run. | |
44 int pending_requirement_checks_; | |
45 | |
46 scoped_refptr<GPUFeatureChecker> webgl_checker_; | |
47 scoped_refptr<GPUFeatureChecker> css3d_checker_; | |
48 | |
49 base::Callback<void(std::vector<std::string>)> callback_; | |
50 }; | |
51 | |
52 } // namespace extensions | |
53 | |
54 #endif // CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_ | |
OLD | NEW |