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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_
6 #define CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
13 namespace extensions
{
16 // Validates the 'requirements' extension manifest field. This is an
17 // asynchronous process that involves several threads, but the public interface
18 // of this class (including constructor and destructor) must only be used on
20 class RequirementsChecker
{
22 virtual ~RequirementsChecker() {}
24 using RequirementsCheckedCallback
=
25 base::Callback
<void(const std::vector
<std::string
>& /* requirements */)>;
27 // The vector passed to the callback are any localized errors describing
28 // requirement violations. If this vector is non-empty, requirements checking
29 // failed. This should only be called once. |callback| will always be invoked
30 // asynchronously on the UI thread. |callback| will only be called once, and
31 // will be reset after called.
32 virtual void Check(const scoped_refptr
<const Extension
>& extension
,
33 const RequirementsCheckedCallback
& callback
) = 0;
36 } // namespace extensions
38 #endif // CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_CHECKER_H_