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 // Implements the Chrome Extensions Tab Capture API. | 5 // Implements the Chrome Extensions Tab Capture API. |
6 | 6 |
7 #include "chrome/browser/extensions/api/tab_capture/tab_capture_api.h" | 7 #include "chrome/browser/extensions/api/tab_capture/tab_capture_api.h" |
8 | 8 |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 constraint->SetString(kMediaStreamSource, kMediaStreamSourceTab); | 110 constraint->SetString(kMediaStreamSource, kMediaStreamSourceTab); |
111 constraint->SetString(kMediaStreamSourceId, device_id); | 111 constraint->SetString(kMediaStreamSourceId, device_id); |
112 } | 112 } |
113 | 113 |
114 extensions::TabCaptureRegistry* registry = | 114 extensions::TabCaptureRegistry* registry = |
115 extensions::TabCaptureRegistryFactory::GetForProfile(profile()); | 115 extensions::TabCaptureRegistryFactory::GetForProfile(profile()); |
116 if (!registry->AddRequest( | 116 if (!registry->AddRequest( |
117 std::make_pair(render_process_id, routing_id), | 117 std::make_pair(render_process_id, routing_id), |
118 TabCaptureRegistry::TabCaptureRequest( | 118 TabCaptureRegistry::TabCaptureRequest( |
119 GetExtension()->id(), tab_id, | 119 GetExtension()->id(), tab_id, |
120 tab_capture::TAB_CAPTURE_TAB_CAPTURE_STATE_NONE))) { | 120 tab_capture::TAB_CAPTURE_STATE_NONE))) { |
121 error_ = kCapturingSameTab; | 121 error_ = kCapturingSameTab; |
122 return false; | 122 return false; |
123 } | 123 } |
124 | 124 |
125 // Copy the result from our modified input parameters. This will be | 125 // Copy the result from our modified input parameters. This will be |
126 // intercepted by custom bindings which will build and send the special | 126 // intercepted by custom bindings which will build and send the special |
127 // WebRTC user media request. | 127 // WebRTC user media request. |
128 base::DictionaryValue* result = new base::DictionaryValue(); | 128 base::DictionaryValue* result = new base::DictionaryValue(); |
129 result->MergeDictionary(params->options.ToValue().get()); | 129 result->MergeDictionary(params->options.ToValue().get()); |
130 | 130 |
(...skipping 20 matching lines...) Expand all Loading... |
151 info->tab_id = it->tab_id; | 151 info->tab_id = it->tab_id; |
152 info->status = it->status; | 152 info->status = it->status; |
153 list->Append(info->ToValue().release()); | 153 list->Append(info->ToValue().release()); |
154 } | 154 } |
155 | 155 |
156 SetResult(list); | 156 SetResult(list); |
157 return true; | 157 return true; |
158 } | 158 } |
159 | 159 |
160 } // namespace extensions | 160 } // namespace extensions |
OLD | NEW |