summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorleandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-28 15:01:48 +0000
committerleandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-28 15:01:48 +0000
commit9bc991b492c58e2dddf3f027b78db1e7e752b289 (patch)
tree5fe928611054a9001b6d6b82c5d4c73ecb5c3bdd /content
parentbe2510c02f438cf2887985e7a9c4780ad8aedc01 (diff)
downloadchromium_src-9bc991b492c58e2dddf3f027b78db1e7e752b289.zip
chromium_src-9bc991b492c58e2dddf3f027b78db1e7e752b289.tar.gz
chromium_src-9bc991b492c58e2dddf3f027b78db1e7e752b289.tar.bz2
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). Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=139238 Review URL: https://chromiumcodereview.appspot.com/10443031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139243 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/content_renderer.gypi4
-rw-r--r--content/renderer/android/address_detector.cc8
-rw-r--r--content/renderer/android/address_detector.h9
-rw-r--r--content/renderer/android/address_detector_unittest.cc1
-rw-r--r--content/renderer/android/content_detector.cc4
-rw-r--r--content/renderer/android/content_detector.h21
-rw-r--r--content/renderer/android/email_detector.cc1
-rw-r--r--content/renderer/android/email_detector.h1
-rw-r--r--content/renderer/android/phone_number_detector.cc1
-rw-r--r--content/renderer/android/phone_number_detector.h1
10 files changed, 30 insertions, 21 deletions
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 74c7719..a0ddc25 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -40,6 +40,8 @@
'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',
@@ -48,8 +50,6 @@
'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/address_detector.cc b/content/renderer/android/address_detector.cc
index 6d81c72..891ac34 100644
--- a/content/renderer/android/address_detector.cc
+++ b/content/renderer/android/address_detector.cc
@@ -6,6 +6,7 @@
#include <bitset>
+#include "base/logging.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "net/base/escape.h"
@@ -283,6 +284,13 @@ bool AddressDetector::FindContent(const string16::const_iterator& begin,
return false;
}
+AddressDetector::Word::Word(const string16::const_iterator& begin,
+ const string16::const_iterator& end)
+ : begin(begin),
+ end(end) {
+ DCHECK(begin <= end);
+}
+
bool AddressDetector::HouseNumberParser::IsPreDelimiter(
char16 character) {
return character == ':' || IsPostDelimiter(character);
diff --git a/content/renderer/android/address_detector.h b/content/renderer/android/address_detector.h
index bd6002d..af05191 100644
--- a/content/renderer/android/address_detector.h
+++ b/content/renderer/android/address_detector.h
@@ -8,6 +8,7 @@
#include <vector>
+#include "base/compiler_specific.h"
#include "base/string_tokenizer.h"
#include "content/renderer/android/content_detector.h"
@@ -41,12 +42,8 @@ class AddressDetector : public ContentDetector {
string16::const_iterator end;
Word() {}
- Word(const string16::const_iterator& begin_it,
- const string16::const_iterator& end_it)
- : begin(begin_it),
- end(end_it) {
- DCHECK(begin_it <= end_it);
- }
+ Word(const string16::const_iterator& begin,
+ const string16::const_iterator& end);
};
class HouseNumberParser {
diff --git a/content/renderer/android/address_detector_unittest.cc b/content/renderer/android/address_detector_unittest.cc
index 0922722..43c0add 100644
--- a/content/renderer/android/address_detector_unittest.cc
+++ b/content/renderer/android/address_detector_unittest.cc
@@ -5,6 +5,7 @@
#include "content/renderer/android/address_detector.h"
#include "base/memory/scoped_ptr.h"
+#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/renderer/android/content_detector.cc b/content/renderer/android/content_detector.cc
index 5c184c9..f457628 100644
--- a/content/renderer/android/content_detector.cc
+++ b/content/renderer/android/content_detector.cc
@@ -4,6 +4,7 @@
#include "content/renderer/android/content_detector.h"
+#include "base/logging.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSurroundingText.h"
@@ -27,7 +28,8 @@ 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 5a7b5fd..4e3db20 100644
--- a/content/renderer/android/content_detector.h
+++ b/content/renderer/android/content_detector.h
@@ -6,9 +6,7 @@
#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 {
@@ -20,23 +18,21 @@ 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& range,
+ Result(const WebKit::WebRange& content_boundaries,
const std::string& text,
const GURL& intent_url)
: valid(true),
- range(range),
+ content_boundaries(content_boundaries),
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() {}
@@ -46,6 +42,8 @@ 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.
@@ -63,7 +61,6 @@ 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);
diff --git a/content/renderer/android/email_detector.cc b/content/renderer/android/email_detector.cc
index 1178492..65dd1ab 100644
--- a/content/renderer/android/email_detector.cc
+++ b/content/renderer/android/email_detector.cc
@@ -4,6 +4,7 @@
#include "content/renderer/android/email_detector.h"
+#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/utf_string_conversions.h"
#include "net/base/escape.h"
diff --git a/content/renderer/android/email_detector.h b/content/renderer/android/email_detector.h
index cda43c6..5d6ddf9 100644
--- a/content/renderer/android/email_detector.h
+++ b/content/renderer/android/email_detector.h
@@ -6,6 +6,7 @@
#define CONTENT_RENDERER_ANDROID_EMAIL_DETECTOR_H_
#pragma once
+#include "base/compiler_specific.h"
#include "content/renderer/android/content_detector.h"
class EmailDetectorTest;
diff --git a/content/renderer/android/phone_number_detector.cc b/content/renderer/android/phone_number_detector.cc
index 30e0111..d037608 100644
--- a/content/renderer/android/phone_number_detector.cc
+++ b/content/renderer/android/phone_number_detector.cc
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "net/base/escape.h"
#include "third_party/libphonenumber/src/phonenumber_api.h"
diff --git a/content/renderer/android/phone_number_detector.h b/content/renderer/android/phone_number_detector.h
index fd13639..8d0e34f 100644
--- a/content/renderer/android/phone_number_detector.h
+++ b/content/renderer/android/phone_number_detector.h
@@ -6,6 +6,7 @@
#define CONTENT_RENDERER_ANDROID_PHONE_NUMBER_DETECTOR_H_
#pragma once
+#include "base/compiler_specific.h"
#include "content/renderer/android/content_detector.h"
class PhoneNumberDetectorTest;