diff options
author | Hokein.Wu@gmail.com <Hokein.Wu@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-29 08:44:53 +0000 |
---|---|---|
committer | Hokein.Wu@gmail.com <Hokein.Wu@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-29 08:44:53 +0000 |
commit | b55179cc94ee8a5d58ecb468421a254824f3d9aa (patch) | |
tree | 5eb6f3ced7c40f1ad479dbb2d5ec9f1452abf663 | |
parent | ce491a0b8e6f2bd39814775a1f395dc9cf3cea64 (diff) | |
download | chromium_src-b55179cc94ee8a5d58ecb468421a254824f3d9aa.zip chromium_src-b55179cc94ee8a5d58ecb468421a254824f3d9aa.tar.gz chromium_src-b55179cc94ee8a5d58ecb468421a254824f3d9aa.tar.bz2 |
Fix an out-of-date issue in chrome.webNavigation document.
The transitionType "start_page" is out of date, replace it with
"auto_toplevel"
BUG=333878
Review URL: https://codereview.chromium.org/137833002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247663 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc | 12 | ||||
-rw-r--r-- | chrome/common/extensions/api/web_navigation.json | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc index fe11eef..77f1a44 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc @@ -18,6 +18,7 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" +#include "content/public/common/page_transition_types.h" #include "extensions/browser/event_router.h" #include "extensions/common/event_filtering_info.h" #include "net/base/net_errors.h" @@ -99,9 +100,14 @@ void DispatchOnCommitted(const std::string& event_name, dict->SetInteger(keys::kProcessIdKey, web_contents->GetRenderViewHost()->GetProcess()->GetID()); dict->SetInteger(keys::kFrameIdKey, GetFrameId(is_main_frame, frame_id)); - dict->SetString( - keys::kTransitionTypeKey, - content::PageTransitionGetCoreTransitionString(transition_type)); + std::string transition_type_string = + content::PageTransitionGetCoreTransitionString(transition_type); + // For webNavigation API backward compatibility, keep "start_page" even after + // renamed to "auto_toplevel". + if (PageTransitionStripQualifier(transition_type) == + content::PAGE_TRANSITION_AUTO_TOPLEVEL) + transition_type_string = "start_page"; + dict->SetString(keys::kTransitionTypeKey, transition_type_string); base::ListValue* qualifiers = new base::ListValue(); if (transition_type & content::PAGE_TRANSITION_CLIENT_REDIRECT) qualifiers->Append(new base::StringValue("client_redirect")); diff --git a/chrome/common/extensions/api/web_navigation.json b/chrome/common/extensions/api/web_navigation.json index 783ecdd..63f1d9c 100644 --- a/chrome/common/extensions/api/web_navigation.json +++ b/chrome/common/extensions/api/web_navigation.json @@ -149,7 +149,7 @@ "url": {"type": "string"}, "processId": {"type": "integer", "description": "The ID of the process runs the renderer for this tab."}, "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."}, - "transitionType": {"type": "string", "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], "description": "Cause of the navigation. The same transition types as defined in the history API are used."}, + "transitionType": {"type": "string", "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], "description": "Cause of the navigation. The same transition types as defined in the history API are used. These are the same transition types as defined in the <a href=\"history.html#transition_types\">history API</a> except with <code>\"start_page\"</code> in place of <code>\"auto_toplevel\"</code> (for backwards compatibility)."}, "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"type": "string", "enum": ["client_redirect", "server_redirect", "forward_back", "from_address_bar"]}}, "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."} } @@ -283,7 +283,7 @@ "url": {"type": "string"}, "processId": {"type": "integer", "description": "The ID of the process runs the renderer for this tab."}, "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."}, - "transitionType": {"type": "string", "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], "description": "Cause of the navigation. The same transition types as defined in the history API are used."}, + "transitionType": {"type": "string", "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], "description": "Cause of the navigation. The same transition types as defined in the history API are used. These are the same transition types as defined in the <a href=\"history.html#transition_types\">history API</a> except with <code>\"start_page\"</code> in place of <code>\"auto_toplevel\"</code> (for backwards compatibility)."}, "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"type": "string", "enum": ["client_redirect", "server_redirect", "forward_back", "from_address_bar"]}}, "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."} } @@ -327,7 +327,7 @@ "url": {"type": "string"}, "processId": {"type": "integer", "description": "The ID of the process runs the renderer for this tab."}, "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."}, - "transitionType": {"type": "string", "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], "description": "Cause of the navigation. The same transition types as defined in the history API are used."}, + "transitionType": {"type": "string", "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], "description": "Cause of the navigation. The same transition types as defined in the history API are used. These are the same transition types as defined in the <a href=\"history.html#transition_types\">history API</a> except with <code>\"start_page\"</code> in place of <code>\"auto_toplevel\"</code> (for backwards compatibility)."}, "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"type": "string", "enum": ["client_redirect", "server_redirect", "forward_back", "from_address_bar"]}}, "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."} } |