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 3 // found in the LICENSE file. 4 5 #include "chrome/browser/autocomplete/history_provider_util.h" 6 7 #include "base/logging.h" 8 9 namespace history { 10 11 HistoryMatch::HistoryMatch() 12 : url_info(), 13 input_location(base::string16::npos), 14 match_in_scheme(false), 15 innermost_match(true), 16 promoted(false) { 17 } 18 19 HistoryMatch::HistoryMatch(const URLRow& url_info, 20 size_t input_location, 21 bool match_in_scheme, 22 bool innermost_match) 23 : url_info(url_info), 24 input_location(input_location), 25 match_in_scheme(match_in_scheme), 26 innermost_match(innermost_match), 27 promoted(false) { 28 } 29 30 bool HistoryMatch::EqualsGURL(const HistoryMatch& h, const GURL& url) { 31 return h.url_info.url() == url; 32 } 33 34 bool HistoryMatch::IsHostOnly() const { 35 const GURL& gurl = url_info.url(); 36 DCHECK(gurl.is_valid()); 37 return (!gurl.has_path() || (gurl.path() == "/")) && !gurl.has_query() && 38 !gurl.has_ref(); 39 } 40 41 } // namespace history 42