| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_ANDROID_CONTENT_DETECTOR_H_ | 5 #ifndef CONTENT_RENDERER_ANDROID_CONTENT_DETECTOR_H_ |
| 6 #define CONTENT_RENDERER_ANDROID_CONTENT_DETECTOR_H_ | 6 #define CONTENT_RENDERER_ANDROID_CONTENT_DETECTOR_H_ |
| 7 | 7 |
| 8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" |
| 10 | 10 |
| 11 namespace WebKit { | 11 namespace WebKit { |
| 12 class WebHitTestResult; | 12 class WebHitTestResult; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 // Base class for text-based content detectors. | 17 // Base class for text-based content detectors. |
| 18 class ContentDetector { | 18 class ContentDetector { |
| 19 public: | 19 public: |
| 20 // Holds the content detection results. | 20 // Holds the content detection results. |
| 21 struct Result { | 21 struct Result { |
| 22 Result() : valid(false) {} | 22 Result(); |
| 23 Result(const WebKit::WebRange& content_boundaries, | 23 Result(const WebKit::WebRange& content_boundaries, |
| 24 const std::string& text, | 24 const std::string& text, |
| 25 const GURL& intent_url) | 25 const GURL& intent_url); |
| 26 : valid(true), | 26 ~Result(); |
| 27 content_boundaries(content_boundaries), | |
| 28 text(text), | |
| 29 intent_url(intent_url) {} | |
| 30 | 27 |
| 31 bool valid; | 28 bool valid; |
| 32 WebKit::WebRange content_boundaries; | 29 WebKit::WebRange content_boundaries; |
| 33 std::string text; // Processed text of the content. | 30 std::string text; // Processed text of the content. |
| 34 GURL intent_url; // URL of the intent that should process this content. | 31 GURL intent_url; // URL of the intent that should process this content. |
| 35 }; | 32 }; |
| 36 | 33 |
| 37 virtual ~ContentDetector() {} | 34 virtual ~ContentDetector() {} |
| 38 | 35 |
| 39 // Returns a WebKit range delimiting the contents found around the tapped | 36 // Returns a WebKit range delimiting the contents found around the tapped |
| (...skipping 22 matching lines...) Expand all Loading... |
| 62 | 59 |
| 63 WebKit::WebRange FindContentRange(const WebKit::WebHitTestResult& hit_test, | 60 WebKit::WebRange FindContentRange(const WebKit::WebHitTestResult& hit_test, |
| 64 std::string* content_text); | 61 std::string* content_text); |
| 65 | 62 |
| 66 DISALLOW_COPY_AND_ASSIGN(ContentDetector); | 63 DISALLOW_COPY_AND_ASSIGN(ContentDetector); |
| 67 }; | 64 }; |
| 68 | 65 |
| 69 } // namespace content | 66 } // namespace content |
| 70 | 67 |
| 71 #endif // CONTENT_RENDERER_ANDROID_CONTENT_DETECTOR_H_ | 68 #endif // CONTENT_RENDERER_ANDROID_CONTENT_DETECTOR_H_ |
| OLD | NEW |