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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_ 5 #ifndef EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_
6 #define EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_ 6 #define EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_
7 7
8 #include <memory>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/callback.h" 11 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h"
14 #include "extensions/browser/preload_check.h"
15
16 namespace content {
17 class GpuFeatureChecker;
18 }
12 19
13 namespace extensions { 20 namespace extensions {
14 class Extension; 21 class Extension;
15 22
16 // Validates the 'requirements' extension manifest field. This is an 23 // Validates the 'requirements' extension manifest field. This is an
17 // asynchronous process that involves several threads, but the public interface 24 // asynchronous process that involves several threads, but the public interface
18 // of this class (including constructor and destructor) must only be used on 25 // of this class (including constructor and destructor) must only be used on
19 // the UI thread. 26 // the UI thread.
20 class RequirementsChecker { 27 class RequirementsChecker : public PreloadCheck {
21 public: 28 public:
22 virtual ~RequirementsChecker() {} 29 explicit RequirementsChecker(const Extension* extension);
30 ~RequirementsChecker() override;
23 31
24 using RequirementsCheckedCallback = 32 // PreloadCheck:
25 base::Callback<void(const std::vector<std::string>& /* requirements */)>; 33 void Start(ResultCallback callback) override;
34 base::string16 GetErrorMessage() const override;
26 35
27 // The vector passed to the callback are any localized errors describing 36 private:
28 // requirement violations. If this vector is non-empty, requirements checking 37 // Callback for the GpuFeatureChecker.
29 // failed. This should only be called once. |callback| will always be invoked 38 void OnGetWebGLAvailability(bool available);
30 // asynchronously on the UI thread. |callback| will only be called once, and 39
31 // will be reset after called. 40 void RunCallback();
32 virtual void Check(const scoped_refptr<const Extension>& extension, 41
33 const RequirementsCheckedCallback& callback) = 0; 42 Errors errors_;
43
44 scoped_refptr<content::GpuFeatureChecker> webgl_checker_;
45
46 ResultCallback callback_;
47
48 base::WeakPtrFactory<RequirementsChecker> weak_ptr_factory_;
49
50 DISALLOW_COPY_AND_ASSIGN(RequirementsChecker);
34 }; 51 };
35 52
36 } // namespace extensions 53 } // namespace extensions
37 54
38 #endif // EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_ 55 #endif // EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_
OLDNEW
« 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