Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * Error codes and data structures used to report errors when loading a nexe. | 8 * Error codes and data structures used to report errors when loading a nexe. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 Reset(); | 108 Reset(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void Reset() { | 111 void Reset() { |
| 112 SetReport(ERROR_UNKNOWN, std::string()); | 112 SetReport(ERROR_UNKNOWN, std::string()); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void SetReport(PluginErrorCode error_code, const std::string& message) { | 115 void SetReport(PluginErrorCode error_code, const std::string& message) { |
| 116 error_code_ = error_code; | 116 error_code_ = error_code; |
| 117 message_ = message; | 117 message_ = message; |
| 118 console_message_ = message; | |
| 119 } | |
| 120 | |
| 121 // console_message is a part of error that is logged to JavaScript console | |
|
Mark Seaborn
2013/07/19 15:25:30
Nit: "the error"; "the JavaScript console"
halyavin
2013/07/22 09:11:35
Done.
| |
| 122 // but is not reported to JavaScript via lastError property. This is used | |
|
Mark Seaborn
2013/07/19 15:25:30
"the lastError property"
halyavin
2013/07/22 09:11:35
Done.
| |
| 123 // to report internal errors which may easily change in new versions of | |
|
Mark Seaborn
2013/07/19 15:25:30
This doesn't really explain that we're hiding the
halyavin
2013/07/22 09:11:35
Done.
| |
| 124 // the browser. | |
| 125 void SetReportWithConsoleOnlyError(PluginErrorCode error_code, | |
| 126 const std::string& message, | |
| 127 const std::string& console_message) { | |
| 128 error_code_ = error_code; | |
| 129 message_ = message; | |
| 130 console_message_ = message + "; " + console_message; | |
| 118 } | 131 } |
| 119 | 132 |
| 120 PluginErrorCode error_code() const { | 133 PluginErrorCode error_code() const { |
| 121 return error_code_; | 134 return error_code_; |
| 122 } | 135 } |
| 123 | 136 |
| 124 void PrependMessage(const std::string& prefix) { | 137 void PrependMessage(const std::string& prefix) { |
| 125 message_ = prefix + message_; | 138 message_ = prefix + message_; |
| 139 console_message_ = prefix + console_message_; | |
| 126 } | 140 } |
| 127 | 141 |
| 128 const std::string& message() const { | 142 const std::string& message() const { |
| 129 return message_; | 143 return message_; |
| 130 } | 144 } |
| 131 | 145 |
| 146 const std::string& console_message() const { | |
| 147 return console_message_; | |
| 148 } | |
| 149 | |
| 132 private: | 150 private: |
| 133 PluginErrorCode error_code_; | 151 PluginErrorCode error_code_; |
| 134 std::string message_; | 152 std::string message_; |
| 153 std::string console_message_; | |
| 135 NACL_DISALLOW_COPY_AND_ASSIGN(ErrorInfo); | 154 NACL_DISALLOW_COPY_AND_ASSIGN(ErrorInfo); |
| 136 }; | 155 }; |
| 137 | 156 |
| 138 } // namespace plugin | 157 } // namespace plugin |
| 139 | 158 |
| 140 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H | 159 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H |
| OLD | NEW |