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 | |
751 #if defined(FULL_SAFE_BROWSING) | 744 #if defined(FULL_SAFE_BROWSING) |
752 // Will swap out the string. | 745 // Will swap out the string. |
753 if (phishing_classifier_) | 746 if (phishing_classifier_) |
754 phishing_classifier_->PageCaptured(&contents, preliminary_capture); | 747 phishing_classifier_->PageCaptured(&contents, preliminary_capture); |
755 #endif | 748 #endif |
756 } | 749 } |
757 | 750 |
758 void ChromeRenderViewObserver::CaptureText(WebFrame* frame, | 751 void ChromeRenderViewObserver::CaptureText(WebFrame* frame, |
759 string16* contents) { | 752 string16* contents) { |
760 contents->clear(); | 753 contents->clear(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 WebElement element = node.to<WebElement>(); | 822 WebElement element = node.to<WebElement>(); |
830 if (!element.hasTagName(tag_name)) | 823 if (!element.hasTagName(tag_name)) |
831 continue; | 824 continue; |
832 WebString value = element.getAttribute(attribute_name); | 825 WebString value = element.getAttribute(attribute_name); |
833 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) | 826 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) |
834 continue; | 827 continue; |
835 return true; | 828 return true; |
836 } | 829 } |
837 return false; | 830 return false; |
838 } | 831 } |
OLD | NEW |