autocomplete_classifier.h revision 3345a6884c488ff3a535c2c9acdd33d74b37e311
1// Copyright (c) 2010 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#ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CLASSIFIER_H_ 6#define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CLASSIFIER_H_ 7#pragma once 8 9#include <string> 10 11#include "base/basictypes.h" 12#include "base/scoped_ptr.h" 13 14class AutocompleteController; 15struct AutocompleteMatch; 16class GURL; 17class Profile; 18 19class AutocompleteClassifier { 20 public: 21 explicit AutocompleteClassifier(Profile* profile); 22 virtual ~AutocompleteClassifier(); 23 24 // Given some string |text| that the user wants to use for navigation, 25 // determines how it should be interpreted. |desired_tld| is the user's 26 // desired TLD, if any; see AutocompleteInput::desired_tld(). |match| should 27 // be a non-NULL outparam that will be set to the default match for this 28 // input, if any (for invalid input, there will be no default match, and 29 // |match| will be left unchanged). |alternate_nav_url| is a possibly-NULL 30 // outparam that, if non-NULL, will be set to the navigational URL (if any) in 31 // case of an accidental search; see comments on 32 // AutocompleteResult::alternate_nav_url_ in autocomplete.h. 33 void Classify(const std::wstring& text, 34 const std::wstring& desired_tld, 35 AutocompleteMatch* match, 36 GURL* alternate_nav_url); 37 38 private: 39 scoped_ptr<AutocompleteController> controller_; 40 41 DISALLOW_IMPLICIT_CONSTRUCTORS(AutocompleteClassifier); 42}; 43 44#endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CLASSIFIER_H_ 45