blob: ce833da5c9ce6492cb0de044452f73be458bf96b [file] [log] [blame]
[email protected]17510602014-06-05 11:02:281// 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// KeywordExtensionsDelegate contains the extensions-only logic used by
6// KeywordProvider.
7// This file contains the dummy implementation of KeywordExtensionsDelegate,
8// which does nothing.
9
blundell2102f7c2015-07-09 10:00:5310#ifndef COMPONENTS_OMNIBOX_BROWSER_KEYWORD_EXTENSIONS_DELEGATE_H_
11#define COMPONENTS_OMNIBOX_BROWSER_KEYWORD_EXTENSIONS_DELEGATE_H_
[email protected]17510602014-06-05 11:02:2812
13#include <string>
14
[email protected]17510602014-06-05 11:02:2815#include "base/macros.h"
16#include "base/strings/string16.h"
17
18class AutocompleteInput;
19class KeywordProvider;
[email protected]17510602014-06-05 11:02:2820class TemplateURL;
21
22class KeywordExtensionsDelegate {
23 public:
24 explicit KeywordExtensionsDelegate(KeywordProvider* provider);
25 virtual ~KeywordExtensionsDelegate();
26
27 // Increments the input ID used to identify if the suggest results from an
28 // extension are current.
29 virtual void IncrementInputId();
30
[email protected]7de9be12014-08-13 10:07:4531 // Returns true if an extension is enabled.
32 virtual bool IsEnabledExtension(const std::string& extension_id);
[email protected]17510602014-06-05 11:02:2833
34 // Handles the extensions portion of KeywordProvider::Start().
35 // Depending on |minimal_changes| and whether |input| wants matches
36 // synchronous or not, either updates the KeywordProvider's matches with
37 // the existing suggestions or asks the |template_url|'s extension to provide
38 // matches.
39 // Returns true if this delegate should stay in extension keyword mode.
40 virtual bool Start(const AutocompleteInput& input,
41 bool minimal_changes,
42 const TemplateURL* template_url,
43 const base::string16& remaining_input);
44
45 // Tells the extension with |extension_id| that the user typed the omnibox
46 // keyword.
47 virtual void EnterExtensionKeywordMode(const std::string& extension_id);
48
49 // If an extension previously entered extension keyword mode, exits extension
50 // keyword mode. This happens when the user has cleared the keyword or closed
51 // the omnibox popup.
52 virtual void MaybeEndExtensionKeywordMode();
53
54 private:
55 DISALLOW_COPY_AND_ASSIGN(KeywordExtensionsDelegate);
56};
57
blundell2102f7c2015-07-09 10:00:5358#endif // COMPONENTS_OMNIBOX_BROWSER_KEYWORD_EXTENSIONS_DELEGATE_H_