[email protected] | 1751060 | 2014-06-05 11:02:28 | [diff] [blame] | 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 | |
blundell | 2102f7c | 2015-07-09 10:00:53 | [diff] [blame] | 10 | #ifndef COMPONENTS_OMNIBOX_BROWSER_KEYWORD_EXTENSIONS_DELEGATE_H_ |
| 11 | #define COMPONENTS_OMNIBOX_BROWSER_KEYWORD_EXTENSIONS_DELEGATE_H_ |
[email protected] | 1751060 | 2014-06-05 11:02:28 | [diff] [blame] | 12 | |
| 13 | #include <string> |
| 14 | |
[email protected] | 1751060 | 2014-06-05 11:02:28 | [diff] [blame] | 15 | #include "base/macros.h" |
| 16 | #include "base/strings/string16.h" |
| 17 | |
| 18 | class AutocompleteInput; |
| 19 | class KeywordProvider; |
[email protected] | 1751060 | 2014-06-05 11:02:28 | [diff] [blame] | 20 | class TemplateURL; |
| 21 | |
| 22 | class 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] | 7de9be1 | 2014-08-13 10:07:45 | [diff] [blame] | 31 | // Returns true if an extension is enabled. |
| 32 | virtual bool IsEnabledExtension(const std::string& extension_id); |
[email protected] | 1751060 | 2014-06-05 11:02:28 | [diff] [blame] | 33 | |
| 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 | |
blundell | 2102f7c | 2015-07-09 10:00:53 | [diff] [blame] | 58 | #endif // COMPONENTS_OMNIBOX_BROWSER_KEYWORD_EXTENSIONS_DELEGATE_H_ |