| 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 "chrome/renderer/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 // so these will trigger a reindex. | 734 // so these will trigger a reindex. |
| 735 GURL stripped_url(StripRef(url)); | 735 GURL stripped_url(StripRef(url)); |
| 736 if (same_page_id && stripped_url == last_indexed_url_) | 736 if (same_page_id && stripped_url == last_indexed_url_) |
| 737 return; | 737 return; |
| 738 | 738 |
| 739 if (!preliminary_capture) | 739 if (!preliminary_capture) |
| 740 last_indexed_url_ = stripped_url; | 740 last_indexed_url_ = stripped_url; |
| 741 | 741 |
| 742 TRACE_EVENT0("renderer", "ChromeRenderViewObserver::CapturePageInfo"); | 742 TRACE_EVENT0("renderer", "ChromeRenderViewObserver::CapturePageInfo"); |
| 743 | 743 |
| 744 if (contents.size()) { |
| 745 // Send the text to the browser for indexing (the browser might decide not |
| 746 // to index, if the URL is HTTPS for instance). |
| 747 Send(new ChromeViewHostMsg_PageContents(routing_id(), url, page_id, |
| 748 contents)); |
| 749 } |
| 750 |
| 744 #if defined(FULL_SAFE_BROWSING) | 751 #if defined(FULL_SAFE_BROWSING) |
| 745 // Will swap out the string. | 752 // Will swap out the string. |
| 746 if (phishing_classifier_) | 753 if (phishing_classifier_) |
| 747 phishing_classifier_->PageCaptured(&contents, preliminary_capture); | 754 phishing_classifier_->PageCaptured(&contents, preliminary_capture); |
| 748 #endif | 755 #endif |
| 749 } | 756 } |
| 750 | 757 |
| 751 void ChromeRenderViewObserver::CaptureText(WebFrame* frame, | 758 void ChromeRenderViewObserver::CaptureText(WebFrame* frame, |
| 752 string16* contents) { | 759 string16* contents) { |
| 753 contents->clear(); | 760 contents->clear(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 WebElement element = node.to<WebElement>(); | 829 WebElement element = node.to<WebElement>(); |
| 823 if (!element.hasTagName(tag_name)) | 830 if (!element.hasTagName(tag_name)) |
| 824 continue; | 831 continue; |
| 825 WebString value = element.getAttribute(attribute_name); | 832 WebString value = element.getAttribute(attribute_name); |
| 826 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) | 833 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) |
| 827 continue; | 834 continue; |
| 828 return true; | 835 return true; |
| 829 } | 836 } |
| 830 return false; | 837 return false; |
| 831 } | 838 } |
| OLD | NEW |