| Index: chrome/browser/extensions/extension_offscreen_tabs_module.h
|
| diff --git a/chrome/browser/extensions/extension_offscreen_tabs_module.h b/chrome/browser/extensions/extension_offscreen_tabs_module.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..94fa9b4fba587b10d33425385b7d9e85bc797202
|
| --- /dev/null
|
| +++ b/chrome/browser/extensions/extension_offscreen_tabs_module.h
|
| @@ -0,0 +1,122 @@
|
| +// 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.
|
| +
|
| +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_OFFSCREEN_TABS_MODULE_H__
|
| +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_OFFSCREEN_TABS_MODULE_H__
|
| +#pragma once
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/values.h"
|
| +#include "chrome/browser/extensions/extension_function.h"
|
| +#include "chrome/browser/extensions/extension_tabs_module.h"
|
| +#include "content/public/browser/notification_observer.h"
|
| +#include "content/public/browser/notification_registrar.h"
|
| +#include "content/public/browser/web_contents_observer.h"
|
| +
|
| +// For the moment we make the offscreen tabs module depend on the tabs
|
| +// module so we can share some code between them. The long-term goal
|
| +// is to fold the offscreen tabs functionality into the tabs API
|
| +// anyway.
|
| +
|
| +class BackingStore;
|
| +class SkBitmap;
|
| +
|
| +// Creates an offscreen tab and adds it to a map of tabs and their child
|
| +// offscreen tabs.
|
| +class CreateOffscreenTabFunction : public SyncExtensionFunction {
|
| + public:
|
| + CreateOffscreenTabFunction();
|
| + private:
|
| + virtual ~CreateOffscreenTabFunction();
|
| + virtual bool RunImpl() OVERRIDE;
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.create")
|
| + DISALLOW_COPY_AND_ASSIGN(CreateOffscreenTabFunction);
|
| +};
|
| +
|
| +// Gets info about an offscreen tab.
|
| +class GetOffscreenTabFunction : public SyncExtensionFunction {
|
| + public:
|
| + GetOffscreenTabFunction();
|
| + private:
|
| + virtual ~GetOffscreenTabFunction();
|
| + virtual bool RunImpl() OVERRIDE;
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.get")
|
| + DISALLOW_COPY_AND_ASSIGN(GetOffscreenTabFunction);
|
| +};
|
| +
|
| +// Gets all offscreen tabs created by the tab that invoked this function.
|
| +class GetAllOffscreenTabFunction : public SyncExtensionFunction {
|
| + public:
|
| + GetAllOffscreenTabFunction();
|
| + private:
|
| + virtual ~GetAllOffscreenTabFunction();
|
| + virtual bool RunImpl() OVERRIDE;
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.getAll")
|
| + DISALLOW_COPY_AND_ASSIGN(GetAllOffscreenTabFunction);
|
| +};
|
| +
|
| +// Removes an offscreen tab.
|
| +class RemoveOffscreenTabFunction : public SyncExtensionFunction {
|
| + public:
|
| + RemoveOffscreenTabFunction();
|
| + private:
|
| + virtual ~RemoveOffscreenTabFunction();
|
| + virtual bool RunImpl() OVERRIDE;
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.remove")
|
| + DISALLOW_COPY_AND_ASSIGN(RemoveOffscreenTabFunction);
|
| +};
|
| +
|
| +// Synthesizes a keyboard event based on a passed-in JavaScript keyboard event.
|
| +class SendKeyboardEventOffscreenTabFunction : public SyncExtensionFunction {
|
| + public:
|
| + SendKeyboardEventOffscreenTabFunction();
|
| + private:
|
| + virtual ~SendKeyboardEventOffscreenTabFunction();
|
| + virtual bool RunImpl() OVERRIDE;
|
| + DECLARE_EXTENSION_FUNCTION_NAME(
|
| + "experimental.offscreenTabs.sendKeyboardEvent")
|
| + DISALLOW_COPY_AND_ASSIGN(SendKeyboardEventOffscreenTabFunction);
|
| +};
|
| +
|
| +// Synthesizes a mouse event based on a passed-in JavaScript mouse event.
|
| +// Since only the application knows where the user clicks, x and y coordinates
|
| +// need to be passed in as well in this case of click, mousedown, and mouseup.
|
| +class SendMouseEventOffscreenTabFunction : public SyncExtensionFunction {
|
| + public:
|
| + SendMouseEventOffscreenTabFunction();
|
| + private:
|
| + virtual ~SendMouseEventOffscreenTabFunction();
|
| + virtual bool RunImpl() OVERRIDE;
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.sendMouseEvent")
|
| + DISALLOW_COPY_AND_ASSIGN(SendMouseEventOffscreenTabFunction);
|
| +};
|
| +
|
| +// Gets a snapshot of the offscreen tab and returns it as a data URL.
|
| +class ToDataUrlOffscreenTabFunction : public CaptureVisibleTabFunction {
|
| + public:
|
| + ToDataUrlOffscreenTabFunction();
|
| + private:
|
| + virtual ~ToDataUrlOffscreenTabFunction();
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.toDataUrl")
|
| + DISALLOW_COPY_AND_ASSIGN(ToDataUrlOffscreenTabFunction);
|
| +};
|
| +
|
| +// Updates an offscreen tab.
|
| +class UpdateOffscreenTabFunction : public UpdateTabFunction {
|
| + public:
|
| + UpdateOffscreenTabFunction();
|
| +
|
| + private:
|
| + virtual ~UpdateOffscreenTabFunction();
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.offscreenTabs.update")
|
| + DISALLOW_COPY_AND_ASSIGN(UpdateOffscreenTabFunction);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_OFFSCREEN_TABS_MODULE_H__
|
| +
|
|
|