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

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

Issue 10694085: Refactor extension event distribution to use Values instead of JSON strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix. Created 8 years, 5 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 81aaabb9592bd9a4a9963168745e6e8ad796b953..3a332019aea01e7fb3fbebd8a840fa07ba570270 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
@@ -52,7 +52,7 @@ const char kDescriptionStylesLength[] = "length";
void ExtensionOmniboxEventRouter::OnInputStarted(
Profile* profile, const std::string& extension_id) {
profile->GetExtensionEventRouter()->DispatchEventToExtension(
- extension_id, events::kOnInputStarted, "[]", profile, GURL());
+ extension_id, events::kOnInputStarted, NULL, profile, GURL());
}
// static
@@ -63,14 +63,12 @@ bool ExtensionOmniboxEventRouter::OnInputChanged(
extension_id, events::kOnInputChanged))
return false;
- ListValue args;
- args.Set(0, Value::CreateStringValue(input));
- args.Set(1, Value::CreateIntegerValue(suggest_id));
- std::string json_args;
- base::JSONWriter::Write(&args, &json_args);
+ ListValue* args = new ListValue();
+ args->Set(0, Value::CreateStringValue(input));
+ args->Set(1, Value::CreateIntegerValue(suggest_id));
profile->GetExtensionEventRouter()->DispatchEventToExtension(
- extension_id, events::kOnInputChanged, json_args, profile, GURL());
+ extension_id, events::kOnInputChanged, args, profile, GURL());
return true;
}
@@ -79,10 +77,8 @@ void ExtensionOmniboxEventRouter::OnInputEntered(
TabContents* tab_contents,
const std::string& extension_id,
const std::string& input) {
- ListValue args;
- args.Set(0, Value::CreateStringValue(input));
- std::string json_args;
- base::JSONWriter::Write(&args, &json_args);
+ ListValue* args = new ListValue();
+ args->Set(0, Value::CreateStringValue(input));
tab_contents->extension_tab_helper()->active_tab_permission_manager()->
GrantIfRequested(extension_id);
@@ -90,7 +86,7 @@ void ExtensionOmniboxEventRouter::OnInputEntered(
Profile* profile = tab_contents->profile();
profile->GetExtensionEventRouter()->DispatchEventToExtension(
- extension_id, events::kOnInputEntered, json_args, profile, GURL());
+ extension_id, events::kOnInputEntered, args, profile, GURL());
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED,
@@ -102,7 +98,7 @@ void ExtensionOmniboxEventRouter::OnInputEntered(
void ExtensionOmniboxEventRouter::OnInputCancelled(
Profile* profile, const std::string& extension_id) {
profile->GetExtensionEventRouter()->DispatchEventToExtension(
- extension_id, events::kOnInputCancelled, "[]", profile, GURL());
+ extension_id, events::kOnInputCancelled, NULL, profile, GURL());
}
bool OmniboxSendSuggestionsFunction::RunImpl() {

Powered by Google App Engine
This is Rietveld 408576698