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