xref: /aosp_15_r20/external/cronet/components/nacl/renderer/plugin/plugin_error.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 /*
6  * Error codes and data structures used to report errors when loading a nexe.
7  */
8 
9 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_PLUGIN_ERROR_H_
10 #define COMPONENTS_NACL_RENDERER_PLUGIN_PLUGIN_ERROR_H_
11 
12 #include <string>
13 
14 #include "components/nacl/renderer/ppb_nacl_private.h"
15 
16 namespace plugin {
17 
18 class ErrorInfo {
19  public:
ErrorInfo()20   ErrorInfo() {
21     SetReport(PP_NACL_ERROR_UNKNOWN, std::string());
22   }
23 
24   ErrorInfo(const ErrorInfo&) = delete;
25   ErrorInfo& operator=(const ErrorInfo&) = delete;
26 
SetReport(PP_NaClError error_code,const std::string & message)27   void SetReport(PP_NaClError error_code, const std::string& message) {
28     error_code_ = error_code;
29     message_ = message;
30   }
31 
error_code()32   PP_NaClError error_code() const {
33     return error_code_;
34   }
35 
message()36   const std::string& message() const {
37     return message_;
38   }
39 
40  private:
41   PP_NaClError error_code_;
42   std::string message_;
43 };
44 
45 }  // namespace plugin
46 
47 #endif  // COMPONENTS_NACL_RENDERER_PLUGIN_PLUGIN_ERROR_H_
48