Chrome Content API : dispatchDecidePolicyForNavigationAction equivalent

189 views
Skip to first unread message

nvineeth

unread,
Sep 20, 2012, 5:01:07 AM9/20/12
to chromi...@chromium.org
Hi All,
  I need the functionality of WebKit's FrameLoaderClient::dispatchDecidePolicyForNavigationAction. What is the equivalent API in Chrome content API?
Thanks.

Charlie Reis

unread,
Sep 20, 2012, 12:11:39 PM9/20/12
to nvin...@gmail.com, chromium-dev
RenderViewImpl::decidePolicyForNavigation is the the equivalent, but we don't have an arbitrary way to hook into that from a client of the content API.  The closest thing is ContentRendererClient::ShouldFork, which helps decide whether a process swap is needed or not.

Charlie



--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Avi Drissman

unread,
Sep 20, 2012, 2:09:45 PM9/20/12
to cr...@chromium.org, nvin...@gmail.com, chromium-dev
On Thu, Sep 20, 2012 at 12:11 PM, Charlie Reis <cr...@chromium.org> wrote:
RenderViewImpl::decidePolicyForNavigation is the the equivalent, but we don't have an arbitrary way to hook into that from a client of the content API.

Note that the current Content API is based on what Chromium has needed from Content, and doesn't include many configuration points that would be reasonable to add.

If you can make a good case for adding a new API to Content, please do so!

Avi

Darin Fisher

unread,
Sep 20, 2012, 2:17:03 PM9/20/12
to a...@google.com, cr...@chromium.org, nvin...@gmail.com, chromium-dev
Actually, you can use ResourceThrottle to somewhat mimic the functionality of dispatchDecidePolicyForNavigationAction.  A ResourceThrottle is given a ResourceController, which has the ability to Allow, Suspend, Cancel or CancelAndIgnore a network request.  (CancelAndIgnore is like WebCore::PolicyIgnore.)

The InterceptNavigationResourceThrottle is an example of using this interface to intercept certain navigations.

-Darin



--

nvineeth

unread,
Sep 21, 2012, 5:15:15 AM9/21/12
to chromi...@chromium.org, a...@google.com, cr...@chromium.org, nvin...@gmail.com
Thank you all for the help. I am afraid InterceptNavigationResourceThrottle is not of much help, since the navigation type ( was the navigation initiated due link click, back, fwd, etc., ) is missing. If I can expose
RenderViewImpl::decidePolicyForNavigation at the content api, I will submit the patche.
Br,
nvineeth.

Martin Kosiba

unread,
Sep 21, 2012, 5:51:40 AM9/21/12
to chromi...@chromium.org, a...@google.com, cr...@chromium.org, nvin...@gmail.com
The problem with adding decidePolicyForNavigation to the Content API is that you'd require synchronous IPC from the renderer to the browser, and that's discouraged. 

I think that the NavgationController::GetActiveEntry() would contain the info you're looking for, however the ActiveEntry is currently updated only after the provisional load is committed which is too late for your purposes. You could add a 'ProvisionalEntry' field to the NavigationController; it would be set in response to an async IPC sent from decidePolicyForNavigation (and would contain the info you're interested in), later you could retrieve that information in the ResourceThrottle and run your decision logic there.
Reply all
Reply to author
Forward
0 new messages