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

Side by Side Diff: extensions/browser/requirements_checker.h

Issue 2783813002: Move ChromeRequirementsChecker to //extensions as a PreloadCheck (Closed)
Patch Set: rebase? Created 3 years, 8 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.h ('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 <vector> 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "extensions/browser/preload_check.h"
9 12
10 #include "base/callback.h" 13 namespace content {
11 #include "base/memory/ref_counted.h" 14 class GpuFeatureChecker;
15 }
12 16
13 namespace extensions { 17 namespace extensions {
14 class Extension; 18 class Extension;
15 19
16 // Validates the 'requirements' extension manifest field. This is an 20 // Validates the 'requirements' extension manifest field. This is an
17 // asynchronous process that involves several threads, but the public interface 21 // asynchronous process that involves several threads, but the public interface
18 // of this class (including constructor and destructor) must only be used on 22 // of this class (including constructor and destructor) must only be used on
19 // the UI thread. 23 // the UI thread.
20 class RequirementsChecker { 24 class RequirementsChecker : public PreloadCheck {
21 public: 25 public:
22 virtual ~RequirementsChecker() {} 26 explicit RequirementsChecker(scoped_refptr<const Extension> extension);
27 ~RequirementsChecker() override;
23 28
24 using RequirementsCheckedCallback = 29 // PreloadCheck:
25 base::Callback<void(const std::vector<std::string>& /* requirements */)>; 30 void Start(ResultCallback callback) override;
31 // Joins multiple errors into a space-separated string.
32 base::string16 GetErrorMessage() const override;
26 33
27 // The vector passed to the callback are any localized errors describing 34 private:
28 // requirement violations. If this vector is non-empty, requirements checking 35 // Callback for the GpuFeatureChecker.
29 // failed. This should only be called once. |callback| will always be invoked 36 void VerifyWebGLAvailability(bool available);
30 // asynchronously on the UI thread. |callback| will only be called once, and 37
31 // will be reset after called. 38 // Helper function to post a task on the UI thread to call RunCallback().
32 virtual void Check(const scoped_refptr<const Extension>& extension, 39 void PostRunCallback();
33 const RequirementsCheckedCallback& callback) = 0; 40
41 // Helper function to run the callback.
42 void RunCallback();
43
44 scoped_refptr<content::GpuFeatureChecker> webgl_checker_;
45
46 ResultCallback callback_;
47 Errors errors_;
48
49 base::WeakPtrFactory<RequirementsChecker> weak_ptr_factory_;
50
51 DISALLOW_COPY_AND_ASSIGN(RequirementsChecker);
34 }; 52 };
35 53
36 } // namespace extensions 54 } // namespace extensions
37 55
38 #endif // EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_ 56 #endif // EXTENSIONS_BROWSER_REQUIREMENTS_CHECKER_H_
OLDNEW
« no previous file with comments | « extensions/browser/preload_check.h ('k') | extensions/browser/requirements_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698