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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Keep reference to |this| to ensure the object doesn't get destroyed before | 69 // Keep reference to |this| to ensure the object doesn't get destroyed before |
70 // we return. | 70 // we return. |
71 scoped_refptr<DesktopCaptureChooseDesktopMediaFunction> self(this); | 71 scoped_refptr<DesktopCaptureChooseDesktopMediaFunction> self(this); |
72 if (picker_) { | 72 if (picker_) { |
73 picker_.reset(); | 73 picker_.reset(); |
74 SetResult(new base::StringValue(std::string())); | 74 SetResult(new base::StringValue(std::string())); |
75 SendResponse(true); | 75 SendResponse(true); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 bool DesktopCaptureChooseDesktopMediaFunction::RunImpl() { | 79 bool DesktopCaptureChooseDesktopMediaFunction::RunAsync() { |
80 EXTENSION_FUNCTION_VALIDATE(args_->GetSize() > 0); | 80 EXTENSION_FUNCTION_VALIDATE(args_->GetSize() > 0); |
81 | 81 |
82 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &request_id_)); | 82 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &request_id_)); |
83 args_->Remove(0, NULL); | 83 args_->Remove(0, NULL); |
84 | 84 |
85 scoped_ptr<api::desktop_capture::ChooseDesktopMedia::Params> params = | 85 scoped_ptr<api::desktop_capture::ChooseDesktopMedia::Params> params = |
86 api::desktop_capture::ChooseDesktopMedia::Params::Create(*args_); | 86 api::desktop_capture::ChooseDesktopMedia::Params::Create(*args_); |
87 EXTENSION_FUNCTION_VALIDATE(params.get()); | 87 EXTENSION_FUNCTION_VALIDATE(params.get()); |
88 | 88 |
89 DesktopCaptureRequestsRegistry::GetInstance()->AddRequest( | 89 DesktopCaptureRequestsRegistry::GetInstance()->AddRequest( |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, | 294 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, |
295 int request_id) { | 295 int request_id) { |
296 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); | 296 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); |
297 if (it != requests_.end()) | 297 if (it != requests_.end()) |
298 it->second->Cancel(); | 298 it->second->Cancel(); |
299 } | 299 } |
300 | 300 |
301 | 301 |
302 } // namespace extensions | 302 } // namespace extensions |
OLD | NEW |