Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2575)

Unified Diff: chrome/browser/extensions/api/omnibox/omnibox_api.cc

Issue 14960004: Fix mismatched parameter expectations between chrome.omnibox setDefaultSuggestion and SuggestResult (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@omniboxJSON
Patch Set: Modify SetOmniboxDefaultSuggestion to generate a dictionary compatible with api::omnibox::SuggestRe… Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/omnibox/omnibox_api.cc
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
index cff0c8420d85ab44daba9fb8ba96065bed3c991b..0a09d60bd4551cf6de4bc5acba1a12f41b8bf61b 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
@@ -86,17 +86,19 @@ scoped_ptr<omnibox::SuggestResult> GetOmniboxDefaultSuggestion(
// Tries to set the omnibox default suggestion; returns true on success or
// false on failure.
-bool SetOmniboxDefaultSuggestion(Profile* profile,
- const std::string& extension_id,
- const omnibox::SuggestResult& suggestion) {
+bool SetOmniboxDefaultSuggestion(
+ Profile* profile,
+ const std::string& extension_id,
+ const omnibox::DefaultSuggestResult& suggestion) {
ExtensionPrefs* prefs =
ExtensionSystem::Get(profile)->extension_service()->extension_prefs();
if (!prefs)
return false;
scoped_ptr<base::DictionaryValue> dict = suggestion.ToValue();
- // A default suggestion should not have the content field set.
- dict->Remove(kSuggestionContent, NULL);
+ // Add the content field so that the dictionary can be used to populate an
+ // omnibox::SuggestResult.
+ dict->SetWithoutPathExpansion(kSuggestionContent, new base::StringValue(""));
prefs->UpdateExtensionPref(extension_id,
kOmniboxDefaultSuggestion,
dict.release());
« no previous file with comments | « no previous file | chrome/browser/extensions/api/omnibox/omnibox_unittest.cc » ('j') | chrome/common/extensions/api/omnibox.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698