| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 namespace extensions { | 35 namespace extensions { |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 const char kCapturingSameTab[] = "Cannot capture a tab with an active stream."; | 39 const char kCapturingSameTab[] = "Cannot capture a tab with an active stream."; |
| 40 const char kFindingTabError[] = "Error finding tab to capture."; | 40 const char kFindingTabError[] = "Error finding tab to capture."; |
| 41 const char kNoAudioOrVideo[] = "Capture failed. No audio or video requested."; | 41 const char kNoAudioOrVideo[] = "Capture failed. No audio or video requested."; |
| 42 const char kPermissionError[] = "Tab Capture API flag is not enabled."; | 42 const char kPermissionError[] = "Tab Capture API flag is not enabled."; |
| 43 const char kGrantError[] = | 43 const char kGrantError[] = |
| 44 "Capture of this tab must be granted by clicking on the extension icon."; | 44 "Capture of this tab must be granted through a user action (see the " |
| 45 "activeTab permission). Chrome pages cannot be captured."; |
| 45 | 46 |
| 46 // Keys/values for media stream constraints. | 47 // Keys/values for media stream constraints. |
| 47 const char kMediaStreamSource[] = "chromeMediaSource"; | 48 const char kMediaStreamSource[] = "chromeMediaSource"; |
| 48 const char kMediaStreamSourceId[] = "chromeMediaSourceId"; | 49 const char kMediaStreamSourceId[] = "chromeMediaSourceId"; |
| 49 const char kMediaStreamSourceTab[] = "tab"; | 50 const char kMediaStreamSourceTab[] = "tab"; |
| 50 | 51 |
| 51 } // namespace | 52 } // namespace |
| 52 | 53 |
| 53 bool TabCaptureCaptureFunction::RunImpl() { | 54 bool TabCaptureCaptureFunction::RunImpl() { |
| 54 if (!FeatureSwitch::tab_capture()->IsEnabled()) { | 55 if (!FeatureSwitch::tab_capture()->IsEnabled()) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 info->tab_id = it->first; | 174 info->tab_id = it->first; |
| 174 info->status = it->second; | 175 info->status = it->second; |
| 175 list->Append(info->ToValue().release()); | 176 list->Append(info->ToValue().release()); |
| 176 } | 177 } |
| 177 | 178 |
| 178 SetResult(list); | 179 SetResult(list); |
| 179 return true; | 180 return true; |
| 180 } | 181 } |
| 181 | 182 |
| 182 } // namespace extensions | 183 } // namespace extensions |
| OLD | NEW |