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 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 char buf[128]; | 964 char buf[128]; |
965 sprintf_s(buf, "%d chars retrieved for indexing in %gms\n", | 965 sprintf_s(buf, "%d chars retrieved for indexing in %gms\n", |
966 contents.size(), (end - begin)*1000); | 966 contents.size(), (end - begin)*1000); |
967 OutputDebugStringA(buf); | 967 OutputDebugStringA(buf); |
968 #endif | 968 #endif |
969 | 969 |
970 // When the contents are clipped to the maximum, we don't want to have a | 970 // When the contents are clipped to the maximum, we don't want to have a |
971 // partial word indexed at the end that might have been clipped. Therefore, | 971 // partial word indexed at the end that might have been clipped. Therefore, |
972 // terminate the string at the last space to ensure no words are clipped. | 972 // terminate the string at the last space to ensure no words are clipped. |
973 if (contents->size() == kMaxIndexChars) { | 973 if (contents->size() == kMaxIndexChars) { |
974 size_t last_space_index = contents->find_last_of(kWhitespaceUTF16); | 974 size_t last_space_index = contents->find_last_of(base::kWhitespaceUTF16); |
975 if (last_space_index == std::wstring::npos) | 975 if (last_space_index == base::string16::npos) |
976 return; // don't index if we got a huge block of text with no spaces | 976 return; // don't index if we got a huge block of text with no spaces |
977 contents->resize(last_space_index); | 977 contents->resize(last_space_index); |
978 } | 978 } |
979 } | 979 } |
980 | 980 |
981 ExternalHostBindings* ChromeRenderViewObserver::GetExternalHostBindings() { | 981 ExternalHostBindings* ChromeRenderViewObserver::GetExternalHostBindings() { |
982 if (!external_host_bindings_.get()) { | 982 if (!external_host_bindings_.get()) { |
983 external_host_bindings_.reset(new ExternalHostBindings( | 983 external_host_bindings_.reset(new ExternalHostBindings( |
984 render_view(), routing_id())); | 984 render_view(), routing_id())); |
985 } | 985 } |
(...skipping 30 matching lines...) Expand all Loading... |
1016 WebElement element = node.to<WebElement>(); | 1016 WebElement element = node.to<WebElement>(); |
1017 if (!element.hasTagName(tag_name)) | 1017 if (!element.hasTagName(tag_name)) |
1018 continue; | 1018 continue; |
1019 WebString value = element.getAttribute(attribute_name); | 1019 WebString value = element.getAttribute(attribute_name); |
1020 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) | 1020 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) |
1021 continue; | 1021 continue; |
1022 return true; | 1022 return true; |
1023 } | 1023 } |
1024 return false; | 1024 return false; |
1025 } | 1025 } |
OLD | NEW |