• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.globalsearch;
18 
19 import android.content.ComponentName;
20 
21 /**
22  * Contains methods to create special results for the suggestion list such as "search the web",
23  * "more results" and the corpus results.
24  */
25 public interface SuggestionFactory extends SourceSuggestionBacker.MoreExpanderFactory,
26         SourceSuggestionBacker.CorpusResultFactory {
27 
28     /**
29      * Gets the component name that the suggestions returned by this factory
30      * return from {@link SuggestionData#getSource()}.
31      */
getSource()32     public ComponentName getSource();
33 
34     /**
35      * Creates a one-off suggestion for searching the web with the current query.
36      * The description can be a format string with one string value, which will be
37      * filled in by the provided query argument.
38      *
39      * @param query The query
40      */
createSearchTheWebSuggestion(String query)41     public SuggestionData createSearchTheWebSuggestion(String query);
42 
43     /**
44      * Creates a shortcut for a search made by the user without using a suggestion.
45      *
46      * @param query The query
47      */
createWebSearchShortcut(String query)48     public SuggestionData createWebSearchShortcut(String query);
49 
50     /**
51      * Creates a one-off suggestion for visiting the url specified by the current query,
52      * or null if the current query does not look like a url.
53      *
54      * @param query The query
55      */
createGoToWebsiteSuggestion(String query)56     public SuggestionData createGoToWebsiteSuggestion(String query);
57 
58 }
59