diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-08 20:53:47 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-08 20:53:47 +0000 |
commit | 85b8d6fe69ab35f8bfc717825867ba5b935348e5 (patch) | |
tree | 0a7c49b0ba7b4d063abf57717306ef09662d2e54 /chrome/browser/ui/webui/omnibox | |
parent | 89e4d104837385b0a4ca422fbb769a97d08901b4 (diff) | |
download | chromium_src-85b8d6fe69ab35f8bfc717825867ba5b935348e5.zip chromium_src-85b8d6fe69ab35f8bfc717825867ba5b935348e5.tar.gz chromium_src-85b8d6fe69ab35f8bfc717825867ba5b935348e5.tar.bz2 |
Now that TemplateURLs are guaranteed to have a unique, non-empty keyword, replace AutocompleteMatch's TemplateURL* with a std::string |keyword_|. This has two benefits:
* It's safer in general, because the pointer can't be deleted out from under us. Users inherently have to recheck the TemplateURL* they get via the keyword each time they re-fetch it.
* It allows the SearchProvider to stop keeping copied TemplateURLs for the default and keyword providers (in an attempt to mitigate the above problem) and instead just keep their keywords. This will also help in removing the TemplateURL copy constructor in a later patch.
Note that there already was a |keyword_| field on AutocompleteMatch, so to make this change we have to expand its meaning a bit to cover the scenarios where before we would have had a |template_url_| but not a keyword. Code that cares about this distinction has already been migrated to using functions like GetKeywordUIState() instead of checking the member directly so this isn't terribly invasive.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10382066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135905 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/webui/omnibox')
-rw-r--r-- | chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc b/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc index 12f34c57..06dfb94 100644 --- a/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc +++ b/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc @@ -116,8 +116,7 @@ void OmniboxUIHandler::AddResultToDictionary(const std::string& prefix, it->is_history_what_you_typed_match); output->SetString(item_prefix + ".type", AutocompleteMatch::TypeToString(it->type)); - if (it->template_url != NULL) - output->SetString(item_prefix + ".template_url", it->template_url->url()); + output->SetString(item_prefix + ".keyword", it->keyword); output->SetBoolean(item_prefix + ".starred", it->starred); output->SetBoolean(item_prefix + ".from_previous", it->from_previous); } |