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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 // so these will trigger a reindex. | 748 // so these will trigger a reindex. |
749 GURL stripped_url(StripRef(url)); | 749 GURL stripped_url(StripRef(url)); |
750 if (same_page_id && stripped_url == last_indexed_url_) | 750 if (same_page_id && stripped_url == last_indexed_url_) |
751 return; | 751 return; |
752 | 752 |
753 if (!preliminary_capture) | 753 if (!preliminary_capture) |
754 last_indexed_url_ = stripped_url; | 754 last_indexed_url_ = stripped_url; |
755 | 755 |
756 TRACE_EVENT0("renderer", "ChromeRenderViewObserver::CapturePageInfo"); | 756 TRACE_EVENT0("renderer", "ChromeRenderViewObserver::CapturePageInfo"); |
757 | 757 |
758 if (contents.size()) { | |
759 // Send the text to the browser for indexing (the browser might decide not | |
760 // to index, if the URL is HTTPS for instance). | |
761 Send(new ChromeViewHostMsg_PageContents(routing_id(), url, page_id, | |
762 contents)); | |
763 } | |
764 | |
765 #if defined(FULL_SAFE_BROWSING) | 758 #if defined(FULL_SAFE_BROWSING) |
766 // Will swap out the string. | 759 // Will swap out the string. |
767 if (phishing_classifier_) | 760 if (phishing_classifier_) |
768 phishing_classifier_->PageCaptured(&contents, preliminary_capture); | 761 phishing_classifier_->PageCaptured(&contents, preliminary_capture); |
769 #endif | 762 #endif |
770 } | 763 } |
771 | 764 |
772 void ChromeRenderViewObserver::CaptureText(WebFrame* frame, | 765 void ChromeRenderViewObserver::CaptureText(WebFrame* frame, |
773 string16* contents) { | 766 string16* contents) { |
774 contents->clear(); | 767 contents->clear(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 WebElement element = node.to<WebElement>(); | 836 WebElement element = node.to<WebElement>(); |
844 if (!element.hasTagName(tag_name)) | 837 if (!element.hasTagName(tag_name)) |
845 continue; | 838 continue; |
846 WebString value = element.getAttribute(attribute_name); | 839 WebString value = element.getAttribute(attribute_name); |
847 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) | 840 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) |
848 continue; | 841 continue; |
849 return true; | 842 return true; |
850 } | 843 } |
851 return false; | 844 return false; |
852 } | 845 } |
OLD | NEW |