| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_base.h" | 5 #include "chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h" |
| 6 | 6 |
| 7 #include <tuple> | 7 #include <tuple> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 render_frame_host()->GetProcess()->GetID(), request_id_); | 58 render_frame_host()->GetProcess()->GetID(), request_id_); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 void DesktopCaptureChooseDesktopMediaFunctionBase::Cancel() { | 62 void DesktopCaptureChooseDesktopMediaFunctionBase::Cancel() { |
| 63 // Keep reference to |this| to ensure the object doesn't get destroyed before | 63 // Keep reference to |this| to ensure the object doesn't get destroyed before |
| 64 // we return. | 64 // we return. |
| 65 scoped_refptr<DesktopCaptureChooseDesktopMediaFunctionBase> self(this); | 65 scoped_refptr<DesktopCaptureChooseDesktopMediaFunctionBase> self(this); |
| 66 if (picker_) { | 66 if (picker_) { |
| 67 picker_.reset(); | 67 picker_.reset(); |
| 68 SetResult(new base::StringValue(std::string())); | 68 SetResult(base::MakeUnique<base::StringValue>(std::string())); |
| 69 SendResponse(true); | 69 SendResponse(true); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool DesktopCaptureChooseDesktopMediaFunctionBase::Execute( | 73 bool DesktopCaptureChooseDesktopMediaFunctionBase::Execute( |
| 74 const std::vector<api::desktop_capture::DesktopCaptureSourceType>& sources, | 74 const std::vector<api::desktop_capture::DesktopCaptureSourceType>& sources, |
| 75 content::WebContents* web_contents, | 75 content::WebContents* web_contents, |
| 76 const GURL& origin, | 76 const GURL& origin, |
| 77 const base::string16 target_name) { | 77 const base::string16 target_name) { |
| 78 // Register to be notified when the tab is closed. | 78 // Register to be notified when the tab is closed. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // MediaCaptureDevicesDispatcher::ProcessDesktopCaptureAccessRequest(). | 223 // MediaCaptureDevicesDispatcher::ProcessDesktopCaptureAccessRequest(). |
| 224 // http://crbug.com/304341 | 224 // http://crbug.com/304341 |
| 225 content::RenderFrameHost* const main_frame = web_contents()->GetMainFrame(); | 225 content::RenderFrameHost* const main_frame = web_contents()->GetMainFrame(); |
| 226 result = registry->RegisterStream(main_frame->GetProcess()->GetID(), | 226 result = registry->RegisterStream(main_frame->GetProcess()->GetID(), |
| 227 main_frame->GetRoutingID(), | 227 main_frame->GetRoutingID(), |
| 228 origin_, | 228 origin_, |
| 229 source, | 229 source, |
| 230 extension()->name()); | 230 extension()->name()); |
| 231 } | 231 } |
| 232 | 232 |
| 233 SetResult(new base::StringValue(result)); | 233 SetResult(base::MakeUnique<base::StringValue>(result)); |
| 234 SendResponse(true); | 234 SendResponse(true); |
| 235 } | 235 } |
| 236 | 236 |
| 237 DesktopCaptureRequestsRegistry::RequestId::RequestId(int process_id, | 237 DesktopCaptureRequestsRegistry::RequestId::RequestId(int process_id, |
| 238 int request_id) | 238 int request_id) |
| 239 : process_id(process_id), | 239 : process_id(process_id), |
| 240 request_id(request_id) { | 240 request_id(request_id) { |
| 241 } | 241 } |
| 242 | 242 |
| 243 bool DesktopCaptureRequestsRegistry::RequestId::operator<( | 243 bool DesktopCaptureRequestsRegistry::RequestId::operator<( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, | 285 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, |
| 286 int request_id) { | 286 int request_id) { |
| 287 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); | 287 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); |
| 288 if (it != requests_.end()) | 288 if (it != requests_.end()) |
| 289 it->second->Cancel(); | 289 it->second->Cancel(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 | 292 |
| 293 } // namespace extensions | 293 } // namespace extensions |
| OLD | NEW |