Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions obs-browser-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ static obs_properties_t *browser_source_get_properties(void *data)
return false;
},
bs);
#if CHROME_VERSION_BUILD > 6533 || defined(__APPLE__) || defined(_WIN32)
obs_properties_add_button2(
props, "inspect", obs_module_text("Inspect"),
[](obs_properties_t *, obs_property_t *, void *data) {
static_cast<BrowserSource *>(data)->Inspect();
return false;
},
bs);
#endif
return props;
}

Expand Down
13 changes: 13 additions & 0 deletions obs-browser-source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,19 @@ void BrowserSource::Refresh()
ExecuteOnBrowser([](CefRefPtr<CefBrowser> cefBrowser) { cefBrowser->ReloadIgnoreCache(); }, true);
}

void BrowserSource::Inspect()
{
ExecuteOnBrowser(
[](CefRefPtr<CefBrowser> cefBrowser) {
CefWindowInfo windowInfo;
windowInfo.bounds.width = 900;
windowInfo.bounds.height = 700;
Comment on lines +435 to +436

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any logic behind those values or were those just randomly chosen?

CefRefPtr<CefBrowserHost> host = cefBrowser->GetHost();
host->ShowDevTools(windowInfo, host->GetClient(), CefBrowserSettings(), {});
},
true);
}

void BrowserSource::SetBrowser(CefRefPtr<CefBrowser> b)
{
std::lock_guard<std::recursive_mutex> auto_lock(lockBrowser);
Expand Down
1 change: 1 addition & 0 deletions obs-browser-source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ struct BrowserSource {
void SetShowing(bool showing);
void SetActive(bool active);
void Refresh();
void Inspect();

#if defined(BROWSER_EXTERNAL_BEGIN_FRAME_ENABLED) && defined(ENABLE_BROWSER_SHARED_TEXTURE)
inline void SignalBeginFrame();
Expand Down
Loading