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 #ifndef COMPONENTS_OMNIBOX_BROWSER_BUILTIN_PROVIDER_H_
6 #define COMPONENTS_OMNIBOX_BROWSER_BUILTIN_PROVIDER_H_
7 
8 #include <vector>
9 
10 #include "base/compiler_specific.h"
11 #include "base/strings/string16.h"
12 #include "components/omnibox/browser/autocomplete_match.h"
13 #include "components/omnibox/browser/autocomplete_provider.h"
14 
15 class AutocompleteProviderClient;
16 
17 // This is the provider for built-in URLs, such as about:settings and
18 // chrome://version.
19 class BuiltinProvider : public AutocompleteProvider {
20  public:
21   explicit BuiltinProvider(AutocompleteProviderClient* client);
22   BuiltinProvider(const BuiltinProvider&) = delete;
23   BuiltinProvider& operator=(const BuiltinProvider&) = delete;
24 
25   // AutocompleteProvider:
26   void Start(const AutocompleteInput& input, bool minimal_changes) override;
27 
28  private:
29   ~BuiltinProvider() override;
30 
31   typedef std::vector<base::string16> Builtins;
32 
33   static const int kRelevance;
34 
35   void AddMatch(const base::string16& match_string,
36                 const base::string16& inline_completion,
37                 const ACMatchClassifications& styles);
38 
39   // Returns true if |matches_| contains a match that should be allowed to be
40   // the default match. If true, the index of that match in |matches_| is
41   // returned in |index|.
42   bool HasMatchThatShouldBeDefault(size_t* index) const;
43 
44   AutocompleteProviderClient* client_;
45   Builtins builtins_;
46 };
47 
48 #endif  // COMPONENTS_OMNIBOX_BROWSER_BUILTIN_PROVIDER_H_
49