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 #include "chrome/browser/extensions/api/rtc_private/rtc_private_api.h" | 5 #include "chrome/browser/extensions/api/rtc_private/rtc_private_api.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Creates JSON payload string for contact web intent data. | 60 // Creates JSON payload string for contact web intent data. |
61 void GetContactIntentData(const Contact& contact, | 61 void GetContactIntentData(const Contact& contact, |
62 DictionaryValue* dict) { | 62 DictionaryValue* dict) { |
63 // TODO(derat): This might require more name extraction magic than this. | 63 // TODO(derat): This might require more name extraction magic than this. |
64 dict->SetString(kNameIntentField, contact.full_name()); | 64 dict->SetString(kNameIntentField, contact.full_name()); |
65 | 65 |
66 ListValue* phone_list = new base::ListValue(); | 66 ListValue* phone_list = new base::ListValue(); |
67 dict->Set(kPhoneIntentField, phone_list); | 67 dict->Set(kPhoneIntentField, phone_list); |
68 for (int i = 0; i < contact.phone_numbers_size(); i++) { | 68 for (int i = 0; i < contact.phone_numbers_size(); i++) { |
69 const Contact_PhoneNumber& phone_number = contact.phone_numbers(i); | 69 const Contact_PhoneNumber& phone_number = contact.phone_numbers(i); |
70 StringValue* value = Value::CreateStringValue(phone_number.number()); | 70 StringValue* value = new base::StringValue(phone_number.number()); |
71 if (phone_number.primary()) | 71 if (phone_number.primary()) |
72 CHECK(phone_list->Insert(0, value)); | 72 CHECK(phone_list->Insert(0, value)); |
73 else | 73 else |
74 phone_list->Append(value); | 74 phone_list->Append(value); |
75 } | 75 } |
76 | 76 |
77 ListValue* email_list = new base::ListValue(); | 77 ListValue* email_list = new base::ListValue(); |
78 dict->Set(kEmailIntentField, email_list); | 78 dict->Set(kEmailIntentField, email_list); |
79 for (int i = 0; i < contact.email_addresses_size(); i++) { | 79 for (int i = 0; i < contact.email_addresses_size(); i++) { |
80 const Contact_EmailAddress& email_address = contact.email_addresses(i); | 80 const Contact_EmailAddress& email_address = contact.email_addresses(i); |
81 StringValue* value = Value::CreateStringValue(email_address.address()); | 81 StringValue* value = new base::StringValue(email_address.address()); |
82 if (email_address.primary()) | 82 if (email_address.primary()) |
83 CHECK(email_list->Insert(0, value)); | 83 CHECK(email_list->Insert(0, value)); |
84 else | 84 else |
85 email_list->Append(value); | 85 email_list->Append(value); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 } // namespace | 89 } // namespace |
90 | 90 |
91 void RtcPrivateEventRouter::DispatchLaunchEvent( | 91 void RtcPrivateEventRouter::DispatchLaunchEvent( |
(...skipping 11 matching lines...) Expand all Loading... |
103 &launch_data.intent.data.additional_properties); | 103 &launch_data.intent.data.additional_properties); |
104 launch_data.intent.type = kMimeTypeJson; | 104 launch_data.intent.type = kMimeTypeJson; |
105 scoped_ptr<Event> event(new Event( | 105 scoped_ptr<Event> event(new Event( |
106 kOnLaunchEvent, api::rtc_private::OnLaunch::Create(launch_data))); | 106 kOnLaunchEvent, api::rtc_private::OnLaunch::Create(launch_data))); |
107 event->restrict_to_profile = profile; | 107 event->restrict_to_profile = profile; |
108 ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass()); | 108 ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass()); |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 } // namespace extensions | 112 } // namespace extensions |
OLD | NEW |