Commit e0f99fc8 authored by Ryan Daum's avatar Ryan Daum Committed by Commit Bot

[chromecast] Add is_main_frame attribute to webview nav event

Bug: internal b/141853741
Change-Id: Iaa5f5ac1a6fe46addd11d8f666c9cee4fa6b08f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845674
Commit-Queue: Ryan Daum <rdaum@chromium.org>
Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703702}
parent 19ac9b3d
......@@ -171,6 +171,7 @@ message SetAutoMediaPlaybackPolicyRequest {
message NavigationRequestEvent {
string url = 1;
bool is_for_main_frame = 2;
}
enum NavigationDecision {
......
......@@ -193,11 +193,13 @@ void WebviewController::ProcessRequest(const webview::WebviewRequest& request) {
}
void WebviewController::SendNavigationEvent(WebviewNavigationThrottle* throttle,
const GURL& gurl) {
const GURL& gurl,
bool is_in_main_frame) {
DCHECK(!current_navigation_throttle_);
std::unique_ptr<webview::WebviewResponse> response =
std::make_unique<webview::WebviewResponse>();
response->mutable_navigation_event()->set_url(gurl.spec());
response->mutable_navigation_event()->set_is_for_main_frame(is_in_main_frame);
current_navigation_throttle_ = throttle;
client_->EnqueueSend(std::move(response));
}
......
......@@ -66,7 +66,8 @@ class WebviewController : public CastWebContents::Delegate,
void AttachTo(aura::Window* window, int window_id);
void SendNavigationEvent(WebviewNavigationThrottle* throttle,
const GURL& url);
const GURL& url,
bool is_in_main_frame);
private:
webview::AsyncPageEvent_State current_state();
......
......@@ -16,13 +16,14 @@ WebviewNavigationThrottle::WebviewNavigationThrottle(
WebviewController* controller)
: NavigationThrottle(handle),
url_(handle->GetURL()),
is_in_main_frame_(handle->IsInMainFrame()),
controller_(controller) {}
WebviewNavigationThrottle::~WebviewNavigationThrottle() = default;
content::NavigationThrottle::ThrottleCheckResult
WebviewNavigationThrottle::WillStartRequest() {
controller_->SendNavigationEvent(this, url_);
controller_->SendNavigationEvent(this, url_, is_in_main_frame_);
return content::NavigationThrottle::DEFER;
}
......
......@@ -35,6 +35,7 @@ class WebviewNavigationThrottle : public content::NavigationThrottle {
scoped_refptr<base::SequencedTaskRunner> response_task_runner_;
const GURL url_;
bool is_in_main_frame_;
WebviewController* controller_;
DISALLOW_COPY_AND_ASSIGN(WebviewNavigationThrottle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment