| 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.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Web intent data structure fields. | 39 // Web intent data structure fields. |
| 40 const char kNameIntentField[] = "name"; | 40 const char kNameIntentField[] = "name"; |
| 41 const char kPhoneIntentField[] = "phone"; | 41 const char kPhoneIntentField[] = "phone"; |
| 42 const char kEmailIntentField[] = "email"; | 42 const char kEmailIntentField[] = "email"; |
| 43 | 43 |
| 44 // Returns the ActionType of intent action. | 44 // Returns the ActionType of intent action. |
| 45 api::rtc_private::ActionType GetLaunchAction( | 45 api::rtc_private::ActionType GetLaunchAction( |
| 46 RtcPrivateEventRouter::LaunchAction action) { | 46 RtcPrivateEventRouter::LaunchAction action) { |
| 47 switch (action) { | 47 switch (action) { |
| 48 case RtcPrivateEventRouter::LAUNCH_ACTIVATE: | 48 case RtcPrivateEventRouter::LAUNCH_ACTIVATE: |
| 49 return api::rtc_private::RTC_PRIVATE_ACTION_TYPE_NONE; | 49 return api::rtc_private::ACTION_TYPE_NONE; |
| 50 case RtcPrivateEventRouter::LAUNCH_CHAT: | 50 case RtcPrivateEventRouter::LAUNCH_CHAT: |
| 51 return api::rtc_private::RTC_PRIVATE_ACTION_TYPE_CHAT; | 51 return api::rtc_private::ACTION_TYPE_CHAT; |
| 52 case RtcPrivateEventRouter::LAUNCH_VOICE: | 52 case RtcPrivateEventRouter::LAUNCH_VOICE: |
| 53 return api::rtc_private::RTC_PRIVATE_ACTION_TYPE_VOICE; | 53 return api::rtc_private::ACTION_TYPE_VOICE; |
| 54 case RtcPrivateEventRouter::LAUNCH_VIDEO: | 54 case RtcPrivateEventRouter::LAUNCH_VIDEO: |
| 55 return api::rtc_private::RTC_PRIVATE_ACTION_TYPE_VIDEO; | 55 return api::rtc_private::ACTION_TYPE_VIDEO; |
| 56 } | 56 } |
| 57 return api::rtc_private::RTC_PRIVATE_ACTION_TYPE_NONE; | 57 return api::rtc_private::ACTION_TYPE_NONE; |
| 58 } | 58 } |
| 59 | 59 |
| 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); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |