summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/tab_capture/tab_capture_api.h
blob: 884c71115772ccb8acb4d255bb1c5f6f5c1df516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Defines the Chrome Extensions Tab Capture API functions for accessing
// tab media streams.

#ifndef CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_API_H_

#include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/tab_capture.h"

namespace extensions {

// Extension ids for stable / beta cast extensions. Included in
// |kChromecastExtensionIds|.
extern const char* const kBetaChromecastExtensionId;
extern const char* const kStableChromecastExtensionId;

// Extension ids for the chromecast.
extern const char* const kChromecastExtensionIds[6];

class TabCaptureCaptureFunction : public ChromeSyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("tabCapture.capture", TABCAPTURE_CAPTURE)

 private:
  ~TabCaptureCaptureFunction() final {}

  // ExtensionFunction:
  bool RunSync() final;
};

class TabCaptureGetCapturedTabsFunction : public ChromeSyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("tabCapture.getCapturedTabs",
                             TABCAPTURE_GETCAPTUREDTABS)

 private:
  ~TabCaptureGetCapturedTabsFunction() final {}

  // ExtensionFunction:
  bool RunSync() final;
};

class TabCaptureCaptureOffscreenTabFunction : public SyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("tabCapture.captureOffscreenTab",
                             TABCAPTURE_CAPTUREOFFSCREENTAB)

  // Examines the min/max width/height constraints in the |options| to determine
  // a suitable initial off-screen tab size.
  static gfx::Size DetermineInitialSize(
      const extensions::api::tab_capture::CaptureOptions& options);

 private:
  ~TabCaptureCaptureOffscreenTabFunction() final {}

  // ExtensionFunction:
  bool RunSync() final;
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_API_H_