policy_check.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2017 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. #ifndef EXTENSIONS_BROWSER_POLICY_CHECK_H_
  5. #define EXTENSIONS_BROWSER_POLICY_CHECK_H_
  6. #include <string>
  7. #include "base/memory/raw_ptr.h"
  8. #include "extensions/browser/preload_check.h"
  9. namespace content {
  10. class BrowserContext;
  11. }
  12. namespace extensions {
  13. class Extension;
  14. // Checks whether loading this extension is disabled by policy. Synchronously
  15. // calls the callback with the result.
  16. class PolicyCheck : public PreloadCheck {
  17. public:
  18. PolicyCheck(content::BrowserContext* context,
  19. scoped_refptr<const Extension> extension);
  20. PolicyCheck(const PolicyCheck&) = delete;
  21. PolicyCheck& operator=(const PolicyCheck&) = delete;
  22. ~PolicyCheck() override;
  23. // PreloadCheck:
  24. void Start(ResultCallback callback) override;
  25. std::u16string GetErrorMessage() const override;
  26. private:
  27. raw_ptr<content::BrowserContext> context_;
  28. std::u16string error_;
  29. };
  30. } // namespace extensions
  31. #endif // EXTENSIONS_BROWSER_POLICY_CHECK_H_