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 result->SetString(std::string("audioConstraints.mandatory.") + | 110 result->SetString(std::string("audioConstraints.mandatory.") + |
111 kMediaStreamSource, kMediaStreamSourceTab); | 111 kMediaStreamSource, kMediaStreamSourceTab); |
112 result->SetString(std::string("audioConstraints.mandatory.") + | 112 result->SetString(std::string("audioConstraints.mandatory.") + |
113 kMediaStreamSourceId, device_id); | 113 kMediaStreamSourceId, device_id); |
114 } else { | 114 } else { |
115 result->SetBoolean(std::string("audioConstraints"), false); | 115 result->SetBoolean(std::string("audioConstraints"), false); |
116 } | 116 } |
117 | 117 |
118 extensions::TabCaptureRegistry* registry = | 118 extensions::TabCaptureRegistry* registry = |
119 extensions::TabCaptureRegistryFactory::GetForProfile(profile()); | 119 extensions::TabCaptureRegistryFactory::GetForProfile(profile()); |
120 if (!registry->AddRequest(device_id, TabCaptureRegistry::TabCaptureRequest( | 120 if (!registry->AddRequest( |
121 GetExtension()->id(), tab_id, | 121 std::make_pair(render_process_id, routing_id), |
122 tab_capture::TAB_CAPTURE_TAB_CAPTURE_STATE_NONE))) { | 122 TabCaptureRegistry::TabCaptureRequest( |
| 123 GetExtension()->id(), tab_id, |
| 124 tab_capture::TAB_CAPTURE_TAB_CAPTURE_STATE_NONE))) { |
123 error_ = kCapturingSameTab; | 125 error_ = kCapturingSameTab; |
124 SetResult(base::Value::CreateIntegerValue(0)); | 126 SetResult(base::Value::CreateIntegerValue(0)); |
125 return false; | 127 return false; |
126 } | 128 } |
127 | 129 |
128 SetResult(result); | 130 SetResult(result); |
129 return true; | 131 return true; |
130 } | 132 } |
131 | 133 |
132 bool TabCaptureGetCapturedTabsFunction::RunImpl() { | 134 bool TabCaptureGetCapturedTabsFunction::RunImpl() { |
(...skipping 16 matching lines...) Expand all Loading... |
149 info->tab_id = it->tab_id; | 151 info->tab_id = it->tab_id; |
150 info->status = it->status; | 152 info->status = it->status; |
151 list->Append(info->ToValue().release()); | 153 list->Append(info->ToValue().release()); |
152 } | 154 } |
153 | 155 |
154 SetResult(list); | 156 SetResult(list); |
155 return true; | 157 return true; |
156 } | 158 } |
157 | 159 |
158 } // namespace extensions | 160 } // namespace extensions |
OLD | NEW |