chromium/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Implements the Chrome Extensions Tab Capture API.

#include "chrome/browser/extensions/api/tab_capture/tab_capture_api.h"

#include <algorithm>
#include <set>
#include <string>
#include <utility>
#include <vector>

#include "base/command_line.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/media/webrtc/capture_policy_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "components/sessions/content/session_tab_helper.h"
#include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/features/feature.h"
#include "extensions/common/features/feature_provider.h"
#include "extensions/common/features/simple_feature.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/switches.h"
#include "net/base/url_util.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"

DesktopMediaID;
WebContentsMediaCaptureId;
MediaStreamConstraint;

TabCapture;
GetCapturedTabs;

namespace extensions {
namespace {

const char kCapturingSameTab[] =;
const char kFindingTabError[] =;
const char kNoAudioOrVideo[] =;
const char kGrantError[] =;

const char kInvalidOriginError[] =;
const char kInvalidTabIdError[] =;
const char kTabUrlNotSecure[] =;

// Keys/values passed to renderer-side JS bindings.
const char kMediaStreamSource[] =;
const char kMediaStreamSourceId[] =;
const char kMediaStreamSourceTab[] =;

bool OptionsSpecifyAudioOrVideo(const TabCapture::CaptureOptions& options) {}

DesktopMediaID BuildDesktopMediaID(content::WebContents* target_contents,
                                   TabCapture::CaptureOptions* options) {}

// Add Chrome-specific source identifiers to the MediaStreamConstraints objects
// in |options| to provide references to the |target_contents| to be captured.
void AddMediaStreamSourceConstraints(content::WebContents* target_contents,
                                     TabCapture::CaptureOptions* options,
                                     const std::string& device_id) {}

// Find the last-active browser that matches a profile this ExtensionFunction
// can access.  We can't use FindLastActiveWithProfile() because we may want to
// include incognito profile browsers.
Browser* GetLastActiveBrowser(const Profile* profile,
                              const bool match_incognito_profile) {}

// Get the id of the allowlisted extension.
std::string GetAllowlistedExtensionID() {}

}  // namespace

ExtensionFunction::ResponseAction TabCaptureCaptureFunction::Run() {}

ExtensionFunction::ResponseAction TabCaptureGetCapturedTabsFunction::Run() {}

ExtensionFunction::ResponseAction TabCaptureGetMediaStreamIdFunction::Run() {}

}  // namespace extensions