2021-06-16 21:54:26 +02:00
|
|
|
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be found
|
|
|
|
// in the LICENSE file.
|
|
|
|
|
|
|
|
#include "libcef/browser/extensions/alloy_extensions_util.h"
|
|
|
|
|
|
|
|
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
|
|
|
|
|
2024-01-20 23:48:57 +01:00
|
|
|
namespace extensions::alloy {
|
2021-06-16 21:54:26 +02:00
|
|
|
|
|
|
|
int GetTabIdForWebContents(content::WebContents* web_contents) {
|
|
|
|
auto browser = AlloyBrowserHostImpl::GetBrowserForContents(web_contents);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!browser) {
|
2021-06-16 21:54:26 +02:00
|
|
|
return -1;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2021-06-16 21:54:26 +02:00
|
|
|
return browser->GetIdentifier();
|
|
|
|
}
|
|
|
|
|
2024-01-20 23:48:57 +01:00
|
|
|
} // namespace extensions::alloy
|