Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: content/renderer/android/content_detector.cc

Issue 2790893004: Delete Android content detectors. (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/android/content_detector.h ('k') | content/renderer/android/email_detector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/android/content_detector.cc
diff --git a/content/renderer/android/content_detector.cc b/content/renderer/android/content_detector.cc
deleted file mode 100644
index 7bf25628caed9eb798799059ffb88c7d8bf1d924..0000000000000000000000000000000000000000
--- a/content/renderer/android/content_detector.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/renderer/android/content_detector.h"
-
-#include "base/logging.h"
-#include "third_party/WebKit/public/platform/WebPoint.h"
-#include "third_party/WebKit/public/web/WebHitTestResult.h"
-#include "third_party/WebKit/public/web/WebSurroundingText.h"
-
-using blink::WebURL;
-using blink::WebHitTestResult;
-using blink::WebSurroundingText;
-
-namespace content {
-
-WebURL ContentDetector::FindTappedContent(const WebHitTestResult& hit_test) {
- if (hit_test.isNull())
- return WebURL();
-
- std::string content_text;
- if (!FindContentRange(hit_test, &content_text))
- return WebURL();
-
- return GetIntentURL(content_text);
-}
-
-bool ContentDetector::FindContentRange(const 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;
- surrounding_text.initialize(hit_test.node(), hit_test.localPoint(),
- GetMaximumContentLength() * 2);
- if (surrounding_text.isNull())
- return false;
-
- base::string16 content = surrounding_text.textContent().utf16();
- if (content.empty())
- return false;
-
- size_t selected_offset = surrounding_text.hitOffsetInTextContent();
- for (size_t start_offset = 0; start_offset < content.length();) {
- size_t relative_start, relative_end;
- if (!FindContent(content.begin() + start_offset,
- content.end(), &relative_start, &relative_end, content_text)) {
- break;
- } else {
- size_t content_start = start_offset + relative_start;
- size_t content_end = start_offset + relative_end;
- DCHECK(content_end <= content.length());
-
- if (selected_offset >= content_start && selected_offset < content_end)
- return true;
- else
- start_offset += relative_end;
- }
- }
-
- return false;
-}
-
-} // namespace content
« no previous file with comments | « content/renderer/android/content_detector.h ('k') | content/renderer/android/email_detector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698