diff options
author | leandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-28 12:40:29 +0000 |
---|---|---|
committer | leandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-28 12:40:29 +0000 |
commit | 52fcce0e275b236842b316f2d58983f37b5efd9b (patch) | |
tree | 8be008f7b3f2f6e67bc62d30baae723326b96450 | |
parent | 08e1a253b5eca28666569e05cbf4552127aa2568 (diff) | |
download | chromium_src-52fcce0e275b236842b316f2d58983f37b5efd9b.zip chromium_src-52fcce0e275b236842b316f2d58983f37b5efd9b.tar.gz chromium_src-52fcce0e275b236842b316f2d58983f37b5efd9b.tar.bz2 |
Revert 139238 - Fix content detector nits.
Fix the nits detected in https://chromiumcodereview.appspot.com/10187020/ after
the patch was landed and the bug closed.
BUG=125390
TEST=Unit tests of each component (address/phone number/email).
Review URL: https://chromiumcodereview.appspot.com/10443031
TBR=leandrogracia@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10451053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139239 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/content_renderer.gypi | 4 | ||||
-rw-r--r-- | content/renderer/android/content_detector.cc | 3 | ||||
-rw-r--r-- | content/renderer/android/content_detector.h | 21 |
3 files changed, 15 insertions, 13 deletions
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index a0ddc25..74c7719 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -40,8 +40,6 @@ 'public/renderer/render_view_observer_tracker.h', 'public/renderer/render_view_visitor.h', 'public/renderer/v8_value_converter.h', - 'renderer/active_notification_tracker.cc', - 'renderer/active_notification_tracker.h', 'renderer/android/address_detector.cc', 'renderer/android/address_detector.h', 'renderer/android/content_detector.cc', @@ -50,6 +48,8 @@ 'renderer/android/email_detector.h', 'renderer/android/phone_number_detector.cc', 'renderer/android/phone_number_detector.h', + 'renderer/active_notification_tracker.cc', + 'renderer/active_notification_tracker.h', 'renderer/device_orientation_dispatcher.cc', 'renderer/device_orientation_dispatcher.h', 'renderer/devtools_agent.cc', diff --git a/content/renderer/android/content_detector.cc b/content/renderer/android/content_detector.cc index 2476d26..5c184c9 100644 --- a/content/renderer/android/content_detector.cc +++ b/content/renderer/android/content_detector.cc @@ -27,8 +27,7 @@ ContentDetector::Result ContentDetector::FindTappedContent( } WebRange ContentDetector::FindContentRange( - const WebKit::WebHitTestResult& hit_test, - std::string* content_text) { + const WebKit::WebHitTestResult& hit_test, std::string* content_text) { // As the surrounding text extractor looks at maxLength/2 characters on // either side of the hit point, we need to double max content length here. WebSurroundingText surrounding_text; diff --git a/content/renderer/android/content_detector.h b/content/renderer/android/content_detector.h index 4e3db20..5a7b5fd 100644 --- a/content/renderer/android/content_detector.h +++ b/content/renderer/android/content_detector.h @@ -6,7 +6,9 @@ #define CONTENT_RENDERER_ANDROID_CONTENT_DETECTOR_H_ #pragma once +#include "base/string_util.h" #include "googleurl/src/gurl.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" namespace WebKit { @@ -18,21 +20,23 @@ namespace content { // Base class for text-based content detectors. class ContentDetector { public: + // Holds the content detection results. struct Result { + bool valid; // Flag indicating if the result is valid. + WebKit::WebRange range; // Range describing the content boundaries. + std::string text; // Processed text of the content. + GURL intent_url; // URL of the intent that should process this content. + Result() : valid(false) {} - Result(const WebKit::WebRange& content_boundaries, + + Result(const WebKit::WebRange& range, const std::string& text, const GURL& intent_url) : valid(true), - content_boundaries(content_boundaries), + range(range), text(text), intent_url(intent_url) {} - - bool valid; - WebKit::WebRange content_boundaries; - std::string text; // Processed text of the content. - GURL intent_url; // URL of the intent that should process this content. }; virtual ~ContentDetector() {} @@ -42,8 +46,6 @@ class ContentDetector { Result FindTappedContent(const WebKit::WebHitTestResult& hit_test); protected: - ContentDetector() {} - // Parses the input string defined by the begin/end iterators returning true // if the desired content is found. The start and end positions relative to // the input iterators are returned in start_pos and end_pos. @@ -61,6 +63,7 @@ class ContentDetector { // position in order to search for content. virtual size_t GetMaximumContentLength() = 0; + ContentDetector() {} WebKit::WebRange FindContentRange(const WebKit::WebHitTestResult& hit_test, std::string* content_text); |