| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_INL_H_ | |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_INL_H_ | |
| 7 | |
| 8 template<typename T> | |
| 9 class FormGroupMatchesByCompareFunctor { | |
| 10 public: | |
| 11 explicit FormGroupMatchesByCompareFunctor(const T& form_group) | |
| 12 : form_group_(form_group) { | |
| 13 } | |
| 14 | |
| 15 bool operator()(const T* form_group) { | |
| 16 return form_group->Compare(form_group_) == 0; | |
| 17 } | |
| 18 | |
| 19 bool operator()(const T& form_group) { | |
| 20 return form_group.Compare(form_group_) == 0; | |
| 21 } | |
| 22 | |
| 23 private: | |
| 24 const T& form_group_; | |
| 25 }; | |
| 26 | |
| 27 template<typename C, typename T> | |
| 28 bool FindByContents(const C& container, const T& form_group) { | |
| 29 return std::find_if( | |
| 30 container.begin(), | |
| 31 container.end(), | |
| 32 FormGroupMatchesByCompareFunctor<T>(form_group)) != container.end(); | |
| 33 } | |
| 34 | |
| 35 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_INL_H_ | |
| OLD | NEW |