| 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/browser/autocomplete/history_quick_provider.h" | 5 #include "chrome/browser/autocomplete/history_quick_provider.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 HistoryURLProvider::kScoreForBestInlineableResult; | 258 HistoryURLProvider::kScoreForBestInlineableResult; |
| 259 } else if (url_db->IsTypedHost(host) && | 259 } else if (url_db->IsTypedHost(host) && |
| 260 (!autocomplete_input_.parts().path.is_nonempty() || | 260 (!autocomplete_input_.parts().path.is_nonempty() || |
| 261 ((autocomplete_input_.parts().path.len == 1) && | 261 ((autocomplete_input_.parts().path.len == 1) && |
| 262 (autocomplete_input_.text()[ | 262 (autocomplete_input_.text()[ |
| 263 autocomplete_input_.parts().path.begin] == '/'))) && | 263 autocomplete_input_.parts().path.begin] == '/'))) && |
| 264 !autocomplete_input_.parts().query.is_nonempty() && | 264 !autocomplete_input_.parts().query.is_nonempty() && |
| 265 !autocomplete_input_.parts().ref.is_nonempty()) { | 265 !autocomplete_input_.parts().ref.is_nonempty()) { |
| 266 // Not visited, but we've seen the host before. | 266 // Not visited, but we've seen the host before. |
| 267 will_have_url_what_you_typed_match_first = true; | 267 will_have_url_what_you_typed_match_first = true; |
| 268 if (net::RegistryControlledDomainService::GetRegistryLength( | 268 const size_t registry_length = |
| 269 host, false) == 0) { | 269 net::registry_controlled_domains::GetRegistryLength( |
| 270 host, |
| 271 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
| 272 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| 273 if (registry_length == 0) { |
| 270 // Known intranet hosts get one score. | 274 // Known intranet hosts get one score. |
| 271 url_what_you_typed_match_score = | 275 url_what_you_typed_match_score = |
| 272 HistoryURLProvider::kScoreForUnvisitedIntranetResult; | 276 HistoryURLProvider::kScoreForUnvisitedIntranetResult; |
| 273 } else { | 277 } else { |
| 274 // Known internet hosts get another. | 278 // Known internet hosts get another. |
| 275 url_what_you_typed_match_score = | 279 url_what_you_typed_match_score = |
| 276 HistoryURLProvider::kScoreForWhatYouTypedResult; | 280 HistoryURLProvider::kScoreForWhatYouTypedResult; |
| 277 } | 281 } |
| 278 } | 282 } |
| 279 } | 283 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 do { | 416 do { |
| 413 offset += matches[i].length; | 417 offset += matches[i].length; |
| 414 ++i; | 418 ++i; |
| 415 } while ((i < match_count) && (offset == matches[i].offset)); | 419 } while ((i < match_count) && (offset == matches[i].offset)); |
| 416 if (offset < text_length) | 420 if (offset < text_length) |
| 417 spans.push_back(ACMatchClassification(offset, url_style)); | 421 spans.push_back(ACMatchClassification(offset, url_style)); |
| 418 } | 422 } |
| 419 | 423 |
| 420 return spans; | 424 return spans; |
| 421 } | 425 } |
| OLD | NEW |