| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/desktop_capture/desktop_capture_api.h" | 5 #include "chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/extension_tab_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | 201 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) |
| 202 picker_ = DesktopMediaPicker::Create(); | 202 picker_ = DesktopMediaPicker::Create(); |
| 203 #else | 203 #else |
| 204 error_ = "Desktop Capture API is not yet implemented for this platform."; | 204 error_ = "Desktop Capture API is not yet implemented for this platform."; |
| 205 return false; | 205 return false; |
| 206 #endif | 206 #endif |
| 207 } | 207 } |
| 208 DesktopMediaPicker::DoneCallback callback = base::Bind( | 208 DesktopMediaPicker::DoneCallback callback = base::Bind( |
| 209 &DesktopCaptureChooseDesktopMediaFunction::OnPickerDialogResults, this); | 209 &DesktopCaptureChooseDesktopMediaFunction::OnPickerDialogResults, this); |
| 210 | 210 |
| 211 picker_->Show(parent_window, parent_window, | 211 picker_->Show(web_contents(), |
| 212 parent_window, parent_window, |
| 212 base::UTF8ToUTF16(GetExtension()->name()), | 213 base::UTF8ToUTF16(GetExtension()->name()), |
| 213 target_name, | 214 target_name, |
| 214 media_list.Pass(), callback); | 215 media_list.Pass(), callback); |
| 215 return true; | 216 return true; |
| 216 } | 217 } |
| 217 | 218 |
| 218 void DesktopCaptureChooseDesktopMediaFunction::WebContentsDestroyed() { | 219 void DesktopCaptureChooseDesktopMediaFunction::WebContentsDestroyed() { |
| 219 Cancel(); | 220 Cancel(); |
| 220 } | 221 } |
| 221 | 222 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 292 |
| 292 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, | 293 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, |
| 293 int request_id) { | 294 int request_id) { |
| 294 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); | 295 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); |
| 295 if (it != requests_.end()) | 296 if (it != requests_.end()) |
| 296 it->second->Cancel(); | 297 it->second->Cancel(); |
| 297 } | 298 } |
| 298 | 299 |
| 299 | 300 |
| 300 } // namespace extensions | 301 } // namespace extensions |
| OLD | NEW |