| 179 | } |
| 180 | |
| 181 | std::string Alert::GetText() { |
| 182 | LOG(TRACE) << "Entering Alert::GetText"; |
| 183 | std::string alert_text_value = ""; |
| 184 | if (this->is_standard_control_alert_) { |
| 185 | alert_text_value = this->GetStandardDialogText(); |
| 186 | } else { |
| 187 | std::string alert_text = this->GetDirectUIDialogText(); |
| 188 | if (!this->is_security_alert_) { |
| 189 | if (!this->is_standard_alert_) { |
| 190 | // This means the alert is from onbeforeunload, and we need to |
| 191 | // strip off everything up to and including the first CR-LF pair. |
| 192 | size_t first_crlf = alert_text.find("\r\n\r\n"); |
| 193 | if (first_crlf != std::string::npos && first_crlf + 4 < alert_text.size()) { |
| 194 | alert_text_value = alert_text.substr(first_crlf + 4); |
| 195 | } |
| 196 | } else { |
| 197 | alert_text_value = alert_text; |
| 198 | } |
| 199 | } |
| 200 | } |
| 201 | return alert_text_value; |
| 202 | } |
| 203 | |
| 204 | std::string Alert::GetStandardDialogText() { |
| 205 | LOG(TRACE) << "Entering Alert::GetStandardDialogText"; |
no test coverage detected