#include "extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/singleton.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
namespace extensions {
namespace {
class MimeHandlerStreamManagerFactory
: public BrowserContextKeyedServiceFactory { … };
MimeHandlerStreamManagerFactory::MimeHandlerStreamManagerFactory()
: … { … }
MimeHandlerStreamManagerFactory*
MimeHandlerStreamManagerFactory::GetInstance() { … }
MimeHandlerStreamManager* MimeHandlerStreamManagerFactory::Get(
content::BrowserContext* context) { … }
KeyedService* MimeHandlerStreamManagerFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const { … }
content::BrowserContext*
MimeHandlerStreamManagerFactory::GetBrowserContextToUse(
content::BrowserContext* context) const { … }
}
class MimeHandlerStreamManager::EmbedderObserver
: public content::WebContentsObserver { … };
MimeHandlerStreamManager::MimeHandlerStreamManager() = default;
MimeHandlerStreamManager::~MimeHandlerStreamManager() = default;
MimeHandlerStreamManager* MimeHandlerStreamManager::Get(
content::BrowserContext* context) { … }
void MimeHandlerStreamManager::AddStream(
const std::string& stream_id,
std::unique_ptr<StreamContainer> stream,
int frame_tree_node_id) { … }
std::unique_ptr<StreamContainer> MimeHandlerStreamManager::ReleaseStream(
const std::string& stream_id) { … }
void MimeHandlerStreamManager::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionReason reason) { … }
MimeHandlerStreamManager::EmbedderObserver::EmbedderObserver(
MimeHandlerStreamManager* stream_manager,
const std::string& stream_id,
int frame_tree_node_id)
: … { … }
void MimeHandlerStreamManager::EmbedderObserver::RenderFrameDeleted(
content::RenderFrameHost* render_frame_host) { … }
void MimeHandlerStreamManager::EmbedderObserver::
PrimaryMainFrameRenderProcessGone(base::TerminationStatus status) { … }
void MimeHandlerStreamManager::EmbedderObserver::ReadyToCommitNavigation(
content::NavigationHandle* navigation_handle) { … }
void MimeHandlerStreamManager::EmbedderObserver::DidStartNavigation(
content::NavigationHandle* navigation_handle) { … }
void MimeHandlerStreamManager::EmbedderObserver::RenderFrameHostChanged(
content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) { … }
void MimeHandlerStreamManager::EmbedderObserver::WebContentsDestroyed() { … }
void MimeHandlerStreamManager::EmbedderObserver::AbortStream() { … }
bool MimeHandlerStreamManager::EmbedderObserver::IsTrackedRenderFrameHost(
content::RenderFrameHost* render_frame_host) { … }
void MimeHandlerStreamManager::EnsureFactoryBuilt() { … }
}