| 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 <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 "enhhojjnijigcajfphajepfemndkmdlo", // Dev | 55 "enhhojjnijigcajfphajepfemndkmdlo", // Dev |
| 56 "pkedcjkdefgpdelpbcmbmeomcjbeemfm", // Trusted Tester | 56 "pkedcjkdefgpdelpbcmbmeomcjbeemfm", // Trusted Tester |
| 57 "fmfcbgogabcbclcofgocippekhfcmgfj", // Staging | 57 "fmfcbgogabcbclcofgocippekhfcmgfj", // Staging |
| 58 "hfaagokkkhdbgiakmmlclaapfelnkoah", // Canary | 58 "hfaagokkkhdbgiakmmlclaapfelnkoah", // Canary |
| 59 "F155646B5D1CA545F7E1E4E20D573DFDD44C2540", // Trusted Tester (public) | 59 "F155646B5D1CA545F7E1E4E20D573DFDD44C2540", // Trusted Tester (public) |
| 60 "16CA7A47AAE4BE49B1E75A6B960C3875E945B264" // Release | 60 "16CA7A47AAE4BE49B1E75A6B960C3875E945B264" // Release |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace | 63 } // namespace |
| 64 | 64 |
| 65 bool TabCaptureCaptureFunction::RunImpl() { | 65 bool TabCaptureCaptureFunction::RunSync() { |
| 66 scoped_ptr<api::tab_capture::Capture::Params> params = | 66 scoped_ptr<api::tab_capture::Capture::Params> params = |
| 67 TabCapture::Capture::Params::Create(*args_); | 67 TabCapture::Capture::Params::Create(*args_); |
| 68 EXTENSION_FUNCTION_VALIDATE(params.get()); | 68 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 69 | 69 |
| 70 // Figure out the active WebContents and retrieve the needed ids. | 70 // Figure out the active WebContents and retrieve the needed ids. |
| 71 Browser* target_browser = chrome::FindAnyBrowser( | 71 Browser* target_browser = chrome::FindAnyBrowser( |
| 72 GetProfile(), include_incognito(), chrome::GetActiveDesktop()); | 72 GetProfile(), include_incognito(), chrome::GetActiveDesktop()); |
| 73 if (!target_browser) { | 73 if (!target_browser) { |
| 74 error_ = kFindingTabError; | 74 error_ = kFindingTabError; |
| 75 return false; | 75 return false; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // Copy the result from our modified input parameters. This will be | 156 // Copy the result from our modified input parameters. This will be |
| 157 // intercepted by custom bindings which will build and send the special | 157 // intercepted by custom bindings which will build and send the special |
| 158 // WebRTC user media request. | 158 // WebRTC user media request. |
| 159 base::DictionaryValue* result = new base::DictionaryValue(); | 159 base::DictionaryValue* result = new base::DictionaryValue(); |
| 160 result->MergeDictionary(params->options.ToValue().get()); | 160 result->MergeDictionary(params->options.ToValue().get()); |
| 161 | 161 |
| 162 SetResult(result); | 162 SetResult(result); |
| 163 return true; | 163 return true; |
| 164 } | 164 } |
| 165 | 165 |
| 166 bool TabCaptureGetCapturedTabsFunction::RunImpl() { | 166 bool TabCaptureGetCapturedTabsFunction::RunSync() { |
| 167 extensions::TabCaptureRegistry* registry = | 167 extensions::TabCaptureRegistry* registry = |
| 168 extensions::TabCaptureRegistry::Get(GetProfile()); | 168 extensions::TabCaptureRegistry::Get(GetProfile()); |
| 169 | 169 |
| 170 const TabCaptureRegistry::RegistryCaptureInfo& captured_tabs = | 170 const TabCaptureRegistry::RegistryCaptureInfo& captured_tabs = |
| 171 registry->GetCapturedTabs(GetExtension()->id()); | 171 registry->GetCapturedTabs(GetExtension()->id()); |
| 172 | 172 |
| 173 base::ListValue *list = new base::ListValue(); | 173 base::ListValue *list = new base::ListValue(); |
| 174 for (TabCaptureRegistry::RegistryCaptureInfo::const_iterator it = | 174 for (TabCaptureRegistry::RegistryCaptureInfo::const_iterator it = |
| 175 captured_tabs.begin(); it != captured_tabs.end(); ++it) { | 175 captured_tabs.begin(); it != captured_tabs.end(); ++it) { |
| 176 scoped_ptr<tab_capture::CaptureInfo> info(new tab_capture::CaptureInfo()); | 176 scoped_ptr<tab_capture::CaptureInfo> info(new tab_capture::CaptureInfo()); |
| 177 info->tab_id = it->first; | 177 info->tab_id = it->first; |
| 178 info->status = it->second; | 178 info->status = it->second; |
| 179 list->Append(info->ToValue().release()); | 179 list->Append(info->ToValue().release()); |
| 180 } | 180 } |
| 181 | 181 |
| 182 SetResult(list); | 182 SetResult(list); |
| 183 return true; | 183 return true; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace extensions | 186 } // namespace extensions |
| OLD | NEW |