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

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

Issue 10261004: Move both instances of address_of into stl_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remediate to dhallowa review Created 8 years, 7 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
« no previous file with comments | « base/stl_util.h ('k') | chrome/browser/webdata/autofill_table.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/personal_data_manager.h" 5 #include "chrome/browser/autofill/personal_data_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <string>
9 10
10 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/stl_util.h"
11 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
12 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/autofill/autofill-inl.h" 15 #include "chrome/browser/autofill/autofill-inl.h"
14 #include "chrome/browser/autofill/autofill_field.h" 16 #include "chrome/browser/autofill/autofill_field.h"
15 #include "chrome/browser/autofill/autofill_metrics.h" 17 #include "chrome/browser/autofill/autofill_metrics.h"
16 #include "chrome/browser/autofill/autofill_regexes.h" 18 #include "chrome/browser/autofill/autofill_regexes.h"
17 #include "chrome/browser/autofill/form_structure.h" 19 #include "chrome/browser/autofill/form_structure.h"
18 #include "chrome/browser/autofill/personal_data_manager_observer.h" 20 #include "chrome/browser/autofill/personal_data_manager_observer.h"
19 #include "chrome/browser/autofill/phone_number.h" 21 #include "chrome/browser/autofill/phone_number.h"
20 #include "chrome/browser/autofill/phone_number_i18n.h" 22 #include "chrome/browser/autofill/phone_number_i18n.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 }; 54 };
53 55
54 template<typename T, typename C> 56 template<typename T, typename C>
55 bool FindByGUID(const C& container, const std::string& guid) { 57 bool FindByGUID(const C& container, const std::string& guid) {
56 return std::find_if( 58 return std::find_if(
57 container.begin(), 59 container.begin(),
58 container.end(), 60 container.end(),
59 FormGroupMatchesByGUIDFunctor<T>(guid)) != container.end(); 61 FormGroupMatchesByGUIDFunctor<T>(guid)) != container.end();
60 } 62 }
61 63
62 template<typename T>
63 class DereferenceFunctor {
64 public:
65 template<typename T_Iterator>
66 const T& operator()(const T_Iterator& iterator) {
67 return *iterator;
68 }
69 };
70
71 template<typename T>
72 T* address_of(T& v) {
73 return &v;
74 }
75
76 bool IsValidEmail(const string16& value) { 64 bool IsValidEmail(const string16& value) {
77 // This regex is more permissive than the official rfc2822 spec on the 65 // This regex is more permissive than the official rfc2822 spec on the
78 // subject, but it does reject obvious non-email addresses. 66 // subject, but it does reject obvious non-email addresses.
79 const string16 kEmailPattern = ASCIIToUTF16("^[^@]+@[^@]+\\.[a-z]{2,6}$"); 67 const string16 kEmailPattern = ASCIIToUTF16("^[^@]+@[^@]+\\.[a-z]{2,6}$");
80 return autofill::MatchesPattern(value, kEmailPattern); 68 return autofill::MatchesPattern(value, kEmailPattern);
81 } 69 }
82 70
83 // Valid for US zip codes only. 71 // Valid for US zip codes only.
84 bool IsValidZip(const string16& value) { 72 bool IsValidZip(const string16& value) {
85 // Basic US zip code matching. 73 // Basic US zip code matching.
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 } 918 }
931 919
932 const AutofillMetrics* PersonalDataManager::metric_logger() const { 920 const AutofillMetrics* PersonalDataManager::metric_logger() const {
933 return metric_logger_.get(); 921 return metric_logger_.get();
934 } 922 }
935 923
936 void PersonalDataManager::set_metric_logger( 924 void PersonalDataManager::set_metric_logger(
937 const AutofillMetrics* metric_logger) { 925 const AutofillMetrics* metric_logger) {
938 metric_logger_.reset(metric_logger); 926 metric_logger_.reset(metric_logger);
939 } 927 }
OLDNEW
« no previous file with comments | « base/stl_util.h ('k') | chrome/browser/webdata/autofill_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698