Chromium Code Reviews| Index: content/common/android/address_parser.h |
| diff --git a/content/renderer/android/address_detector.h b/content/common/android/address_parser.h |
| similarity index 70% |
| copy from content/renderer/android/address_detector.h |
| copy to content/common/android/address_parser.h |
| index af05191ca505681453125ee8238aac866494fe75..1222f420c13cf232919cbbc7d26cebb53ce21083 100644 |
| --- a/content/renderer/android/address_detector.h |
| +++ b/content/common/android/address_parser.h |
| @@ -2,39 +2,40 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CONTENT_RENDERER_ANDROID_ADDRESS_DETECTOR_H_ |
| -#define CONTENT_RENDERER_ANDROID_ADDRESS_DETECTOR_H_ |
| +#ifndef CONTENT_COMMON_ADDRESS_PARSER_H_ |
| +#define CONTENT_COMMON_ADDRESS_PARSER_H_ |
| #pragma once |
| #include <vector> |
| -#include "base/compiler_specific.h" |
| #include "base/string_tokenizer.h" |
| -#include "content/renderer/android/content_detector.h" |
| -class AddressDetectorTest; |
| +class AddressParserTest; |
| namespace content { |
| // Finds a geographical address (currently US only) in the given text string. |
| -class AddressDetector : public ContentDetector { |
| +class AddressParser { |
|
piman
2012/05/29 19:53:26
So, this class has no field or non-static method,
Leandro GraciĆ” Gil
2012/05/30 18:19:56
Done.
|
| public: |
| - AddressDetector(); |
| - virtual ~AddressDetector(); |
| - private: |
| - friend class ::AddressDetectorTest; |
| + // Find the first address in some chunk of text. If an address is found in |
| + // |text| true is returned and the address is copied into |address|. |
| + // Otherwise, false is returned. |
| + static bool FindAddress(const string16& text, string16* address); |
| + |
| + // Find the first address in some chunk of test. |begin| is the starting |
| + // position to search from, |end| is the position to search to. |start_pos| |
| + // and |end_pos| are set to the starting and ending position of the address, |
| + // if found. |
| + static bool FindContent(const string16::const_iterator& begin, |
| + const string16::const_iterator& end, |
| + size_t* start_pos, |
| + size_t* end_pos); |
| - // Implementation of ContentDetector. |
| - virtual bool FindContent(const string16::const_iterator& begin, |
| - const string16::const_iterator& end, |
| - size_t* start_pos, |
| - size_t* end_pos, |
| - std::string* content_text) OVERRIDE; |
| - virtual GURL GetIntentURL(const std::string& content_text) OVERRIDE; |
| - virtual size_t GetMaximumContentLength() OVERRIDE; |
| + private: |
| + friend class ::AddressParserTest; |
| - std::string GetContentText(const string16& text); |
| + AddressParser(); |
| // Internal structs and classes. Required to be visible by the unit tests. |
| struct Word { |
| @@ -94,9 +95,9 @@ class AddressDetector : public ContentDetector { |
| static bool IsZipValid(const Word& word, size_t state_index); |
| static bool IsZipValidForState(const Word& word, size_t state_index); |
| - DISALLOW_COPY_AND_ASSIGN(AddressDetector); |
| + DISALLOW_COPY_AND_ASSIGN(AddressParser); |
| }; |
| } // namespace content |
| -#endif // CONTENT_RENDERER_ANDROID_ADDRESS_DETECTOR_H_ |
| +#endif // CONTENT_COMMON_ADDRESS_PARSER_H_ |