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