• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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_AUTOCOMPLETE_PROVIDER_CLIENT_H_
6 #define COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_CLIENT_H_
7 
8 #include "base/strings/string16.h"
9 #include "components/history/core/browser/keyword_id.h"
10 #include "components/metrics/proto/omnibox_event.pb.h"
11 
12 struct AutocompleteMatch;
13 class AutocompleteSchemeClassifier;
14 class GURL;
15 
16 namespace history {
17 class URLDatabase;
18 }
19 
20 namespace net {
21 class URLRequestContextGetter;
22 }
23 
24 class AutocompleteProviderClient {
25  public:
~AutocompleteProviderClient()26   virtual ~AutocompleteProviderClient() {}
27 
28   // Returns the request context.
29   virtual net::URLRequestContextGetter* RequestContext() = 0;
30 
31   // Returns whether the provider should work in incognito mode.
32   virtual bool IsOffTheRecord() = 0;
33 
34   // The value to use for Accept-Languages HTTP header when making an HTTP
35   // request.
36   virtual std::string AcceptLanguages() = 0;
37 
38   // Returns true when suggest support is enabled.
39   virtual bool SearchSuggestEnabled() = 0;
40 
41   // Returns whether the bookmark bar is visible on all tabs.
42   virtual bool ShowBookmarkBar() = 0;
43 
44   // Returns the scheme classifier.
45   virtual const AutocompleteSchemeClassifier& SchemeClassifier() = 0;
46 
47   // Given some string |text| that the user wants to use for navigation,
48   // determines how it should be interpreted.
49   virtual void Classify(
50       const base::string16& text,
51       bool prefer_keyword,
52       bool allow_exact_keyword_match,
53       metrics::OmniboxEventProto::PageClassification page_classification,
54       AutocompleteMatch* match,
55       GURL* alternate_nav_url) = 0;
56 
57   // Returns the in-memory URL database.
58   virtual history::URLDatabase* InMemoryDatabase() = 0;
59 
60   // Deletes all URL and search term entries matching the given |term| and
61   // |keyword_id| from history.
62   virtual void DeleteMatchingURLsForKeywordFromHistory(
63       history::KeywordID keyword_id,
64       const base::string16& term) = 0;
65 
66   // Returns whether the user has tab sync enabled and tab sync is unencrypted.
67   virtual bool TabSyncEnabledAndUnencrypted() = 0;
68 
69   // Starts prefetching the image at the given |url|.
70   virtual void PrefetchImage(const GURL& url) = 0;
71 };
72 
73 #endif  // COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_CLIENT_H_
74