electron/shell/browser/extensions/api/tabs/tabs_api.h
trop[bot] e925444071
chore: bump chromium to 132.0.6820.0 (34-x-y) (#44585)
* chore: bump chromium in DEPS to 132.0.6817.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update chromium patches

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 5979290: Temoporarily disable crel on arm. | https://chromium-review.googlesource.com/c/chromium/src/+/5979290

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 5981701: Include callback.h instead of callback_forward.h | https://chromium-review.googlesource.com/c/chromium/src/+/5981701

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 5964918: [v8 code cache] Add a wpt_internal test demonstrating the code cache 304 problem | https://chromium-review.googlesource.com/c/chromium/src/+/5964918

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 5969697: Add NetworkTrafficAnnotationTag to PreconnectManager | https://chromium-review.googlesource.com/c/chromium/src/+/5969697

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* chore: update remaining patches

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* chore: bump chromium in DEPS to 132.0.6818.0

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* chore: update patches

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 5983492: MPArch GuestView: Have executeScript target correct frame | https://chromium-review.googlesource.com/c/chromium/src/+/5983492

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* chore: bump chromium in DEPS to 132.0.6820.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

Co-authored-by: VerteDinde <vertedinde@electronjs.org>

* 5989717: Revert "win: Remove special check for 10.0.22621.2428 Win SDK version" | https://chromium-review.googlesource.com/c/chromium/src/+/5989717

Co-authored-by: VerteDinde <vertedinde@electronjs.org>

* 5968218: Send PDF Searchifier running state to browser to show UX elements. | https://chromium-review.googlesource.com/c/chromium/src/+/5968218

Co-authored-by: VerteDinde <vertedinde@electronjs.org>

* build: also update the MSVS_HASH for WOA

Co-authored-by: VerteDinde <vertedinde@electronjs.org>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
2024-11-06 12:00:35 -05:00

129 lines
3.2 KiB
C++

// Copyright (c) 2019 Slack Technologies, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_
#define ELECTRON_SHELL_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_
#include <string>
#include "base/memory/raw_ptr.h"
#include "extensions/browser/api/execute_code_function.h"
#include "extensions/browser/extension_function.h"
#include "extensions/common/extension_resource.h"
class GURL;
namespace extensions {
// Implement API call tabs.executeScript and tabs.insertCSS.
class ExecuteCodeInTabFunction : public ExecuteCodeFunction {
public:
ExecuteCodeInTabFunction();
protected:
~ExecuteCodeInTabFunction() override;
// Initializes |execute_tab_id_| and |details_|.
InitResult Init() override;
bool CanExecuteScriptOnPage(std::string* error) override;
ScriptExecutor* GetScriptExecutor(std::string* error) override;
bool IsWebView() const override;
int GetRootFrameId() const override;
const GURL& GetWebViewSrc() const override;
private:
// Id of tab which executes code.
int execute_tab_id_;
};
class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction {
protected:
bool ShouldInsertCSS() const override;
bool ShouldRemoveCSS() const override;
private:
~TabsExecuteScriptFunction() override {}
DECLARE_EXTENSION_FUNCTION("tabs.executeScript", TABS_EXECUTESCRIPT)
};
class TabsReloadFunction : public ExtensionFunction {
~TabsReloadFunction() override {}
ResponseAction Run() override;
DECLARE_EXTENSION_FUNCTION("tabs.reload", TABS_RELOAD)
};
class TabsQueryFunction : public ExtensionFunction {
~TabsQueryFunction() override {}
ResponseAction Run() override;
DECLARE_EXTENSION_FUNCTION("tabs.query", TABS_QUERY)
};
class TabsGetFunction : public ExtensionFunction {
~TabsGetFunction() override {}
ResponseAction Run() override;
DECLARE_EXTENSION_FUNCTION("tabs.get", TABS_GET)
};
class TabsSetZoomFunction : public ExtensionFunction {
private:
~TabsSetZoomFunction() override {}
ResponseAction Run() override;
DECLARE_EXTENSION_FUNCTION("tabs.setZoom", TABS_SETZOOM)
};
class TabsGetZoomFunction : public ExtensionFunction {
private:
~TabsGetZoomFunction() override {}
ResponseAction Run() override;
DECLARE_EXTENSION_FUNCTION("tabs.getZoom", TABS_GETZOOM)
};
class TabsSetZoomSettingsFunction : public ExtensionFunction {
private:
~TabsSetZoomSettingsFunction() override {}
ResponseAction Run() override;
DECLARE_EXTENSION_FUNCTION("tabs.setZoomSettings", TABS_SETZOOMSETTINGS)
};
class TabsGetZoomSettingsFunction : public ExtensionFunction {
private:
~TabsGetZoomSettingsFunction() override {}
ResponseAction Run() override;
DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS)
};
class TabsUpdateFunction : public ExtensionFunction {
public:
TabsUpdateFunction();
protected:
~TabsUpdateFunction() override {}
bool UpdateURL(const std::string& url, int tab_id, std::string* error);
ResponseValue GetResult();
raw_ptr<content::WebContents> web_contents_;
private:
ResponseAction Run() override;
DECLARE_EXTENSION_FUNCTION("tabs.update", TABS_UPDATE)
};
} // namespace extensions
#endif // ELECTRON_SHELL_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_