| 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 #include "content/renderer/android/content_detector.h" | 5 #include "content/renderer/android/content_detector.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSurroundingText.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSurroundingText.h" |
| 11 | 11 |
| 12 using WebKit::WebRange; | 12 using WebKit::WebRange; |
| 13 using WebKit::WebSurroundingText; | 13 using WebKit::WebSurroundingText; |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 ContentDetector::Result::Result() : valid(false) {} |
| 18 |
| 19 ContentDetector::Result::Result(const WebKit::WebRange& content_boundaries, |
| 20 const std::string& text, |
| 21 const GURL& intent_url) |
| 22 : valid(true), |
| 23 content_boundaries(content_boundaries), |
| 24 text(text), |
| 25 intent_url(intent_url) { |
| 26 } |
| 27 |
| 28 ContentDetector::Result::~Result() {} |
| 29 |
| 17 ContentDetector::Result ContentDetector::FindTappedContent( | 30 ContentDetector::Result ContentDetector::FindTappedContent( |
| 18 const WebKit::WebHitTestResult& hit_test) { | 31 const WebKit::WebHitTestResult& hit_test) { |
| 19 if (hit_test.isNull()) | 32 if (hit_test.isNull()) |
| 20 return Result(); | 33 return Result(); |
| 21 | 34 |
| 22 std::string content_text; | 35 std::string content_text; |
| 23 WebKit::WebRange range = FindContentRange(hit_test, &content_text); | 36 WebKit::WebRange range = FindContentRange(hit_test, &content_text); |
| 24 if (range.isNull()) | 37 if (range.isNull()) |
| 25 return Result(); | 38 return Result(); |
| 26 | 39 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } else { | 75 } else { |
| 63 start_offset += relative_end; | 76 start_offset += relative_end; |
| 64 } | 77 } |
| 65 } | 78 } |
| 66 } | 79 } |
| 67 | 80 |
| 68 return WebRange(); | 81 return WebRange(); |
| 69 } | 82 } |
| 70 | 83 |
| 71 } // namespace content | 84 } // namespace content |
| OLD | NEW |