diff options
author | rob <rob@robwu.nl> | 2016-01-06 13:22:09 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-06 21:22:58 +0000 |
commit | 3e2a0730e0dfb9c4dcbce45eea275270db900e90 (patch) | |
tree | bb5daf2237e4791771a94c2341d8764a7fe7d7b7 /extensions/common/extension_messages.h | |
parent | 8bdc571018faac493cb358ea1f8b7314b9178aa4 (diff) | |
download | chromium_src-3e2a0730e0dfb9c4dcbce45eea275270db900e90.zip chromium_src-3e2a0730e0dfb9c4dcbce45eea275270db900e90.tar.gz chromium_src-3e2a0730e0dfb9c4dcbce45eea275270db900e90.tar.bz2 |
Use FrameTreeNode ID as frameId in extension APIs
Use FrameTreeNode IDs instead of RenderFrame routing IDs as "frame id"
in the extension APIs (webNavigation, webRequest, extension messaging)
because FTN IDs are globally unique, and RFH IDs are not.
This extends the public content API with:
- RenderFrameHost::FromFrameTreeNodeId
- RenderFrameHost::GetFrameTreeNodeId
- WebContents::FindFrameByFrameTreeNodeId
The extension APIs are modified as follows:
- webRequest:
* Frame IDs may be unavailable after frame removal (crbug.com/572930).
* Blocking webRequest handlers may be slower than before due to an
extra IO->UI->IO hop to determine the frameId (but this happens only
once per frame load).
- webNavigation:
* processId is no longer required in chrome.webNavigation.getFrame,
but marked as optional (deprecated) to make sure that the API is
backwards-compatible.
* frameId is constant across navigations.
- Extension messaging (chrome.runtime.connect and friends):
* Small change for extension developers in the following scenario:
1. Open port to tab.
2. Accept the port by listening to onConnect *in a child frame*.
3. Unload the document in the frame.
Old behavior: onDisconnect was not triggered in the background until
the tab was reloaded or closed.
New behavior: onDisconnect is called.
* Extension messaging works correctly in out-of-process frames.
* Move port lifetime management from renderer to browser.
* Tie port lifetime to frames instead of processes.
* Only notify frames in renderers if they have accepted the port.
* Remove obsolete work-around for crbug.com/520303.
* Unify open/close/postMessage logic in ChromeExtensionMessageFilter
(crbug.com/394383#c7)
- The extension frameId logic is no longer scattered over several files,
but resides in a single class (ExtensionApiFrameIdMap).
- IDs are now guaranteed to be -1 or higher (before this, -2 was
occasionally seen).
Depends on https://codereview.chromium.org/1413853005/
BUG=432875
TEST=browser_tests --gtest_filter=\
ExtensionWebRequestApiTest.*:\
WebNavigationApiTest.*:\
ExtensionApiTest.Messaging*:\
ExternallyConnectableMessagingTest.*:\
ExternallyConnectableMessagingWithTlsChannelIdTest.*
Review URL: https://codereview.chromium.org/1413543005
Cr-Commit-Position: refs/heads/master@{#367914}
Diffstat (limited to 'extensions/common/extension_messages.h')
-rw-r--r-- | extensions/common/extension_messages.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/extensions/common/extension_messages.h b/extensions/common/extension_messages.h index ce8f251..6ff3cf1 100644 --- a/extensions/common/extension_messages.h +++ b/extensions/common/extension_messages.h @@ -182,14 +182,6 @@ IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo) // The URL of the frame that initiated the request. IPC_STRUCT_MEMBER(GURL, source_url) - // The ID of the tab that is the target of the request, or -1 if there is no - // target tab. - IPC_STRUCT_MEMBER(int, target_tab_id) - - // The ID of the frame that is the target of the request, or -1 if there is - // no target frame (implying the message is for all frames). - IPC_STRUCT_MEMBER(int, target_frame_id) - // The process ID of the webview that initiated the request. IPC_STRUCT_MEMBER(int, guest_process_id) @@ -642,38 +634,46 @@ IPC_MESSAGE_ROUTED1(ExtensionHostMsg_EventAck, int /* message_id */) // sending messages. If an error occurred, the opener will be notified // asynchronously. IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension, - int /* routing_id */, + int /* frame_routing_id */, ExtensionMsg_ExternalConnectionInfo, std::string /* channel_name */, bool /* include_tls_channel_id */, int /* port_id */) IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp, - int /* routing_id */, + int /* frame_routing_id */, std::string /* source_extension_id */, std::string /* native_app_name */, int /* port_id */) // Get a port handle to the given tab. The handle can be used for sending // messages to the extension. -IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToTab, +IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab, + int /* frame_routing_id */, ExtensionMsg_TabTargetConnectionInfo, std::string /* extension_id */, std::string /* channel_name */, int /* port_id */) +// Sent in response to ExtensionMsg_DispatchOnConnect when the port is accepted. +// The handle is the value returned by ExtensionHostMsg_OpenChannelTo*. +IPC_MESSAGE_CONTROL2(ExtensionHostMsg_OpenMessagePort, + int /* frame_routing_id */, + int /* port_id */); + +// Sent in response to ExtensionMsg_DispatchOnConnect and whenever the port is +// closed. The handle is the value returned by ExtensionHostMsg_OpenChannelTo*. +IPC_MESSAGE_CONTROL3(ExtensionHostMsg_CloseMessagePort, + int /* frame_routing_id */, + int /* port_id */, + bool /* force_close */); + // Send a message to an extension process. The handle is the value returned -// by ViewHostMsg_OpenChannelTo*. +// by ExtensionHostMsg_OpenChannelTo*. IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage, int /* port_id */, extensions::Message) -// Send a message to an extension process. The handle is the value returned -// by ViewHostMsg_OpenChannelTo*. -IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel, - int /* port_id */, - std::string /* error_message */) - // Used to get the extension message bundle. IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle, std::string /* extension id */, |