diff options
-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); |