OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/autofill/browser/autofill_xml_parser.h" | 5 #include "components/autofill/browser/autofill_xml_parser.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 } else if (element.compare("autofill_flow") == 0) { | 112 } else if (element.compare("autofill_flow") == 0) { |
113 // |attrs| is a NULL-terminated list of (attribute, value) pairs. | 113 // |attrs| is a NULL-terminated list of (attribute, value) pairs. |
114 while (*attrs) { | 114 while (*attrs) { |
115 buzz::QName attribute_qname = context->ResolveQName(*attrs, true); | 115 buzz::QName attribute_qname = context->ResolveQName(*attrs, true); |
116 ++attrs; | 116 ++attrs; |
117 const std::string& attribute_name = attribute_qname.LocalPart(); | 117 const std::string& attribute_name = attribute_qname.LocalPart(); |
118 if (attribute_name.compare("page_no") == 0) | 118 if (attribute_name.compare("page_no") == 0) |
119 page_meta_data_->current_page_number = GetIntValue(context, *attrs); | 119 page_meta_data_->current_page_number = GetIntValue(context, *attrs); |
120 else if (attribute_name.compare("total_pages") == 0) | 120 else if (attribute_name.compare("total_pages") == 0) |
121 page_meta_data_->total_pages = GetIntValue(context, *attrs); | 121 page_meta_data_->total_pages = GetIntValue(context, *attrs); |
122 else if (attribute_name.compare("ignore_ajax") == 0) | |
123 page_meta_data_->ignore_ajax = strcmp(*attrs, "true") == 0; | |
Ilya Sherman
2013/06/11 01:11:20
Hmm, using strcmp here makes me a little nervous.
Dane Wallinga
2013/06/11 19:03:32
Even though this file is already replete with strc
Ilya Sherman
2013/06/11 23:14:32
By replete with, I guess you mean "has two strcmps
| |
122 ++attrs; | 124 ++attrs; |
123 } | 125 } |
124 } else if (element.compare("page_advance_button") == 0) { | 126 } else if (element.compare("page_advance_button") == 0) { |
125 page_meta_data_->proceed_element_descriptor = WebElementDescriptor(); | 127 page_meta_data_->proceed_element_descriptor = WebElementDescriptor(); |
126 ParseElementDescriptor(context, | 128 ParseElementDescriptor(context, |
127 attrs, | 129 attrs, |
128 &page_meta_data_->proceed_element_descriptor); | 130 &page_meta_data_->proceed_element_descriptor); |
129 } else if (element.compare("click_elements_before_formfill") == 0) { | 131 } else if (element.compare("click_elements_before_formfill") == 0) { |
130 page_meta_data_->click_elements_before_form_fill.push_back( | 132 page_meta_data_->click_elements_before_form_fill.push_back( |
131 WebElementDescriptor()); | 133 WebElementDescriptor()); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 char* attr_end = NULL; | 216 char* attr_end = NULL; |
215 double value = strtod(attribute, &attr_end); | 217 double value = strtod(attribute, &attr_end); |
216 if (attr_end != NULL && attr_end == attribute) { | 218 if (attr_end != NULL && attr_end == attribute) { |
217 context->RaiseError(XML_ERROR_SYNTAX); | 219 context->RaiseError(XML_ERROR_SYNTAX); |
218 return 0.0; | 220 return 0.0; |
219 } | 221 } |
220 return value; | 222 return value; |
221 } | 223 } |
222 | 224 |
223 } // namespace autofill | 225 } // namespace autofill |
OLD | NEW |