Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/autofill/phone_field.cc

Issue 6633001: Convert autofill messages to use the new IPC macros (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/autofill/phone_field.h" 5 #include "chrome/browser/autofill/phone_field.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 for (size_t i = 0; i < arraysize(phone_field_grammars_); ++i) { 274 for (size_t i = 0; i < arraysize(phone_field_grammars_); ++i) {
275 memset(parsed_fields, 0, sizeof(parsed_fields)); 275 memset(parsed_fields, 0, sizeof(parsed_fields));
276 q = *iter; 276 q = *iter;
277 // Attempt to parse next possible match. 277 // Attempt to parse next possible match.
278 for (; i < arraysize(phone_field_grammars_) && 278 for (; i < arraysize(phone_field_grammars_) &&
279 phone_field_grammars_[i].regex != REGEX_SEPARATOR; ++i) { 279 phone_field_grammars_[i].regex != REGEX_SEPARATOR; ++i) {
280 if (!ParseText(&q, phone_field->GetRegExp(phone_field_grammars_[i].regex), 280 if (!ParseText(&q, phone_field->GetRegExp(phone_field_grammars_[i].regex),
281 &parsed_fields[phone_field_grammars_[i].phone_part])) 281 &parsed_fields[phone_field_grammars_[i].phone_part]))
282 break; 282 break;
283 if (phone_field_grammars_[i].max_size && 283 if (phone_field_grammars_[i].max_size &&
284 (!parsed_fields[phone_field_grammars_[i].phone_part]->max_length() || 284 (!parsed_fields[phone_field_grammars_[i].phone_part]->max_length ||
285 phone_field_grammars_[i].max_size < 285 phone_field_grammars_[i].max_size <
286 parsed_fields[phone_field_grammars_[i].phone_part]->max_length())) { 286 parsed_fields[phone_field_grammars_[i].phone_part]->max_length)) {
287 break; 287 break;
288 } 288 }
289 } 289 }
290 if (i >= arraysize(phone_field_grammars_)) 290 if (i >= arraysize(phone_field_grammars_))
291 return false; // Parsing failed. 291 return false; // Parsing failed.
292 if (phone_field_grammars_[i].regex == REGEX_SEPARATOR) 292 if (phone_field_grammars_[i].regex == REGEX_SEPARATOR)
293 break; // Parsing succeeded. 293 break; // Parsing succeeded.
294 do { 294 do {
295 ++i; 295 ++i;
296 } while (i < arraysize(phone_field_grammars_) && 296 } while (i < arraysize(phone_field_grammars_) &&
(...skipping 29 matching lines...) Expand all
326 void PhoneField::SetPhoneType(PhoneType phone_type) { 326 void PhoneField::SetPhoneType(PhoneType phone_type) {
327 // Field types are different as well, so we create a temporary phone number, 327 // Field types are different as well, so we create a temporary phone number,
328 // to get relevant field types. 328 // to get relevant field types.
329 if (phone_type == HOME_PHONE) 329 if (phone_type == HOME_PHONE)
330 number_.reset(new HomePhoneNumber); 330 number_.reset(new HomePhoneNumber);
331 else 331 else
332 number_.reset(new FaxNumber); 332 number_.reset(new FaxNumber);
333 phone_type_ = phone_type; 333 phone_type_ = phone_type;
334 } 334 }
335 335
OLDNEW
« no previous file with comments | « chrome/browser/autofill/personal_data_manager_unittest.cc ('k') | chrome/browser/autofill/select_control_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698