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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 // so these will trigger a reindex. | 756 // so these will trigger a reindex. |
757 GURL stripped_url(StripRef(url)); | 757 GURL stripped_url(StripRef(url)); |
758 if (same_page_id && stripped_url == last_indexed_url_) | 758 if (same_page_id && stripped_url == last_indexed_url_) |
759 return; | 759 return; |
760 | 760 |
761 if (!preliminary_capture) | 761 if (!preliminary_capture) |
762 last_indexed_url_ = stripped_url; | 762 last_indexed_url_ = stripped_url; |
763 | 763 |
764 TRACE_EVENT0("renderer", "ChromeRenderViewObserver::CapturePageInfo"); | 764 TRACE_EVENT0("renderer", "ChromeRenderViewObserver::CapturePageInfo"); |
765 | 765 |
766 if (contents.size()) { | |
767 // Send the text to the browser for indexing (the browser might decide not | |
768 // to index, if the URL is HTTPS for instance). | |
769 Send(new ChromeViewHostMsg_PageContents(routing_id(), url, page_id, | |
770 contents)); | |
771 } | |
772 | |
773 #if defined(FULL_SAFE_BROWSING) | 766 #if defined(FULL_SAFE_BROWSING) |
774 // Will swap out the string. | 767 // Will swap out the string. |
775 if (phishing_classifier_) | 768 if (phishing_classifier_) |
776 phishing_classifier_->PageCaptured(&contents, preliminary_capture); | 769 phishing_classifier_->PageCaptured(&contents, preliminary_capture); |
777 #endif | 770 #endif |
778 } | 771 } |
779 | 772 |
780 void ChromeRenderViewObserver::CaptureText(WebFrame* frame, | 773 void ChromeRenderViewObserver::CaptureText(WebFrame* frame, |
781 string16* contents) { | 774 string16* contents) { |
782 contents->clear(); | 775 contents->clear(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 WebElement element = node.to<WebElement>(); | 844 WebElement element = node.to<WebElement>(); |
852 if (!element.hasTagName(tag_name)) | 845 if (!element.hasTagName(tag_name)) |
853 continue; | 846 continue; |
854 WebString value = element.getAttribute(attribute_name); | 847 WebString value = element.getAttribute(attribute_name); |
855 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) | 848 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) |
856 continue; | 849 continue; |
857 return true; | 850 return true; |
858 } | 851 } |
859 return false; | 852 return false; |
860 } | 853 } |
OLD | NEW |