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

Unified Diff: chrome/browser/extensions/api/rtc_private/rtc_private_api.cc

Issue 11827026: Overhaul JSON Schema Compiler to support a number of features required to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yoz Created 7 years, 11 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/rtc_private/rtc_private_api.cc
diff --git a/chrome/browser/extensions/api/rtc_private/rtc_private_api.cc b/chrome/browser/extensions/api/rtc_private/rtc_private_api.cc
index 04afc5ab123a3b638f7155de1b7f6b34b8990d54..30ec7887c728b16f1f617f9e9c01f5285780b6bd 100644
--- a/chrome/browser/extensions/api/rtc_private/rtc_private_api.cc
+++ b/chrome/browser/extensions/api/rtc_private/rtc_private_api.cc
@@ -46,25 +46,28 @@ api::rtc_private::ActionType GetLaunchAction(
RtcPrivateEventRouter::LaunchAction action) {
switch (action) {
case RtcPrivateEventRouter::LAUNCH_ACTIVATE:
- return api::rtc_private::RTC_PRIVATE_ACTION_TYPE_NONE;
+ return api::rtc_private::ACTION_TYPE_NONE;
case RtcPrivateEventRouter::LAUNCH_CHAT:
- return api::rtc_private::RTC_PRIVATE_ACTION_TYPE_CHAT;
+ return api::rtc_private::ACTION_TYPE_CHAT;
case RtcPrivateEventRouter::LAUNCH_VOICE:
- return api::rtc_private::RTC_PRIVATE_ACTION_TYPE_VOICE;
+ return api::rtc_private::ACTION_TYPE_VOICE;
case RtcPrivateEventRouter::LAUNCH_VIDEO:
- return api::rtc_private::RTC_PRIVATE_ACTION_TYPE_VIDEO;
+ return api::rtc_private::ACTION_TYPE_VIDEO;
}
- return api::rtc_private::RTC_PRIVATE_ACTION_TYPE_NONE;
+ return api::rtc_private::ACTION_TYPE_NONE;
}
// Creates JSON payload string for contact web intent data.
-void GetContactIntentData(const Contact& contact,
- DictionaryValue* dict) {
+std::map<std::string, linked_ptr<base::Value> > GetContactIntentData(
+ const Contact& contact) {
+ std::map<std::string, linked_ptr<base::Value> > dict;
+
// TODO(derat): This might require more name extraction magic than this.
- dict->SetString(kNameIntentField, contact.full_name());
+ dict[kNameIntentField] =
+ linked_ptr<base::Value>(new base::StringValue(contact.full_name()));
ListValue* phone_list = new base::ListValue();
- dict->Set(kPhoneIntentField, phone_list);
+ dict[kPhoneIntentField] = linked_ptr<base::Value>(phone_list);
for (int i = 0; i < contact.phone_numbers_size(); i++) {
const Contact_PhoneNumber& phone_number = contact.phone_numbers(i);
StringValue* value = Value::CreateStringValue(phone_number.number());
@@ -75,7 +78,7 @@ void GetContactIntentData(const Contact& contact,
}
ListValue* email_list = new base::ListValue();
- dict->Set(kEmailIntentField, email_list);
+ dict[kEmailIntentField] = linked_ptr<base::Value>(email_list);
for (int i = 0; i < contact.email_addresses_size(); i++) {
const Contact_EmailAddress& email_address = contact.email_addresses(i);
StringValue* value = Value::CreateStringValue(email_address.address());
@@ -84,6 +87,8 @@ void GetContactIntentData(const Contact& contact,
else
email_list->Append(value);
}
+
+ return dict;
}
} // namespace
@@ -99,8 +104,8 @@ void RtcPrivateEventRouter::DispatchLaunchEvent(
DCHECK(contact);
extensions::api::rtc_private::LaunchData launch_data;
launch_data.intent.action = GetLaunchAction(action);
- GetContactIntentData(*contact,
- &launch_data.intent.data.additional_properties);
+ launch_data.intent.data.additional_properties =
+ GetContactIntentData(*contact);
launch_data.intent.type = kMimeTypeJson;
scoped_ptr<Event> event(new Event(
kOnLaunchEvent, api::rtc_private::OnLaunch::Create(launch_data)));

Powered by Google App Engine
This is Rietveld 408576698