OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_OMNIBOX_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_OMNIBOX_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_OMNIBOX_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_OMNIBOX_API_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "chrome/browser/autocomplete/autocomplete_match.h" | 13 #include "chrome/browser/autocomplete/autocomplete_match.h" |
14 #include "chrome/browser/extensions/extension_function.h" | 14 #include "chrome/browser/extensions/extension_function.h" |
15 #include "webkit/glue/window_open_disposition.h" | 15 #include "webkit/glue/window_open_disposition.h" |
16 | 16 |
| 17 namespace base { |
| 18 class ListValue; |
| 19 } |
| 20 |
17 // Event router class for events related to the omnibox API. | 21 // Event router class for events related to the omnibox API. |
18 class ExtensionOmniboxEventRouter { | 22 class ExtensionOmniboxEventRouter { |
19 public: | 23 public: |
20 // The user has just typed the omnibox keyword. This is sent exactly once in | 24 // The user has just typed the omnibox keyword. This is sent exactly once in |
21 // a given input session, before any OnInputChanged events. | 25 // a given input session, before any OnInputChanged events. |
22 static void OnInputStarted( | 26 static void OnInputStarted( |
23 Profile* profile, const std::string& extension_id); | 27 Profile* profile, const std::string& extension_id); |
24 | 28 |
25 // The user has changed what is typed into the omnibox while in an extension | 29 // The user has changed what is typed into the omnibox while in an extension |
26 // keyword session. Returns true if someone is listening to this event, and | 30 // keyword session. Returns true if someone is listening to this event, and |
(...skipping 27 matching lines...) Expand all Loading... |
54 virtual bool RunImpl(); | 58 virtual bool RunImpl(); |
55 DECLARE_EXTENSION_FUNCTION_NAME("omnibox.setDefaultSuggestion"); | 59 DECLARE_EXTENSION_FUNCTION_NAME("omnibox.setDefaultSuggestion"); |
56 }; | 60 }; |
57 | 61 |
58 struct ExtensionOmniboxSuggestion { | 62 struct ExtensionOmniboxSuggestion { |
59 ExtensionOmniboxSuggestion(); | 63 ExtensionOmniboxSuggestion(); |
60 ~ExtensionOmniboxSuggestion(); | 64 ~ExtensionOmniboxSuggestion(); |
61 | 65 |
62 // Converts a list of style ranges from the extension into the format expected | 66 // Converts a list of style ranges from the extension into the format expected |
63 // by the autocomplete system. | 67 // by the autocomplete system. |
64 bool ReadStylesFromValue(const ListValue& value); | 68 bool ReadStylesFromValue(const base::ListValue& value); |
65 | 69 |
66 // The text that gets put in the edit box. | 70 // The text that gets put in the edit box. |
67 string16 content; | 71 string16 content; |
68 | 72 |
69 // The text that is displayed in the drop down. | 73 // The text that is displayed in the drop down. |
70 string16 description; | 74 string16 description; |
71 | 75 |
72 // Contains style ranges for the description. | 76 // Contains style ranges for the description. |
73 ACMatchClassifications description_styles; | 77 ACMatchClassifications description_styles; |
74 }; | 78 }; |
(...skipping 19 matching lines...) Expand all Loading... |
94 AutocompleteMatch* match); | 98 AutocompleteMatch* match); |
95 | 99 |
96 // Launch an Extension App from |match| details provided by the Omnibox. If the | 100 // Launch an Extension App from |match| details provided by the Omnibox. If the |
97 // application wants to launch as a window or panel, |disposition| is ignored; | 101 // application wants to launch as a window or panel, |disposition| is ignored; |
98 // otherwise it's used to determine in which tab we'll launch the application. | 102 // otherwise it's used to determine in which tab we'll launch the application. |
99 void LaunchAppFromOmnibox(const AutocompleteMatch& match, | 103 void LaunchAppFromOmnibox(const AutocompleteMatch& match, |
100 Profile* profile, | 104 Profile* profile, |
101 WindowOpenDisposition disposition); | 105 WindowOpenDisposition disposition); |
102 | 106 |
103 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_OMNIBOX_API_H_ | 107 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_OMNIBOX_API_H_ |
OLD | NEW |