diff options
22 files changed, 776 insertions, 58 deletions
diff --git a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc index 1f5ca9e..eb14534 100644 --- a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc +++ b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc @@ -178,21 +178,24 @@ class GViewRequestInterceptorTest : public testing::Test { content::ResourceContext* context = content::MockResourceContext::GetInstance(); ResourceDispatcherHostRequestInfo* info = - new ResourceDispatcherHostRequestInfo(handler_, - ChildProcessInfo::RENDER_PROCESS, - -1, // child_id - MSG_ROUTING_NONE, - 0, // origin_pid - request->identifier(), - false, // is_main_frame - -1, // frame_id - ResourceType::MAIN_FRAME, - content::PAGE_TRANSITION_LINK, - 0, // upload_size - false, // is_download - true, // allow_download - false, // has_user_gesture - context); + new ResourceDispatcherHostRequestInfo( + handler_, + ChildProcessInfo::RENDER_PROCESS, + -1, // child_id + MSG_ROUTING_NONE, + 0, // origin_pid + request->identifier(), + false, // is_main_frame + -1, // frame_id + false, // parent_is_main_frame + -1, // parent_frame_id + ResourceType::MAIN_FRAME, + content::PAGE_TRANSITION_LINK, + 0, // upload_size + false, // is_download + true, // allow_download + false, // has_user_gesture + context); request->SetUserData(NULL, info); request->set_context(context->request_context()); } diff --git a/chrome/browser/extensions/extension_webrequest_api.cc b/chrome/browser/extensions/extension_webrequest_api.cc index f1cf685..03516be 100644 --- a/chrome/browser/extensions/extension_webrequest_api.cc +++ b/chrome/browser/extensions/extension_webrequest_api.cc @@ -204,6 +204,8 @@ bool ParseResourceType(const std::string& type_str, void ExtractRequestInfoDetails(net::URLRequest* request, bool* is_main_frame, int64* frame_id, + bool* parent_is_main_frame, + int64* parent_frame_id, int* tab_id, int* window_id, ResourceType::Type* resource_type) { @@ -216,6 +218,8 @@ void ExtractRequestInfoDetails(net::URLRequest* request, info->child_id(), info->route_id(), tab_id, window_id); *frame_id = info->frame_id(); *is_main_frame = info->is_main_frame(); + *parent_frame_id = info->parent_frame_id(); + *parent_is_main_frame = info->parent_is_main_frame(); // Restrict the resource type to the values we care about. ResourceType::Type* iter = @@ -231,19 +235,26 @@ void ExtractRequestInfoDetails(net::URLRequest* request, void ExtractRequestInfo(net::URLRequest* request, DictionaryValue* out) { bool is_main_frame = false; int64 frame_id = -1; + bool parent_is_main_frame = false; + int64 parent_frame_id = -1; int frame_id_for_extension = -1; + int parent_frame_id_for_extension = -1; int tab_id = -1; int window_id = -1; ResourceType::Type resource_type = ResourceType::LAST_TYPE; - ExtractRequestInfoDetails(request, &is_main_frame, &frame_id, &tab_id, + ExtractRequestInfoDetails(request, &is_main_frame, &frame_id, + &parent_is_main_frame, &parent_frame_id, &tab_id, &window_id, &resource_type); frame_id_for_extension = GetFrameId(is_main_frame, frame_id); + parent_frame_id_for_extension = GetFrameId(parent_is_main_frame, + parent_frame_id); out->SetString(keys::kRequestIdKey, base::Uint64ToString(request->identifier())); out->SetString(keys::kUrlKey, request->url().spec()); out->SetString(keys::kMethodKey, request->method()); out->SetInteger(keys::kFrameIdKey, frame_id_for_extension); + out->SetInteger(keys::kParentFrameIdKey, parent_frame_id_for_extension); out->SetInteger(keys::kTabIdKey, tab_id); out->SetString(keys::kTypeKey, ResourceTypeToString(resource_type)); out->SetDouble(keys::kTimeStampKey, base::Time::Now().ToDoubleT() * 1000); @@ -1083,12 +1094,15 @@ bool ExtensionWebRequestEventRouter::IsPageLoad( net::URLRequest* request) const { bool is_main_frame = false; int64 frame_id = -1; + bool parent_is_main_frame = false; + int64 parent_frame_id = -1; int tab_id = -1; int window_id = -1; ResourceType::Type resource_type = ResourceType::LAST_TYPE; - ExtractRequestInfoDetails(request, &is_main_frame, &frame_id, &tab_id, - &window_id, &resource_type); + ExtractRequestInfoDetails(request, &is_main_frame, &frame_id, + &parent_is_main_frame, &parent_frame_id, + &tab_id, &window_id, &resource_type); return resource_type == ResourceType::MAIN_FRAME; } @@ -1167,13 +1181,16 @@ ExtensionWebRequestEventRouter::GetMatchingListeners( bool is_main_frame = false; int64 frame_id = -1; + bool parent_is_main_frame = false; + int64 parent_frame_id = -1; int tab_id = -1; int window_id = -1; ResourceType::Type resource_type = ResourceType::LAST_TYPE; const GURL& url = request->url(); - ExtractRequestInfoDetails(request, &is_main_frame, &frame_id, &tab_id, - &window_id, &resource_type); + ExtractRequestInfoDetails(request, &is_main_frame, &frame_id, + &parent_is_main_frame, &parent_frame_id, + &tab_id, &window_id, &resource_type); std::vector<const ExtensionWebRequestEventRouter::EventListener*> matching_listeners; diff --git a/chrome/browser/extensions/extension_webrequest_api_constants.cc b/chrome/browser/extensions/extension_webrequest_api_constants.cc index 82e5fb7..c175bb1 100644 --- a/chrome/browser/extensions/extension_webrequest_api_constants.cc +++ b/chrome/browser/extensions/extension_webrequest_api_constants.cc @@ -9,6 +9,7 @@ namespace extension_webrequest_api_constants { const char kChallengerKey[] = "challenger"; const char kErrorKey[] = "error"; const char kFrameIdKey[] = "frameId"; +const char kParentFrameIdKey[] = "parentFrameId"; const char kFromCache[] = "fromCache"; const char kHostKey[] = "host"; const char kIpKey[] = "ip"; diff --git a/chrome/browser/extensions/extension_webrequest_api_constants.h b/chrome/browser/extensions/extension_webrequest_api_constants.h index e58d17e..77fa511 100644 --- a/chrome/browser/extensions/extension_webrequest_api_constants.h +++ b/chrome/browser/extensions/extension_webrequest_api_constants.h @@ -14,6 +14,7 @@ namespace extension_webrequest_api_constants { extern const char kChallengerKey[]; extern const char kErrorKey[]; extern const char kFrameIdKey[]; +extern const char kParentFrameIdKey[]; extern const char kFromCache[]; extern const char kHostKey[]; extern const char kIpKey[]; diff --git a/chrome/browser/extensions/network_delay_listener_unittest.cc b/chrome/browser/extensions/network_delay_listener_unittest.cc index e550851..0b36b30 100644 --- a/chrome/browser/extensions/network_delay_listener_unittest.cc +++ b/chrome/browser/extensions/network_delay_listener_unittest.cc @@ -38,7 +38,7 @@ const char kTestExtensionNoNetworkDelay[] = "aocebcndggcnnmflapdklcmnfojmkmie"; ResourceDispatcherHostRequestInfo* CreateRequestInfo(int request_id) { return new ResourceDispatcherHostRequestInfo( new DummyResourceHandler(), ChildProcessInfo::RENDER_PROCESS, 0, 0, 0, - request_id, false, -1, ResourceType::MAIN_FRAME, + request_id, false, -1, false, -1, ResourceType::MAIN_FRAME, content::PAGE_TRANSITION_LINK, 0, false, false, false, content::MockResourceContext::GetInstance()); } diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index d046bdf..b7ea9e4 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc @@ -38,7 +38,7 @@ const char kTestData[] = "Hello, World!"; ResourceDispatcherHostRequestInfo* CreateRequestInfo(int request_id) { return new ResourceDispatcherHostRequestInfo( new DummyResourceHandler(), ChildProcessInfo::RENDER_PROCESS, 0, 0, 0, - request_id, false, -1, ResourceType::MAIN_FRAME, + request_id, false, -1, false, -1, ResourceType::MAIN_FRAME, content::PAGE_TRANSITION_LINK, 0, false, false, false, content::MockResourceContext::GetInstance()); } diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 163a930..ecf23d7 100644 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -5912,6 +5912,7 @@ "url": {"type": "string"}, "method": {"type": "string", "description": "Standard HTTP method."}, "frameId": {"type": "integer", "description": "0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, + "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."} @@ -5955,6 +5956,7 @@ "url": {"type": "string"}, "method": {"type": "string", "description": "Standard HTTP method."}, "frameId": {"type": "integer", "description": "0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, + "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, @@ -5999,6 +6001,7 @@ "url": {"type": "string"}, "method": {"type": "string", "description": "Standard HTTP method."}, "frameId": {"type": "integer", "description": "0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, + "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, @@ -6038,6 +6041,7 @@ "url": {"type": "string"}, "method": {"type": "string", "description": "Standard HTTP method."}, "frameId": {"type": "integer", "description": "0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, + "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, @@ -6083,6 +6087,7 @@ "url": {"type": "string"}, "method": {"type": "string", "description": "Standard HTTP method."}, "frameId": {"type": "integer", "description": "0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, + "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, @@ -6140,6 +6145,7 @@ "url": {"type": "string"}, "method": {"type": "string", "description": "Standard HTTP method."}, "frameId": {"type": "integer", "description": "0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, + "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, @@ -6183,6 +6189,7 @@ "url": {"type": "string"}, "method": {"type": "string", "description": "Standard HTTP method."}, "frameId": {"type": "integer", "description": "0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, + "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, @@ -6227,6 +6234,7 @@ "url": {"type": "string"}, "method": {"type": "string", "description": "Standard HTTP method."}, "frameId": {"type": "integer", "description": "0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, + "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, @@ -6270,6 +6278,7 @@ "url": {"type": "string"}, "method": {"type": "string", "description": "Standard HTTP method."}, "frameId": {"type": "integer", "description": "0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."}, + "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."}, "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, diff --git a/chrome/common/extensions/docs/experimental.webRequest.html b/chrome/common/extensions/docs/experimental.webRequest.html index 9bf8f4e1..f668c15 100644 --- a/chrome/common/extensions/docs/experimental.webRequest.html +++ b/chrome/common/extensions/docs/experimental.webRequest.html @@ -1428,6 +1428,74 @@ chrome.windows.onRemoved.addListener( </div><div> <div> <dt> + <var>parentFrameId</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span class="enum" style="display: none; ">enumerated</span> + <span id="typeTemplate"> + <span style="display: none; "> + <a> Type</a> + </span> + <span> + <span style="display: none; "> + array of <span><span></span></span> + </span> + <span>integer</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.</dd> + <dd style="display: none; "> + This parameter was added in version + <b><span></span></b>. + You must omit this parameter in earlier versions, + and you may omit it in any version. If you require this + parameter, the manifest key + <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> + can ensure that your extension won't be run in an earlier browser version. + </dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + + <!-- OBJECT METHODS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- OBJECT EVENT FIELDS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- FUNCTION PARAMETERS --> + <dd style="display: none; "> + <div></div> + </dd> + + </div> + </div><div> + <div> + <dt> <var>tabId</var> <em> @@ -2839,6 +2907,74 @@ chrome.windows.onRemoved.addListener( </div><div> <div> <dt> + <var>parentFrameId</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span class="enum" style="display: none; ">enumerated</span> + <span id="typeTemplate"> + <span style="display: none; "> + <a> Type</a> + </span> + <span> + <span style="display: none; "> + array of <span><span></span></span> + </span> + <span>integer</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.</dd> + <dd style="display: none; "> + This parameter was added in version + <b><span></span></b>. + You must omit this parameter in earlier versions, + and you may omit it in any version. If you require this + parameter, the manifest key + <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> + can ensure that your extension won't be run in an earlier browser version. + </dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + + <!-- OBJECT METHODS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- OBJECT EVENT FIELDS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- FUNCTION PARAMETERS --> + <dd style="display: none; "> + <div></div> + </dd> + + </div> + </div><div> + <div> + <dt> <var>tabId</var> <em> @@ -3978,6 +4114,74 @@ chrome.windows.onRemoved.addListener( </div><div> <div> <dt> + <var>parentFrameId</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span class="enum" style="display: none; ">enumerated</span> + <span id="typeTemplate"> + <span style="display: none; "> + <a> Type</a> + </span> + <span> + <span style="display: none; "> + array of <span><span></span></span> + </span> + <span>integer</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.</dd> + <dd style="display: none; "> + This parameter was added in version + <b><span></span></b>. + You must omit this parameter in earlier versions, + and you may omit it in any version. If you require this + parameter, the manifest key + <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> + can ensure that your extension won't be run in an earlier browser version. + </dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + + <!-- OBJECT METHODS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- OBJECT EVENT FIELDS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- FUNCTION PARAMETERS --> + <dd style="display: none; "> + <div></div> + </dd> + + </div> + </div><div> + <div> + <dt> <var>tabId</var> <em> @@ -4774,6 +4978,74 @@ chrome.windows.onRemoved.addListener( </div><div> <div> <dt> + <var>parentFrameId</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span class="enum" style="display: none; ">enumerated</span> + <span id="typeTemplate"> + <span style="display: none; "> + <a> Type</a> + </span> + <span> + <span style="display: none; "> + array of <span><span></span></span> + </span> + <span>integer</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.</dd> + <dd style="display: none; "> + This parameter was added in version + <b><span></span></b>. + You must omit this parameter in earlier versions, + and you may omit it in any version. If you require this + parameter, the manifest key + <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> + can ensure that your extension won't be run in an earlier browser version. + </dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + + <!-- OBJECT METHODS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- OBJECT EVENT FIELDS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- FUNCTION PARAMETERS --> + <dd style="display: none; "> + <div></div> + </dd> + + </div> + </div><div> + <div> + <dt> <var>tabId</var> <em> @@ -5638,6 +5910,74 @@ chrome.windows.onRemoved.addListener( </div><div> <div> <dt> + <var>parentFrameId</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span class="enum" style="display: none; ">enumerated</span> + <span id="typeTemplate"> + <span style="display: none; "> + <a> Type</a> + </span> + <span> + <span style="display: none; "> + array of <span><span></span></span> + </span> + <span>integer</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.</dd> + <dd style="display: none; "> + This parameter was added in version + <b><span></span></b>. + You must omit this parameter in earlier versions, + and you may omit it in any version. If you require this + parameter, the manifest key + <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> + can ensure that your extension won't be run in an earlier browser version. + </dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + + <!-- OBJECT METHODS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- OBJECT EVENT FIELDS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- FUNCTION PARAMETERS --> + <dd style="display: none; "> + <div></div> + </dd> + + </div> + </div><div> + <div> + <dt> <var>tabId</var> <em> @@ -6709,6 +7049,74 @@ chrome.windows.onRemoved.addListener( </div><div> <div> <dt> + <var>parentFrameId</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span class="enum" style="display: none; ">enumerated</span> + <span id="typeTemplate"> + <span style="display: none; "> + <a> Type</a> + </span> + <span> + <span style="display: none; "> + array of <span><span></span></span> + </span> + <span>integer</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.</dd> + <dd style="display: none; "> + This parameter was added in version + <b><span></span></b>. + You must omit this parameter in earlier versions, + and you may omit it in any version. If you require this + parameter, the manifest key + <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> + can ensure that your extension won't be run in an earlier browser version. + </dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + + <!-- OBJECT METHODS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- OBJECT EVENT FIELDS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- FUNCTION PARAMETERS --> + <dd style="display: none; "> + <div></div> + </dd> + + </div> + </div><div> + <div> + <dt> <var>tabId</var> <em> @@ -7565,6 +7973,74 @@ chrome.windows.onRemoved.addListener( </div><div> <div> <dt> + <var>parentFrameId</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span class="enum" style="display: none; ">enumerated</span> + <span id="typeTemplate"> + <span style="display: none; "> + <a> Type</a> + </span> + <span> + <span style="display: none; "> + array of <span><span></span></span> + </span> + <span>integer</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.</dd> + <dd style="display: none; "> + This parameter was added in version + <b><span></span></b>. + You must omit this parameter in earlier versions, + and you may omit it in any version. If you require this + parameter, the manifest key + <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> + can ensure that your extension won't be run in an earlier browser version. + </dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + + <!-- OBJECT METHODS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- OBJECT EVENT FIELDS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- FUNCTION PARAMETERS --> + <dd style="display: none; "> + <div></div> + </dd> + + </div> + </div><div> + <div> + <dt> <var>tabId</var> <em> @@ -8497,6 +8973,74 @@ chrome.windows.onRemoved.addListener( </div><div> <div> <dt> + <var>parentFrameId</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span class="enum" style="display: none; ">enumerated</span> + <span id="typeTemplate"> + <span style="display: none; "> + <a> Type</a> + </span> + <span> + <span style="display: none; "> + array of <span><span></span></span> + </span> + <span>integer</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.</dd> + <dd style="display: none; "> + This parameter was added in version + <b><span></span></b>. + You must omit this parameter in earlier versions, + and you may omit it in any version. If you require this + parameter, the manifest key + <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> + can ensure that your extension won't be run in an earlier browser version. + </dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + + <!-- OBJECT METHODS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- OBJECT EVENT FIELDS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- FUNCTION PARAMETERS --> + <dd style="display: none; "> + <div></div> + </dd> + + </div> + </div><div> + <div> + <dt> <var>tabId</var> <em> @@ -9568,6 +10112,74 @@ chrome.windows.onRemoved.addListener( </div><div> <div> <dt> + <var>parentFrameId</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span class="enum" style="display: none; ">enumerated</span> + <span id="typeTemplate"> + <span style="display: none; "> + <a> Type</a> + </span> + <span> + <span style="display: none; "> + array of <span><span></span></span> + </span> + <span>integer</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists.</dd> + <dd style="display: none; "> + This parameter was added in version + <b><span></span></b>. + You must omit this parameter in earlier versions, + and you may omit it in any version. If you require this + parameter, the manifest key + <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> + can ensure that your extension won't be run in an earlier browser version. + </dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + + <!-- OBJECT METHODS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- OBJECT EVENT FIELDS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- FUNCTION PARAMETERS --> + <dd style="display: none; "> + <div></div> + </dd> + + </div> + </div><div> + <div> + <dt> <var>tabId</var> <em> diff --git a/chrome/test/data/extensions/api_test/webrequest/framework.js b/chrome/test/data/extensions/api_test/webrequest/framework.js index f7e2157..39d3fca 100644 --- a/chrome/test/data/extensions/api_test/webrequest/framework.js +++ b/chrome/test/data/extensions/api_test/webrequest/framework.js @@ -9,6 +9,7 @@ var capturedEventData; var expectedEventOrder; var tabId; var tabIdMap; +var frameIdMap; var testServerPort; var testServer = "www.a.com"; var eventsCaptured; @@ -66,17 +67,24 @@ function expect(data, order, filter, extraInfoSpec) { expectedEventOrder = order; eventsCaptured = chrome.test.callbackAdded(); tabAndFrameUrls = {}; // Maps "{tabId}-{frameId}" to the URL of the frame. + frameIdMap = {"-1": -1}; removeListeners(); initListeners(filter || {}, extraInfoSpec || []); // Fill in default values. for (var i = 0; i < expectedEventData.length; ++i) { - if (!expectedEventData[i].details.method) { + if (!('method' in expectedEventData[i].details)) { expectedEventData[i].details.method = "GET"; } - if (!expectedEventData[i].details.tabId) { + if (!('tabId' in expectedEventData[i].details)) { expectedEventData[i].details.tabId = tabIdMap[tabId]; } - if (!expectedEventData[i].details.type) { + if (!('frameId' in expectedEventData[i].details)) { + expectedEventData[i].details.frameId = 0; + } + if (!('parentFrameId' in expectedEventData[i].details)) { + expectedEventData[i].details.parentFrameId = -1; + } + if (!('type' in expectedEventData[i].details)) { expectedEventData[i].details.type = "main_frame"; } } @@ -162,7 +170,17 @@ function captureEvent(name, details, callback) { } details.frameUrl = tabAndFrameUrls[key] || "unknown frame URL"; } - delete details.frameId; + + // This assigns unique IDs to frames. The new IDs are only deterministic, if + // the frames documents are loaded in order. Don't write browser tests with + // more than one frame ID and rely on their numbers. + if (!(details.frameId in frameIdMap)) { + // Subtract one to discount for {"-1": -1} mapping that always exists. + // This gives the first frame the ID 0. + frameIdMap[details.frameId] = Object.keys(frameIdMap).length - 1; + } + details.frameId = frameIdMap[details.frameId]; + details.parentFrameId = frameIdMap[details.parentFrameId]; // This assigns unique IDs to newly opened tabs. However, the new IDs are only // deterministic, if the order in which the tabs are opened is deterministic. diff --git a/chrome/test/data/extensions/api_test/webrequest/test_blocking.html b/chrome/test/data/extensions/api_test/webrequest/test_blocking.html index 8e12ac1..60cfac1 100644 --- a/chrome/test/data/extensions/api_test/webrequest/test_blocking.html +++ b/chrome/test/data/extensions/api_test/webrequest/test_blocking.html @@ -48,14 +48,7 @@ runTests([ ], {}, // filter ["blocking"]); - navigateAndWait(getURL("complexLoad/b.html"), function() { - // Workaround for hanging test. For some reason, if we try to load - // a new URL in the current tab, it hangs on the buildbot. - // See http://crbug.com/91715 - chrome.tabs.create({url: "about:blank"}, pass(function(tab) { - tabId = tab.id; - })); - }); + navigateAndWait(getURL("complexLoad/b.html")); }, // Navigates to a page with subresources, with a blocking handler that @@ -68,7 +61,6 @@ runTests([ event: "onBeforeRequest", details: { method: "GET", - tabId: tabId, type: "main_frame", url: getURLHttpSimpleLoad(), frameUrl: getURLHttpSimpleLoad() @@ -260,7 +252,6 @@ runTests([ event: "onBeforeRequest", details: { method: "GET", - tabId: tabId, type: "main_frame", url: getURLSetCookie(), frameUrl: getURLSetCookie() diff --git a/chrome/test/data/extensions/api_test/webrequest/test_complex.html b/chrome/test/data/extensions/api_test/webrequest/test_complex.html index 4628576..06c5708 100644 --- a/chrome/test/data/extensions/api_test/webrequest/test_complex.html +++ b/chrome/test/data/extensions/api_test/webrequest/test_complex.html @@ -26,7 +26,9 @@ runTests([ details: { type: "sub_frame", url: getURL("complexLoad/b.html"), - frameUrl: getURL("complexLoad/b.html") + frameUrl: getURL("complexLoad/b.html"), + frameId: 1, + parentFrameId: 0, } }, { label: "b.jpg-onBeforeRequest", @@ -34,7 +36,9 @@ runTests([ details: { type: "image", url: getURL("complexLoad/b.jpg"), - frameUrl: getURL("complexLoad/b.html") + frameUrl: getURL("complexLoad/b.html"), + frameId: 1, + parentFrameId: 0, } }, { label: "a.html-onResponseStarted", @@ -56,6 +60,8 @@ runTests([ fromCache: false, statusCode: 200, statusLine: "HTTP/1.1 200 OK", + frameId: 1, + parentFrameId: 0, // Request to chrome-extension:// url has no IP. } }, @@ -67,6 +73,8 @@ runTests([ fromCache: false, statusCode: 200, statusLine: "HTTP/1.1 200 OK", + frameId: 1, + parentFrameId: 0, // Request to chrome-extension:// url has no IP. } }, @@ -89,6 +97,8 @@ runTests([ fromCache: false, statusCode: 200, statusLine: "HTTP/1.1 200 OK", + frameId: 1, + parentFrameId: 0, // Request to chrome-extension:// url has no IP. } }, @@ -100,6 +110,8 @@ runTests([ fromCache: false, statusCode: 200, statusLine: "HTTP/1.1 200 OK", + frameId: 1, + parentFrameId: 0, // Request to chrome-extension:// url has no IP. } }, @@ -134,7 +146,9 @@ runTests([ type: "image", url: getURL("complexLoad/b.jpg"), // As we do not listed to sub-frames we do not know the frameUrl. - frameUrl: "unknown frame URL" + frameUrl: "unknown frame URL", + frameId: 1, + parentFrameId: 0, } }, { label: "a-onResponseStarted", @@ -156,6 +170,8 @@ runTests([ fromCache: false, statusCode: 200, statusLine: "HTTP/1.1 200 OK", + frameId: 1, + parentFrameId: 0, // Request to chrome-extension:// url has no IP. } }, @@ -178,6 +194,8 @@ runTests([ fromCache: false, statusCode: 200, statusLine: "HTTP/1.1 200 OK", + frameId: 1, + parentFrameId: 0, // Request to chrome-extension:// url has no IP. } }, diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc index 8da96b4..7fa8c61 100644 --- a/content/browser/renderer_host/resource_dispatcher_host.cc +++ b/content/browser/renderer_host/resource_dispatcher_host.cc @@ -597,6 +597,8 @@ void ResourceDispatcherHost::BeginRequest( request_id, request_data.is_main_frame, request_data.frame_id, + request_data.parent_is_main_frame, + request_data.parent_frame_id, request_data.resource_type, request_data.transition_type, upload_size, @@ -746,21 +748,24 @@ ResourceDispatcherHostRequestInfo* ResourceDispatcherHost::CreateRequestInfo( int route_id, bool download, const content::ResourceContext& context) { - return new ResourceDispatcherHostRequestInfo(handler, - ChildProcessInfo::RENDER_PROCESS, - child_id, - route_id, - 0, - request_id_, - false, // is_main_frame - -1, // frame_id - ResourceType::SUB_RESOURCE, - content::PAGE_TRANSITION_LINK, - 0, // upload_size - download, // is_download - download, // allow_download - false, // has_user_gesture - &context); + return new ResourceDispatcherHostRequestInfo( + handler, + ChildProcessInfo::RENDER_PROCESS, + child_id, + route_id, + 0, + request_id_, + false, // is_main_frame + -1, // frame_id + false, // parent_is_main_frame + -1, // parent_frame_id + ResourceType::SUB_RESOURCE, + content::PAGE_TRANSITION_LINK, + 0, // upload_size + download, // is_download + download, // allow_download + false, // has_user_gesture + &context); } void ResourceDispatcherHost::OnSwapOutACK( diff --git a/content/browser/renderer_host/resource_dispatcher_host_request_info.cc b/content/browser/renderer_host/resource_dispatcher_host_request_info.cc index 0205aae..4e4e85e 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_request_info.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_request_info.cc @@ -18,6 +18,8 @@ ResourceDispatcherHostRequestInfo::ResourceDispatcherHostRequestInfo( int request_id, bool is_main_frame, int64 frame_id, + bool parent_is_main_frame, + int64 parent_frame_id, ResourceType::Type resource_type, content::PageTransition transition_type, uint64 upload_size, @@ -34,6 +36,8 @@ ResourceDispatcherHostRequestInfo::ResourceDispatcherHostRequestInfo( request_id_(request_id), is_main_frame_(is_main_frame), frame_id_(frame_id), + parent_is_main_frame_(parent_is_main_frame), + parent_frame_id_(parent_frame_id), pending_data_count_(0), is_download_(is_download), allow_download_(allow_download), diff --git a/content/browser/renderer_host/resource_dispatcher_host_request_info.h b/content/browser/renderer_host/resource_dispatcher_host_request_info.h index 0c0b35e..9756cc6 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_request_info.h +++ b/content/browser/renderer_host/resource_dispatcher_host_request_info.h @@ -46,6 +46,8 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData { int request_id, bool is_main_frame, int64 frame_id, + bool parent_is_main_frame, + int64 parent_frame_id, ResourceType::Type resource_type, content::PageTransition transition_type, uint64 upload_size, @@ -112,6 +114,13 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData { // Frame ID that sent this resource request. -1 if unknown / invalid. int64 frame_id() const { return frame_id_; } + // True if |parent_frame_id_| represents a main frame in the RenderView. + bool parent_is_main_frame() const { return parent_is_main_frame_; } + + // Frame ID of parent frame of frame that sent this resource request. + // -1 if unknown / invalid. + int64 parent_frame_id() const { return parent_frame_id_; } + // Number of messages we've sent to the renderer that we haven't gotten an // ACK for. This allows us to avoid having too many messages in flight. int pending_data_count() const { return pending_data_count_; } @@ -220,6 +229,8 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData { int request_id_; bool is_main_frame_; int64 frame_id_; + bool parent_is_main_frame_; + int64 parent_frame_id_; int pending_data_count_; bool is_download_; bool allow_download_; diff --git a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc index 560c59d..3247f78 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc @@ -87,6 +87,8 @@ static ResourceHostMsg_Request CreateResourceRequest( request.download_to_file = false; request.is_main_frame = true; request.frame_id = 0; + request.parent_is_main_frame = false; + request.parent_frame_id = -1; request.transition_type = content::PAGE_TRANSITION_LINK; return request; } diff --git a/content/browser/renderer_host/resource_queue_unittest.cc b/content/browser/renderer_host/resource_queue_unittest.cc index 873eac3..2f9e496 100644 --- a/content/browser/renderer_host/resource_queue_unittest.cc +++ b/content/browser/renderer_host/resource_queue_unittest.cc @@ -25,7 +25,7 @@ const char kTestUrl[] = "data:text/plain,Hello World!"; ResourceDispatcherHostRequestInfo* GetRequestInfo(int request_id) { return new ResourceDispatcherHostRequestInfo( new DummyResourceHandler(), ChildProcessInfo::RENDER_PROCESS, 0, 0, 0, - request_id, false, -1, ResourceType::MAIN_FRAME, + request_id, false, -1, false, -1, ResourceType::MAIN_FRAME, content::PAGE_TRANSITION_LINK, 0, false, false, false, content::MockResourceContext::GetInstance()); } diff --git a/content/common/request_extra_data.cc b/content/common/request_extra_data.cc index 9c1e0ec..1861808 100644 --- a/content/common/request_extra_data.cc +++ b/content/common/request_extra_data.cc @@ -6,9 +6,13 @@ RequestExtraData::RequestExtraData(bool is_main_frame, int64 frame_id, + bool parent_is_main_frame, + int64 parent_frame_id, content::PageTransition transition_type) : is_main_frame_(is_main_frame), frame_id_(frame_id), + parent_is_main_frame_(parent_is_main_frame), + parent_frame_id_(parent_frame_id), transition_type_(transition_type) { } diff --git a/content/common/request_extra_data.h b/content/common/request_extra_data.h index 4fc2917..f93c587 100644 --- a/content/common/request_extra_data.h +++ b/content/common/request_extra_data.h @@ -18,16 +18,22 @@ class CONTENT_EXPORT RequestExtraData public: RequestExtraData(bool is_main_frame, int64 frame_id, + bool parent_is_main_frame, + int64 parent_frame_id, content::PageTransition transition_type); virtual ~RequestExtraData(); bool is_main_frame() const { return is_main_frame_; } int64 frame_id() const { return frame_id_; } + bool parent_is_main_frame() const { return parent_is_main_frame_; } + int64 parent_frame_id() const { return parent_frame_id_; } content::PageTransition transition_type() const { return transition_type_; } private: bool is_main_frame_; int64 frame_id_; + bool parent_is_main_frame_; + int64 parent_frame_id_; content::PageTransition transition_type_; DISALLOW_COPY_AND_ASSIGN(RequestExtraData); diff --git a/content/common/resource_dispatcher.cc b/content/common/resource_dispatcher.cc index a94c3ba..f7b0b3d 100644 --- a/content/common/resource_dispatcher.cc +++ b/content/common/resource_dispatcher.cc @@ -99,10 +99,14 @@ IPCResourceLoaderBridge::IPCResourceLoaderBridge( static_cast<RequestExtraData*>(request_info.extra_data); request_.is_main_frame = extra_data->is_main_frame(); request_.frame_id = extra_data->frame_id(); + request_.parent_is_main_frame = extra_data->parent_is_main_frame(); + request_.parent_frame_id = extra_data->parent_frame_id(); request_.transition_type = extra_data->transition_type(); } else { request_.is_main_frame = false; request_.frame_id = -1; + request_.parent_is_main_frame = false; + request_.parent_frame_id = -1; request_.transition_type = content::PAGE_TRANSITION_LINK; } } diff --git a/content/common/resource_dispatcher_unittest.cc b/content/common/resource_dispatcher_unittest.cc index 12d09b0..56561fe 100644 --- a/content/common/resource_dispatcher_unittest.cc +++ b/content/common/resource_dispatcher_unittest.cc @@ -171,7 +171,8 @@ class ResourceDispatcherTest : public testing::Test, request_info.request_type = ResourceType::SUB_RESOURCE; request_info.appcache_host_id = appcache::kNoHostId; request_info.routing_id = 0; - RequestExtraData extra_data(true, 0, content::PAGE_TRANSITION_LINK); + RequestExtraData extra_data(true, 0, false, -1, + content::PAGE_TRANSITION_LINK); request_info.extra_data = &extra_data; return dispatcher_->CreateBridge(request_info); diff --git a/content/common/resource_messages.h b/content/common/resource_messages.h index b132a13e..a6982e6 100644 --- a/content/common/resource_messages.h +++ b/content/common/resource_messages.h @@ -103,6 +103,13 @@ IPC_STRUCT_BEGIN(ResourceHostMsg_Request) // -1 if unknown / invalid. IPC_STRUCT_MEMBER(int64, frame_id) + // True if |parent_frame_id| is the main frame of a RenderView. + IPC_STRUCT_MEMBER(bool, parent_is_main_frame) + + // Identifies the parent frame of the frame that sent the request. + // -1 if unknown / invalid. + IPC_STRUCT_MEMBER(int64, parent_frame_id) + IPC_STRUCT_MEMBER(content::PageTransition, transition_type) IPC_STRUCT_END() diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index f8660b7..ee41e27 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -2648,8 +2648,12 @@ void RenderViewImpl::willSendRequest(WebFrame* frame, transition_type = data_state->transition_type(); } - request.setExtraData(new RequestExtraData((frame == top_frame), - frame->identifier(), transition_type)); + request.setExtraData( + new RequestExtraData((frame == top_frame), + frame->identifier(), + frame->parent() == top_frame, + frame->parent() ? frame->parent()->identifier() : -1, + transition_type)); NavigationState* top_data_state = NavigationState::FromDataSource(top_data_source); |