#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_attach_helper.h"
#include <stdint.h>
#include <string>
#include <vector>
#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/no_destructor.h"
#include "base/strings/stringprintf.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.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 "content/public/common/webplugininfo.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_embedder.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "pdf/buildflags.h"
#include "ppapi/buildflags/buildflags.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/skia/include/core/SkColor.h"
#if BUILDFLAG(ENABLE_PDF)
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "components/grit/components_resources.h"
#include "components/pdf/common/constants.h"
#include "pdf/pdf_features.h"
#include "ui/base/resource/resource_bundle.h"
#endif
#if BUILDFLAG(ENABLE_PLUGINS)
#include "content/public/browser/plugin_service.h"
#endif
BrowserThread;
RenderFrameHost;
namespace extensions {
namespace {
constexpr char kFullPageMimeHandlerViewHTML[] = …;
SkColor GetBackgroundColorStringForMimeType(const GURL& url,
const std::string& mime_type) { … }
ProcessIdToHelperMap;
ProcessIdToHelperMap* GetProcessIdToHelperMap() { … }
}
MimeHandlerViewAttachHelper* MimeHandlerViewAttachHelper::Get(
int32_t render_process_id) { … }
std::string MimeHandlerViewAttachHelper::CreateTemplateMimeHandlerPage(
const GURL& resource_url,
const std::string& mime_type,
const std::string& internal_id) { … }
std::string MimeHandlerViewAttachHelper::OverrideBodyForInterceptedResponse(
int32_t navigating_frame_tree_node_id,
const GURL& resource_url,
const std::string& mime_type,
const std::string& stream_id,
const std::string& internal_id,
base::OnceClosure resume_load) { … }
void MimeHandlerViewAttachHelper::RenderProcessHostDestroyed(
content::RenderProcessHost* render_process_host) { … }
void MimeHandlerViewAttachHelper::AttachToOuterWebContents(
std::unique_ptr<MimeHandlerViewGuest> guest_view,
int32_t embedder_render_process_id,
content::RenderFrameHost* outer_contents_frame,
int32_t element_instance_id,
bool is_full_page_plugin) { … }
void MimeHandlerViewAttachHelper::CreateFullPageMimeHandlerView(
int32_t frame_tree_node_id,
const GURL& resource_url,
const std::string& stream_id,
const std::string& token) { … }
MimeHandlerViewAttachHelper::MimeHandlerViewAttachHelper(
content::RenderProcessHost* render_process_host)
: … { … }
MimeHandlerViewAttachHelper::~MimeHandlerViewAttachHelper() = default;
void MimeHandlerViewAttachHelper::ResumeAttachOrDestroy(
std::unique_ptr<MimeHandlerViewGuest> guest_view,
int32_t element_instance_id,
bool is_full_page_plugin,
content::RenderFrameHost* plugin_render_frame_host) { … }
}