#include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.h"
#include <memory>
#include <utility>
#include "base/json/json_writer.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h"
#include "chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/web_navigation.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/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_api_frame_id_map.h"
#include "extensions/common/mojom/event_dispatcher.mojom.h"
#include "net/base/net_errors.h"
#include "ui/base/page_transition_types.h"
namespace extensions {
web_navigation;
namespace web_navigation_api_helpers {
namespace {
void DispatchEvent(content::BrowserContext* browser_context,
std::unique_ptr<Event> event,
const GURL& url) { … }
}
std::unique_ptr<Event> CreateOnBeforeNavigateEvent(
content::NavigationHandle* navigation_handle) { … }
void DispatchOnCommitted(events::HistogramValue histogram_value,
const std::string& event_name,
content::NavigationHandle* navigation_handle) { … }
void DispatchOnDOMContentLoaded(content::WebContents* web_contents,
content::RenderFrameHost* frame_host,
const GURL& url) { … }
void DispatchOnCompleted(content::WebContents* web_contents,
content::RenderFrameHost* frame_host,
const GURL& url) { … }
void DispatchOnCreatedNavigationTarget(
int source_tab_id,
int source_render_process_id,
int source_extension_frame_id,
content::BrowserContext* browser_context,
content::WebContents* target_web_contents,
const GURL& target_url) { … }
void DispatchOnErrorOccurred(content::WebContents* web_contents,
content::RenderFrameHost* frame_host,
const GURL& url,
int error_code) { … }
void DispatchOnErrorOccurred(content::NavigationHandle* navigation_handle) { … }
void DispatchOnTabReplaced(
content::WebContents* old_web_contents,
content::BrowserContext* browser_context,
content::WebContents* new_web_contents) { … }
}
}