Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / extensions / chrome_requirements_checker.h
blobb8923771c5fbd7c376d8168639da00fe96bdd0aa
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_REQUIREMENTS_CHECKER_H_
6 #define CHROME_BROWSER_EXTENSIONS_CHROME_REQUIREMENTS_CHECKER_H_
8 #include <vector>
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "extensions/browser/requirements_checker.h"
15 class GPUFeatureChecker;
17 namespace extensions {
18 class Extension;
20 // Validates the 'requirements' extension manifest field. This is an
21 // asynchronous process that involves several threads, but the public interface
22 // of this class (including constructor and destructor) must only be used on
23 // the UI thread.
24 class ChromeRequirementsChecker : public RequirementsChecker {
25 public:
26 ChromeRequirementsChecker();
27 ~ChromeRequirementsChecker() override;
29 private:
30 // RequirementsChecker:
31 void Check(const scoped_refptr<const Extension>& extension,
32 const RequirementsCheckedCallback& callback) override;
34 // Callbacks for the GPUFeatureChecker.
35 void SetWebGLAvailability(bool available);
37 void MaybeRunCallback();
39 std::vector<std::string> errors_;
41 // Every requirement that needs to be resolved asynchronously will add to
42 // this counter. When the counter is depleted, the callback will be run.
43 int pending_requirement_checks_;
45 scoped_refptr<GPUFeatureChecker> webgl_checker_;
47 RequirementsCheckedCallback callback_;
49 base::WeakPtrFactory<ChromeRequirementsChecker> weak_ptr_factory_;
51 DISALLOW_COPY_AND_ASSIGN(ChromeRequirementsChecker);
54 } // namespace extensions
56 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_REQUIREMENTS_CHECKER_H_