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