| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_API_OMNIBOX_OMNIBOX_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_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/memory/scoped_ptr.h" |
| 12 #include "base/string16.h" | 13 #include "base/string16.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_match.h" | 14 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 14 #include "chrome/browser/extensions/extension_function.h" | 15 #include "chrome/browser/extensions/extension_function.h" |
| 15 #include "webkit/glue/window_open_disposition.h" | 16 #include "webkit/glue/window_open_disposition.h" |
| 16 | 17 |
| 17 class TemplateURL; | 18 class TemplateURL; |
| 18 namespace base { | 19 namespace base { |
| 19 class ListValue; | 20 class ListValue; |
| 20 } | 21 } |
| 21 | 22 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 virtual ~OmniboxSetDefaultSuggestionFunction() {} | 70 virtual ~OmniboxSetDefaultSuggestionFunction() {} |
| 70 | 71 |
| 71 // ExtensionFunction: | 72 // ExtensionFunction: |
| 72 virtual bool RunImpl() OVERRIDE; | 73 virtual bool RunImpl() OVERRIDE; |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 struct ExtensionOmniboxSuggestion { | 76 struct ExtensionOmniboxSuggestion { |
| 76 ExtensionOmniboxSuggestion(); | 77 ExtensionOmniboxSuggestion(); |
| 77 ~ExtensionOmniboxSuggestion(); | 78 ~ExtensionOmniboxSuggestion(); |
| 78 | 79 |
| 80 // Populate a suggestion value from a DictionaryValue. If |require_content| |
| 81 // is false, then we won't fail if |content| is missing, to support |
| 82 // default suggestions. |
| 83 bool Populate(const base::DictionaryValue& value, bool require_content); |
| 84 |
| 79 // Converts a list of style ranges from the extension into the format expected | 85 // Converts a list of style ranges from the extension into the format expected |
| 80 // by the autocomplete system. | 86 // by the autocomplete system. |
| 81 bool ReadStylesFromValue(const base::ListValue& value); | 87 bool ReadStylesFromValue(const base::ListValue& value); |
| 82 | 88 |
| 89 // Converts this structure to a DictionaryValue suitable for saving to disk. |
| 90 scoped_ptr<base::DictionaryValue> ToValue() const; |
| 91 |
| 83 // The text that gets put in the edit box. | 92 // The text that gets put in the edit box. |
| 84 string16 content; | 93 string16 content; |
| 85 | 94 |
| 86 // The text that is displayed in the drop down. | 95 // The text that is displayed in the drop down. |
| 87 string16 description; | 96 string16 description; |
| 88 | 97 |
| 89 // Contains style ranges for the description. | 98 // Contains style ranges for the description. |
| 90 ACMatchClassifications description_styles; | 99 ACMatchClassifications description_styles; |
| 91 }; | 100 }; |
| 92 | 101 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 113 // Launch an Extension App from |match| details provided by the Omnibox. If the | 122 // Launch an Extension App from |match| details provided by the Omnibox. If the |
| 114 // application wants to launch as a window or panel, |disposition| is ignored; | 123 // application wants to launch as a window or panel, |disposition| is ignored; |
| 115 // otherwise it's used to determine in which tab we'll launch the application. | 124 // otherwise it's used to determine in which tab we'll launch the application. |
| 116 void LaunchAppFromOmnibox(const AutocompleteMatch& match, | 125 void LaunchAppFromOmnibox(const AutocompleteMatch& match, |
| 117 Profile* profile, | 126 Profile* profile, |
| 118 WindowOpenDisposition disposition); | 127 WindowOpenDisposition disposition); |
| 119 | 128 |
| 120 } // namespace extensions | 129 } // namespace extensions |
| 121 | 130 |
| 122 #endif // CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ | 131 #endif // CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ |
| OLD | NEW |