2015-07-16 23:40:01 +02:00
|
|
|
// Copyright (c) 2015 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.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_
|
|
|
|
|
2015-08-17 21:48:57 +02:00
|
|
|
#include <vector>
|
|
|
|
|
2020-09-18 00:24:08 +02:00
|
|
|
#include "include/internal/cef_ptr.h"
|
2015-10-12 22:45:14 +02:00
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
#include "url/gurl.h"
|
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
namespace content {
|
2017-08-04 00:55:19 +02:00
|
|
|
class BrowserContext;
|
2021-08-19 23:07:44 +02:00
|
|
|
struct GlobalRenderFrameHostId;
|
2020-09-18 00:24:08 +02:00
|
|
|
class RenderFrameHost;
|
2015-10-12 22:45:14 +02:00
|
|
|
class RenderViewHost;
|
2015-07-16 23:40:01 +02:00
|
|
|
class WebContents;
|
2017-08-04 00:55:19 +02:00
|
|
|
} // namespace content
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2020-09-18 00:24:08 +02:00
|
|
|
class CefBrowserHostBase;
|
2020-09-22 21:54:02 +02:00
|
|
|
class AlloyBrowserHostImpl;
|
2020-09-18 00:24:08 +02:00
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
namespace extensions {
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
class Extension;
|
|
|
|
|
2015-08-17 21:48:57 +02:00
|
|
|
// Populates |guests| with all guest WebContents with the specified |owner|.
|
|
|
|
void GetAllGuestsForOwnerContents(content::WebContents* owner,
|
|
|
|
std::vector<content::WebContents*>* guests);
|
|
|
|
|
|
|
|
// Returns the WebContents that owns the specified |guest|, if any.
|
|
|
|
content::WebContents* GetOwnerForGuestContents(content::WebContents* guest);
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2020-09-18 00:24:08 +02:00
|
|
|
// Returns the CefBrowserHostBase that owns the host identified by the specified
|
2021-08-19 23:07:44 +02:00
|
|
|
// global ID, if any. |is_guest_view| will be set to true if the ID
|
|
|
|
// matches a guest view associated with the returned browser instead of the
|
2015-10-21 20:17:09 +02:00
|
|
|
// browser itself.
|
2021-08-19 23:07:44 +02:00
|
|
|
CefRefPtr<CefBrowserHostBase> GetOwnerBrowserForGlobalId(
|
|
|
|
const content::GlobalRenderFrameHostId& global_id,
|
2019-05-24 22:23:43 +02:00
|
|
|
bool* is_guest_view);
|
2015-10-12 22:45:14 +02:00
|
|
|
|
2020-09-18 00:24:08 +02:00
|
|
|
// Returns the CefBrowserHostBase that owns the specified |host|, if any.
|
2015-10-21 20:17:09 +02:00
|
|
|
// |is_guest_view| will be set to true if the host matches a guest view
|
|
|
|
// associated with the returned browser instead of the browser itself.
|
2017-01-23 18:36:54 +01:00
|
|
|
// TODO(cef): Delete the RVH variant once the remaining use case
|
2020-06-28 20:29:44 +02:00
|
|
|
// (via AlloyContentBrowserClient::OverrideWebkitPrefs) has been removed.
|
2020-09-18 00:24:08 +02:00
|
|
|
CefRefPtr<CefBrowserHostBase> GetOwnerBrowserForHost(
|
2015-10-21 20:17:09 +02:00
|
|
|
content::RenderViewHost* host,
|
|
|
|
bool* is_guest_view);
|
2020-09-18 00:24:08 +02:00
|
|
|
CefRefPtr<CefBrowserHostBase> GetOwnerBrowserForHost(
|
2017-01-23 18:36:54 +01:00
|
|
|
content::RenderFrameHost* host,
|
|
|
|
bool* is_guest_view);
|
2015-10-12 22:45:14 +02:00
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
// Returns the browser matching |tab_id| and |browser_context|. Returns false if
|
2017-09-28 15:40:26 +02:00
|
|
|
// |tab_id| is < 0 or a matching browser cannot be found within
|
2017-08-04 00:55:19 +02:00
|
|
|
// |browser_context|. Similar in concept to ExtensionTabUtil::GetTabById.
|
2020-09-22 21:54:02 +02:00
|
|
|
CefRefPtr<AlloyBrowserHostImpl> GetBrowserForTabId(
|
2017-08-04 00:55:19 +02:00
|
|
|
int tab_id,
|
|
|
|
content::BrowserContext* browser_context);
|
|
|
|
|
|
|
|
// Returns the extension associated with |url| in |profile|. Returns nullptr
|
|
|
|
// if the extension does not exist.
|
|
|
|
const Extension* GetExtensionForUrl(content::BrowserContext* browser_context,
|
|
|
|
const GURL& url);
|
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
} // namespace extensions
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_
|