| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CHROME_COMMON_SPELLCHECK_MARKER_H_ | 5 #ifndef CHROME_COMMON_SPELLCHECK_MARKER_H_ |
| 6 #define CHROME_COMMON_SPELLCHECK_MARKER_H_ | 6 #define CHROME_COMMON_SPELLCHECK_MARKER_H_ |
| 7 | 7 |
| 8 struct SpellCheckMarker { | 8 class SpellCheckMarker { |
| 9 public: |
| 10 // A predicate to test spellcheck marker validity. |
| 11 class IsValidPredicate { |
| 12 public: |
| 13 typedef SpellCheckMarker argument_type; |
| 14 explicit IsValidPredicate(size_t text_length) : text_length_(text_length) {} |
| 15 bool operator()(const SpellCheckMarker& marker) const { |
| 16 return marker.offset < text_length_; |
| 17 } |
| 18 private: |
| 19 size_t text_length_; |
| 20 }; |
| 21 |
| 9 // IPC requires a default constructor. | 22 // IPC requires a default constructor. |
| 10 SpellCheckMarker() : hash(-1), offset(-1) {} | 23 SpellCheckMarker() : hash(-1), offset(-1) {} |
| 11 | 24 |
| 12 SpellCheckMarker(uint32 hash, size_t offset) : hash(hash), offset(offset) {} | 25 SpellCheckMarker(uint32 hash, size_t offset) : hash(hash), offset(offset) {} |
| 13 | 26 |
| 14 uint32 hash; | 27 uint32 hash; |
| 15 size_t offset; | 28 size_t offset; |
| 16 }; | 29 }; |
| 17 | 30 |
| 18 #endif // CHROME_COMMON_SPELLCHECK_MARKER_H_ | 31 #endif // CHROME_COMMON_SPELLCHECK_MARKER_H_ |
| OLD | NEW |