|
|
This change captures the low-level socket address whenever a page is loaded,
and pushes it all the way up to the 'tabs' API, where extensions can read it
and do nifty things, such as displaying an IPv4/IPv6 indicator.
Here's a description of what's happening:
1. Extract the address in http_stream_parser.cc (for HTTP) or spdy_http_stream
(for SPDY). Note that if the connection is via a proxy, then we get the
address of the proxy server... not terribly useful, but not wrong either.
2. Put it into an HttpResponseInfo instance.
3. HttpResponseInfo (de)serializes the address.
4. Add a socket_address accessor in url_request.h, which pulls the address
from its HttpResponseInfo instance.
5. In resource_dispatcher_host.cc, move the address from URLRequest to
ResourceResponseHead (which is a subclass of ResourceResponseInfo).
6. In render_messages.cc (de)serialize the ResourceResponseInfo.
7. In weburlloader_impl.cc, copy from ResourceResponseInfo to WebURLResponse.
At this point, a patch to third_party/WebKit/Source is required:
http://www.pmarks.net/posted_links/socket_address_webkit.patch
8. In render_view.cc, copy from WebURLResponse to
ViewHostMsg_FrameNavigate_Params.
9. In render_messages_params.cc, *_FrameNavigate_Params is (de)serialized.
10. In navigation_controller.cc, copy from *_FrameNavigate_Params to a
NavigationEntry.
Note: there's a warning about SessionService in navigation_entry.h, but I don't
think it's relevant here. In the worst case, we just don't report the
address after restoring a tab, but I haven't seen this occur.
11. In extension_tabs_module.cc, check if the current NavigationEntry has a
socket address. If so, add a "socketAddress" string to the JSON object.
12. Finally, when someone registers a callback using chrome.tabs.onUpdated,
the 'tab' parameter includes the new socketAddress parameter.
Extensions can use the new paramter to display an IPv4/IPv6 icon, or do
whatever else with the IP and port. I've written a simple demo:
http://www.pmarks.net/posted_links/seetheips-newapi.crx
BUG= 51663
TEST=unit tests, demo extension.
Total comments: 2
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+268 lines, -75 lines) |
Patch |
 |
M |
chrome/browser/extensions/extension_tabs_apitest.cc
|
View
|
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/extensions/extension_tabs_module.cc
|
View
|
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/extensions/extension_tabs_module_constants.h
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/extensions/extension_tabs_module_constants.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/renderer_host/resource_dispatcher_host.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/renderer_host/test/test_render_view_host.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/tab_contents/navigation_controller.cc
|
View
|
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/tab_contents/navigation_controller_unittest.cc
|
View
|
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/tab_contents/navigation_entry.h
|
View
|
|
2 chunks |
+10 lines, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/tab_contents/navigation_entry_unittest.cc
|
View
|
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/common/extensions/api/extension_api.json
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/common/extensions/docs/tabs.html
|
View
|
|
1 chunk |
+58 lines, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/common/render_messages.cc
|
View
|
|
3 chunks |
+5 lines, -1 line |
0 comments
|
Download
|
 |
M |
chrome/common/render_messages_params.h
|
View
|
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/common/render_messages_params.cc
|
View
|
|
3 chunks |
+5 lines, -1 line |
0 comments
|
Download
|
 |
M |
chrome/renderer/render_view.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
chrome/test/data/extensions/api_test/tabs/on_updated/test.html
|
View
|
|
1 chunk |
+94 lines, -72 lines |
0 comments
|
Download
|
 |
M |
net/http/http_cache_unittest.cc
|
View
|
|
1 chunk |
+24 lines, -0 lines |
0 comments
|
Download
|
 |
M |
net/http/http_network_transaction_unittest.cc
|
View
|
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
net/http/http_response_info.h
|
View
|
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
 |
M |
net/http/http_response_info.cc
|
View
|
|
6 chunks |
+16 lines, -0 lines |
2 comments
|
Download
|
 |
M |
net/http/http_stream_parser.cc
|
View
|
|
2 chunks |
+8 lines, -0 lines |
0 comments
|
Download
|
 |
M |
net/socket/socket_test_util.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
net/spdy/spdy_http_stream.cc
|
View
|
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
 |
M |
net/spdy/spdy_network_transaction_unittest.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
net/url_request/url_request.h
|
View
|
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
 |
M |
webkit/glue/resource_loader_bridge.h
|
View
|
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
 |
M |
webkit/glue/weburlloader_impl.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
Total messages: 13 (0 generated)
|