diff options
author | cduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-07 01:16:20 +0000 |
---|---|---|
committer | cduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-07 01:16:20 +0000 |
commit | 6f51decb5cbc32b38ab69406de9dd13998d45b99 (patch) | |
tree | fe53605c7c99b4f52d03a47fad5a1bf8d5180927 /chrome/common/extensions | |
parent | 6087e7b45fe22041784f66d7d595c92334e2cfda (diff) | |
download | chromium_src-6f51decb5cbc32b38ab69406de9dd13998d45b99.zip chromium_src-6f51decb5cbc32b38ab69406de9dd13998d45b99.tar.gz chromium_src-6f51decb5cbc32b38ab69406de9dd13998d45b99.tar.bz2 |
Content changes for https://codereview.chromium.org/11411370/
All <a> links to API pages have been replaced with $ref
links. A presubmit check has been added to make sure no
old-style links sneak in.
This just has the content changes. Server changes are here:
https://codereview.chromium.org/11411370/
BUG=162942
Review URL: https://codereview.chromium.org/11442016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171668 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions')
48 files changed, 337 insertions, 314 deletions
diff --git a/chrome/common/extensions/PRESUBMIT.py b/chrome/common/extensions/PRESUBMIT.py index d08f9b4..13e8556 100644 --- a/chrome/common/extensions/PRESUBMIT.py +++ b/chrome/common/extensions/PRESUBMIT.py @@ -25,6 +25,10 @@ LOCAL_PUBLIC_TEMPLATES_PATH = os.path.join('docs', 'templates', 'public') +def _ReadFile(filename): + with open(filename) as f: + return f.read() + def _ListFilesInPublic(): all_files = [] for path, dirs, files in os.walk(LOCAL_PUBLIC_TEMPLATES_PATH): @@ -104,6 +108,23 @@ def _CheckVersions(input_api, output_api, results): results.append(output_api.PresubmitPromptWarning( '_VERSION of %s needs to be incremented.' % affected_file)) +def _CheckLinks(input_api, output_api, results): + regex = re.compile( + r'<a(.*?)href=(.*?)#(property|type|method|event)-(.*?)>(.*?)</a>', + flags=re.DOTALL) + for affected_file in input_api.AffectedFiles(): + name = affected_file.LocalPath() + if (fnmatch.fnmatch(name, '%s*' % PUBLIC_TEMPLATES_PATH) or + fnmatch.fnmatch(name, '%s*' % INTROS_PATH) or + fnmatch.fnmatch(name, '%s*' % ARTICLES_PATH) or + fnmatch.fnmatch(name, '%s*' % API_PATH)): + contents = _ReadFile(affected_file.AbsoluteLocalPath()) + if re.search(regex, contents): + results.append(output_api.PresubmitPromptWarning( + 'File %s may have an old-style <a> link to an API page. Please run ' + 'docs/server2/link_converter.py to convert the link[s], or convert ' + 'them manually.' % name)) + def _CheckChange(input_api, output_api): results = [ output_api.PresubmitError('File %s needs an id for each heading.' % name) @@ -121,6 +142,7 @@ def _CheckChange(input_api, output_api): except input_api.subprocess.CalledProcessError: results.append(output_api.PresubmitError('IntegrationTest failed!')) _CheckVersions(input_api, output_api, results) + _CheckLinks(input_api, output_api, results) return results def CheckChangeOnUpload(input_api, output_api): diff --git a/chrome/common/extensions/api/app_window.idl b/chrome/common/extensions/api/app_window.idl index 739454b..40b0c5e 100644 --- a/chrome/common/extensions/api/app_window.idl +++ b/chrome/common/extensions/api/app_window.idl @@ -168,7 +168,7 @@ namespace app.window { optional CreateWindowOptions options, optional CreateWindowCallback callback); - // Returns an <a href="#type-AppWindow">AppWindow</a> object for the + // Returns an $ref:AppWindow object for the // current script context (ie JavaScript 'window' object). This can also be // called on a handle to a script context for another page, for example: // otherWindow.chrome.app.window.current(). diff --git a/chrome/common/extensions/api/content_settings.json b/chrome/common/extensions/api/content_settings.json index 2d6e803..3c04bac 100644 --- a/chrome/common/extensions/api/content_settings.json +++ b/chrome/common/extensions/api/content_settings.json @@ -20,7 +20,7 @@ "description": "A human readable description of the resource." } }, - "description": "The only content type using resource identifiers is <a href=\"contentSettings.html#property-plugins\"><var>plugins</var></a>. For more information, see <a href=\"contentSettings.html#resource-identifiers\">Resource Identifiers</a>." + "description": "The only content type using resource identifiers is $ref:contentSettings.plugins. For more information, see <a href=\"contentSettings.html#resource-identifiers\">Resource Identifiers</a>." }, { "id": "ContentSetting", diff --git a/chrome/common/extensions/api/debugger.json b/chrome/common/extensions/api/debugger.json index 2ad4135..02c1642 100644 --- a/chrome/common/extensions/api/debugger.json +++ b/chrome/common/extensions/api/debugger.json @@ -36,7 +36,7 @@ "name": "callback", "optional": true, "parameters": [], - "description": "Called once the attach operation succeeds or fails. Callback receives no arguments. If the attach fails, <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will be set to the error message." + "description": "Called once the attach operation succeeds or fails. Callback receives no arguments. If the attach fails, $ref:runtime.lastError will be set to the error message." } ] }, @@ -55,7 +55,7 @@ "name": "callback", "optional": true, "parameters": [], - "description": "Called once the detach operation succeeds or fails. Callback receives no arguments. If the detach fails, <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will be set to the error message." + "description": "Called once the detach operation succeeds or fails. Callback receives no arguments. If the detach fails, $ref:runtime.lastError will be set to the error message." } ] }, @@ -94,7 +94,7 @@ "description": "JSON object with the response. Structure of the response varies depending on the method and is defined by the remote debugging protocol." } ], - "description": "Response body. If an error occurs while posting the message, the callback will be called with no arguments and <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will be set to the error message." + "description": "Response body. If an error occurs while posting the message, the callback will be called with no arguments and $ref:runtime.lastError will be set to the error message." } ] } diff --git a/chrome/common/extensions/api/devtools/experimental_audits.json b/chrome/common/extensions/api/devtools/experimental_audits.json index 89003ac..31cdc82 100644 --- a/chrome/common/extensions/api/devtools/experimental_audits.json +++ b/chrome/common/extensions/api/devtools/experimental_audits.json @@ -40,7 +40,7 @@ "id": "FormattedValue", "type": "object", "additionalProperties": { "type": "any" }, - "description": "A value returned from one of the formatters (a URL, code snippet etc), to be passed to <code>createResult()</code> or <code>addChild()</code>. See <a href=\"#method-AuditResults-createSnippet\"><code>createSnippet()</code></a> and <a href=\"#method-AuditResults-createURL\"><code>createURL()</code></a>." + "description": "A value returned from one of the formatters (a URL, code snippet etc), to be passed to <code>createResult()</code> or <code>addChild()</code>. See $ref:AuditResults.createSnippet and $ref:AuditResults.createURL." }, { "id": "AuditResults", diff --git a/chrome/common/extensions/api/devtools/panels.json b/chrome/common/extensions/api/devtools/panels.json index 77f30fa..5304c66 100644 --- a/chrome/common/extensions/api/devtools/panels.json +++ b/chrome/common/extensions/api/devtools/panels.json @@ -305,7 +305,7 @@ { "name": "resource", "$ref": "devtools.inspectedWindow.Resource", - "description": "A <a href=\"devtools.inspectedWindow.html#type-Resource\">Resource</a> object for the resource that was clicked." + "description": "A $ref:devtools.inspectedWindow.Resource object for the resource that was clicked." } ] } diff --git a/chrome/common/extensions/api/downloads.idl b/chrome/common/extensions/api/downloads.idl index 0d750e4..4782e45 100644 --- a/chrome/common/extensions/api/downloads.idl +++ b/chrome/common/extensions/api/downloads.idl @@ -122,58 +122,58 @@ namespace downloads { [inline_doc] dictionary DownloadQuery { // This space-separated string of search terms that may be grouped using - // quotation marks limits results to <a - // href='#type-DownloadItem'>DownloadItems</a> whose <code>filename</code> + // quotation marks limits results to + // $ref:DownloadItem whose <code>filename</code> // or <code>url</code> contain all of the search terms that do not begin with a dash '-' // and none of the search terms that do begin with a dash. DOMString? query; - // Limits results to <a href='#type-DownloadItem'>DownloadItems</a> that + // Limits results to $ref:DownloadItem that // started before the given ms since the epoch. long? startedBefore; - // Limits results to <a href='#type-DownloadItem'>DownloadItems</a> that + // Limits results to $ref:DownloadItem that // started after the given ms since the epoch. long? startedAfter; - // Limits results to <a href='#type-DownloadItem'>DownloadItems</a> that ended before the given ms since the + // Limits results to $ref:DownloadItem that ended before the given ms since the // epoch. long? endedBefore; - // Limits results to <a href='#type-DownloadItem'>DownloadItems</a> that ended after the given ms since the + // Limits results to $ref:DownloadItem that ended after the given ms since the // epoch. long? endedAfter; - // Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose + // Limits results to $ref:DownloadItem whose // <code>totalBytes</code> is greater than the given integer. long? totalBytesGreater; - // Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose + // Limits results to $ref:DownloadItem whose // <code>totalBytes</code> is less than the given integer. long? totalBytesLess; - // Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose + // Limits results to $ref:DownloadItem whose // <code>filename</code> matches the given regular expression. DOMString? filenameRegex; - // Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose + // Limits results to $ref:DownloadItem whose // <code>url</code> matches the given regular expression. DOMString? urlRegex; // Setting this integer limits the number of results. Otherwise, all - // matching <a href='#type-DownloadItem'>DownloadItems</a> will be returned. + // matching $ref:DownloadItem will be returned. long? limit; - // Setting this string to a <a href='#type-DownloadItem'>DownloadItem</a> - // property sorts the <a href='#type-DownloadItem'>DownloadItems</a> prior + // Setting this string to a $ref:DownloadItem + // property sorts the $ref:DownloadItem prior // to applying the above filters. For example, setting - // <code>orderBy='startTime'</code> sorts the <a - // href='#type-DownloadItem'>DownloadItems</a> by their start time in + // <code>orderBy='startTime'</code> sorts the + // $ref:DownloadItem by their start time in // ascending order. To specify descending order, prefix <code>orderBy</code> // with a hyphen: '-startTime'. DOMString? orderBy; - // The <code>id</code> of the <a href="#type-DownloadItem">DownloadItem</a> + // The <code>id</code> of the $ref:DownloadItem // that changed. long? id; @@ -298,37 +298,37 @@ namespace downloads { // <code>filename</code> and <code>saveAs</code> are specified, then the // Save As dialog will be displayed, pre-populated with the specified // <code>filename</code>. If the download started successfully, - // <code>callback</code> will be called with the new <a href='#type-DownloadItem'>DownloadItem</a>'s + // <code>callback</code> will be called with the new $ref:DownloadItem's // <code>downloadId</code>. If there was an error starting the download, // then <code>callback</code> will be called with - // <code>downloadId=undefined</code> and <a - // href='extension.html#property-lastError'>chrome.extension.lastError</a> + // <code>downloadId=undefined</code> and + // $ref:runtime.lastError // will contain a descriptive string. The error strings are not guaranteed // to remain backwards compatible between releases. You must not parse it. // |options|: What to download and how. - // |callback|: Called with the id of the new <a href='#type-DownloadItem'>DownloadItem</a>. + // |callback|: Called with the id of the new $ref:DownloadItem. static void download(DownloadOptions options, optional DownloadCallback callback); - // Find <a href='#type-DownloadItem'>DownloadItems</a>. Set - // <code>query</code> to the empty object to get all <a - // href='#type-DownloadItem'>DownloadItems</a>. To get a specific <a - // href='#type-DownloadItem'>DownloadItem</a>, set only the <code>id</code> + // Find $ref:DownloadItem. Set + // <code>query</code> to the empty object to get all + // $ref:DownloadItem. To get a specific + // $ref:DownloadItem, set only the <code>id</code> // field. static void search(DownloadQuery query, SearchCallback callback); // Pause the download. If the request was successful the download is in a - // paused state. Otherwise <a - // href='extension.html#property-lastError'>chrome.extension.lastError</a> + // paused state. Otherwise + // $ref:runtime.lastError // contains an error message. The request will fail if the download is not // active. // |downloadId|: The id of the download to pause. - // |callback|: Called when the pause request is completed. + // |callback|: Called when the pause request is completed. static void pause(long downloadId, optional NullCallback callback); // Resume a paused download. If the request was successful the download is - // in progress and unpaused. Otherwise <a - // href='extension.html#property-lastError'>chrome.extension.lastError</a> + // in progress and unpaused. Otherwise + // $ref:runtime.lastError // contains an error message. The request will fail if the download is not // active. // |downloadId|: The id of the download to resume. @@ -342,15 +342,15 @@ namespace downloads { static void cancel(long downloadId, optional NullCallback callback); // Retrieve an icon for the specified download. For new downloads, file - // icons are available after the <a href='#event-onCreated'>onCreated</a> + // icons are available after the $ref:onCreated // event has been received. The image returned by this function while a // download is in progress may be different from the image returned after // the download is complete. Icon retrieval is done by querying the // underlying operating system or toolkit depending on the platform. The // icon that is returned will therefore depend on a number of factors // including state of the download, platform, registered file types and - // visual theme. If a file icon cannot be determined, <a - // href='extension.html#property-lastError'>chrome.extension.lastError</a> + // visual theme. If a file icon cannot be determined, + // $ref:runtime.lastError // will contain an error message. // |downloadId|: The identifier for the download. // |callback|: A URL to an image that represents the download. @@ -358,7 +358,7 @@ namespace downloads { optional GetFileIconOptions options, GetFileIconCallback callback); - // Erase matching <a href='#type-DownloadItem'>DownloadItems</a> from + // Erase matching $ref:DownloadItem from // history [nodoc] static void erase(DownloadQuery query, optional EraseCallback callback); @@ -382,16 +382,16 @@ namespace downloads { }; interface Events { - // This event fires with the <a href='#type-DownloadItem'>DownloadItem</a> + // This event fires with the $ref:DownloadItem // object when a download begins. static void onCreated(DownloadItem downloadItem); // Fires with the <code>downloadId</code> when a download is erased from // history. - // |downloadId|: The <code>id</code> of the <a href='#type-DownloadItem'>DownloadItem</a> that was erased. + // |downloadId|: The <code>id</code> of the $ref:DownloadItem that was erased. static void onErased(long downloadId); - // When any of a <a href='#type-DownloadItem'>DownloadItem</a>'s properties + // When any of a $ref:DownloadItem's properties // except <code>bytesReceived</code> changes, this event fires with the // <code>downloadId</code> and an object containing the properties that changed. static void onChanged(DownloadDelta downloadDelta); diff --git a/chrome/common/extensions/api/experimental_app.json b/chrome/common/extensions/api/experimental_app.json index fbcc9dd..5ac8e01 100644 --- a/chrome/common/extensions/api/experimental_app.json +++ b/chrome/common/extensions/api/experimental_app.json @@ -48,7 +48,7 @@ "name": "callback", "optional": true, "parameters": [], - "description": "A callback when the function is complete. Any errors will be reported in <a href='extension.html#property-lastError'>chrome.extension.lastError</a>." + "description": "A callback when the function is complete. Any errors will be reported in $ref:runtime.lastError." } ] }, @@ -74,7 +74,7 @@ "type": "function", "name": "callback", "optional": true, - "description": "A callback when the function is complete. Any errors will be reported in <a href='extension.html#property-lastError'>chrome.extension.lastError</a>.", + "description": "A callback when the function is complete. Any errors will be reported in $ref:runtime.lastError.", "parameters": [] } ] diff --git a/chrome/common/extensions/api/extension.json b/chrome/common/extensions/api/extension.json index f10a52b..00cac17 100644 --- a/chrome/common/extensions/api/extension.json +++ b/chrome/common/extensions/api/extension.json @@ -57,7 +57,7 @@ "name": "connect", "type": "function", "unprivileged": true, - "description": "Attempts to connect to other listeners within the extension (such as the extension's background page). This is primarily useful for content scripts connecting to their extension processes. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via <a href='tabs.html#method-connect'><code>chrome.tabs.connect()</code></a>.", + "description": "Attempts to connect to other listeners within the extension (such as the extension's background page). This is primarily useful for content scripts connecting to their extension processes. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via $ref:tabs.connect.", "parameters": [ {"type": "string", "name": "extensionId", "optional": true, "description": "The extension ID of the extension you want to connect to. If omitted, default is your own extension."}, { @@ -71,7 +71,7 @@ ], "returns": { "$ref": "Port", - "description": "Port through which messages can be sent and received with the extension. The port's <a href='extension.html#type-Port'>onDisconnect</a> event is fired if extension does not exist. " + "description": "Port through which messages can be sent and received with the extension. The port's $ref:extension.Port event is fired if extension does not exist. " } }, { @@ -117,7 +117,7 @@ { "name": "response", "type": "any", - "description": "The JSON response object sent by the handler of the request. If an error occurs while connecting to the extension, the callback will be called with no arguments and <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will be set to the error message." + "description": "The JSON response object sent by the handler of the request. If an error occurs while connecting to the extension, the callback will be called with no arguments and $ref:runtime.lastError will be set to the error message." } ] } @@ -128,7 +128,7 @@ "type": "function", "allowAmbiguousOptionalArguments": true, "unprivileged": true, - "description": "Sends a single message to other listeners within the extension. Similar to chrome.extension.connect, but only sends a single message with an optional response. The <a href='extension.html#event-onMessage'>chrome.extension.onMessage</a> event is fired in each extension page of the extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use <a href='tabs.html#method-sendMessage'><code>chrome.tabs.sendMessage()</code></a>.", + "description": "Sends a single message to other listeners within the extension. Similar to chrome.extension.connect, but only sends a single message with an optional response. The $ref:extension.onMessage event is fired in each extension page of the extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use $ref:tabs.sendMessage.", "parameters": [ {"type": "string", "name": "extensionId", "optional": true, "description": "The extension ID of the extension you want to connect to. If omitted, default is your own extension."}, { "type": "any", "name": "message" }, @@ -140,7 +140,7 @@ { "name": "response", "type": "any", - "description": "The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will be set to the error message." + "description": "The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and $ref:runtime.lastError will be set to the error message." } ] } diff --git a/chrome/common/extensions/api/permissions.json b/chrome/common/extensions/api/permissions.json index 4f4b362..d4a8689 100644 --- a/chrome/common/extensions/api/permissions.json +++ b/chrome/common/extensions/api/permissions.json @@ -95,7 +95,7 @@ { "name": "request", "type": "function", - "description": "Requests access to the specified permissions. These permissions must be defined in the optional_permissions field of the manifest. If there are any problems requesting the permissions, <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will be set.", + "description": "Requests access to the specified permissions. These permissions must be defined in the optional_permissions field of the manifest. If there are any problems requesting the permissions, $ref:runtime.lastError will be set.", "parameters": [ { "name": "permissions", @@ -118,7 +118,7 @@ { "name": "remove", "type": "function", - "description": "Removes access to the specified permissions. If there are any problems removing the permissions, <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will be set.", + "description": "Removes access to the specified permissions. If there are any problems removing the permissions, $ref:runtime.lastError will be set.", "parameters": [ { "name": "permissions", diff --git a/chrome/common/extensions/api/storage.json b/chrome/common/extensions/api/storage.json index 8995566..3e02335 100644 --- a/chrome/common/extensions/api/storage.json +++ b/chrome/common/extensions/api/storage.json @@ -158,7 +158,7 @@ "name": "changes", "type": "object", "additionalProperties": { "$ref": "StorageChange" }, - "description": "Object mapping each key that changed to its corresponding <a href='#type-StorageChange'>StorageChange</a> for that item." + "description": "Object mapping each key that changed to its corresponding $ref:StorageChange for that item." }, { "name": "areaName", diff --git a/chrome/common/extensions/api/tabs.json b/chrome/common/extensions/api/tabs.json index 8f03c7e..16dd035 100644 --- a/chrome/common/extensions/api/tabs.json +++ b/chrome/common/extensions/api/tabs.json @@ -85,7 +85,7 @@ "name": "connect", "nocompile": true, "type": "function", - "description": "Connects to the content script(s) in the specified tab. The <a href='extension.html#event-onConnect'>chrome.extension.onConnect</a> event is fired in each content script running in the specified tab for the current extension. For more details, see <a href='content_scripts.html#messaging'>Content Script Messaging</a>.", + "description": "Connects to the content script(s) in the specified tab. The $ref:extension.onConnect event is fired in each content script running in the specified tab for the current extension. For more details, see <a href='content_scripts.html#messaging'>Content Script Messaging</a>.", "parameters": [ { "type": "integer", @@ -103,7 +103,7 @@ ], "returns": { "$ref": "extension.Port", - "description": "A port that can be used to communicate with the content scripts running in the specified tab. The port's <a href='extension.html#type-Port'>onDisconnect</a> event is fired if the tab closes or does not exist. " + "description": "A port that can be used to communicate with the content scripts running in the specified tab. The port's $ref:extension.Port event is fired if the tab closes or does not exist. " } }, { @@ -130,7 +130,7 @@ { "name": "response", "type": "any", - "description": "The JSON response object sent by the handler of the request. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will be set to the error message." + "description": "The JSON response object sent by the handler of the request. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and $ref:runtime.lastError will be set to the error message." } ] } @@ -140,7 +140,7 @@ "name": "sendMessage", "nocompile": true, "type": "function", - "description": "Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The <a href='extension.html#event-onMessage'>chrome.extension.onMessage</a> event is fired in each content script running in the specified tab for the current extension.", + "description": "Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The $ref:extension.onMessage event is fired in each content script running in the specified tab for the current extension.", "parameters": [ { "type": "integer", @@ -159,7 +159,7 @@ { "name": "response", "type": "any", - "description": "The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will be set to the error message." + "description": "The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and $ref:runtime.lastError will be set to the error message." } ] } @@ -353,7 +353,7 @@ "type": "integer", "optional": true, "minimum": -2, - "description": "The ID of the parent window, or <a href='windows.html#property-WINDOW_ID_CURRENT'>chrome.windows.WINDOW_ID_CURRENT</a> for the <a href='windows.html#current-window'>current window</a>." + "description": "The ID of the parent window, or $ref:windows.WINDOW_ID_CURRENT for the <a href='windows.html#current-window'>current window</a>." }, "windowType": { "type": "string", @@ -735,7 +735,7 @@ { "name": "onMoved", "type": "function", - "description": "Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see <a href='#event-onDetached'>onDetached</a>.", + "description": "Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see $ref:onDetached.", "parameters": [ {"type": "integer", "name": "tabId", "minimum": 0}, { diff --git a/chrome/common/extensions/docs/server2/link_converter.py b/chrome/common/extensions/docs/server2/link_converter.py index 2b40bc8..ba6cfe3 100755 --- a/chrome/common/extensions/docs/server2/link_converter.py +++ b/chrome/common/extensions/docs/server2/link_converter.py @@ -3,6 +3,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# This script converts old-style <a> links to API docs to the new $ref links. +# See reference_resolver.py for more info on the format of $ref links. + +import optparse import os import sys import re @@ -19,10 +23,11 @@ def _WriteFile(filename, contents): f.write(contents) def _Replace(matches, filename): + title = matches.group(3) if matches.group(2).count('#') != 1: return '<a%shref=%s>%s</a>' % (matches.group(1), matches.group(2), - matches.group(3)) + title) clean = (matches.group(2).replace('\\', '') .replace("'", '') .replace('"', '') @@ -36,7 +41,7 @@ def _Replace(matches, filename): not link.startswith('event-')): return '<a%shref=%s>%s</a>' % (matches.group(1), matches.group(2), - matches.group(3)) + title) link = re.sub('^(property|type|method|event)-', '', link).replace('-', '.') page = page.replace('.html', '.').replace('_', '.') @@ -44,17 +49,37 @@ def _Replace(matches, filename): padding = '' else: padding = matches.group(1) - return '%s$ref:%s%s' % (padding, page, link) + if link in title: + return '%s$ref:%s%s' % (padding, page, link) + else: + return '%s$ref:[%s%s %s]' % (padding, page, link, title) + +def _ConvertFile(filename): + regex = re.compile(r'<a(.*?)href=(.*?)>(.*?)</a>', flags=re.DOTALL) + contents = _ReadFile(filename) + contents = re.sub(regex, + lambda m: _Replace(m, filename), + contents) + contents = contents.replace('$ref:extension.lastError', + '$ref:runtime.lastError') + _WriteFile(filename, contents) if __name__ == '__main__': - for root, dirs, files in os.walk(sys.argv[1]): - for name in files: - filename = os.path.join(root, name) - contents = _ReadFile(filename) - contents = re.sub(r'<a(.*?)href=(.*?)>(.*?)</a>', - lambda m: _Replace(m, filename), - contents, - flags=re.DOTALL) - contents = contents.replace('$ref:extension.lastError', - '$ref:runtime.lastError') - _WriteFile(filename, contents) + parser = optparse.OptionParser( + description='Converts <a> links to $ref links.', + usage='usage: %prog [option] <directory>') + parser.add_option('-f', '--file', default='', + help='Convert links in single file.') + regex = re.compile(r'<a(.*?)href=(.*?)>(.*?)</a>', flags=re.DOTALL) + + opts, argv = parser.parse_args() + + if opts.file: + _ConvertFile(opts.file) + else: + if len(argv) != 1: + parser.print_usage() + exit(0) + for root, dirs, files in os.walk(argv[0]): + for name in files: + _ConvertFile(os.path.join(root, name)) diff --git a/chrome/common/extensions/docs/templates/articles/activeTab.html b/chrome/common/extensions/docs/templates/articles/activeTab.html index fc07160..d6bec53 100644 --- a/chrome/common/extensions/docs/templates/articles/activeTab.html +++ b/chrome/common/extensions/docs/templates/articles/activeTab.html @@ -89,8 +89,8 @@ In contrast, an extension with the <code>activeTab</code> permission only obtain <p> While the <code>activeTab</code> permission is enabled for a tab, an extension can: <ul> - <li>Call <code><a href="tabs.html#method-executeScript">executeScript()</a></code> or <code><a href="tabs.html#method-insertCSS">insertCSS()</a></code> on that tab. - <li>Get the URL, title, and favicon for that tab via an API that returns a <code><a href="tabs.html#type-Tab">Tab</a></code> object (essentially, <code>activeTab</code> grants the <code><a href="tabs.html#manifest">tabs</a></code> permission temporarily). + <li>Call <code>$ref:tabs.executeScript</code> or <code>$ref:tabs.insertCSS</code> on that tab. + <li>Get the URL, title, and favicon for that tab via an API that returns a <code>$ref:tabs.Tab</code> object (essentially, <code>activeTab</code> grants the <code><a href="tabs.html#manifest">tabs</a></code> permission temporarily). </ul> </p> diff --git a/chrome/common/extensions/docs/templates/articles/app_lifecycle.html b/chrome/common/extensions/docs/templates/articles/app_lifecycle.html index 9c1112a..5f0a80f 100644 --- a/chrome/common/extensions/docs/templates/articles/app_lifecycle.html +++ b/chrome/common/extensions/docs/templates/articles/app_lifecycle.html @@ -197,7 +197,7 @@ you should store user settings so that if users reinstall your app, their information is still available for reuse. Using the Storage API -(<a href="storage.html#property-sync">chrome.storage.sync</a>), +($ref:storage.sync), user data can be automatically synced with Chrome sync. </p> diff --git a/chrome/common/extensions/docs/templates/articles/background_pages.html b/chrome/common/extensions/docs/templates/articles/background_pages.html index 701d4d1..c688a91 100644 --- a/chrome/common/extensions/docs/templates/articles/background_pages.html +++ b/chrome/common/extensions/docs/templates/articles/background_pages.html @@ -88,11 +88,11 @@ you might also want to specify the <p> You can communicate between your various pages using direct script calls, similar to how frames can communicate. -The <a href="extension.html#method-getViews"><code>chrome.extension.getViews()</code></a> method +The $ref:extension.getViews method returns a list of window objects for every active page belonging to your extension, and the -<a href="extension.html#method-getBackgroundPage"><code>chrome.extension.getBackgroundPage()</code></a> method +$ref:extension.getBackgroundPage method returns the background page. </p> @@ -112,7 +112,7 @@ The extension in this example has a background page and multiple pages created (with -<a href="tabs.html#method-create"><code>chrome.tabs.create()</code></a>) +$ref:tabs.create) from a file named <code>image.html</code>. </p> diff --git a/chrome/common/extensions/docs/templates/articles/content_scripts.html b/chrome/common/extensions/docs/templates/articles/content_scripts.html index 5773e60..ec10423 100644 --- a/chrome/common/extensions/docs/templates/articles/content_scripts.html +++ b/chrome/common/extensions/docs/templates/articles/content_scripts.html @@ -252,9 +252,9 @@ using the manifest file's <p> Once you have permissions set up, you can inject JavaScript into a page by calling -<a href="tabs.html#method-executeScript"><code>executeScript()</code></a>. +$ref:tabs.executeScript. To inject CSS, use -<a href="tabs.html#method-insertCSS"><code>insertCSS()</code></a>. +$ref:tabs.insertCSS. </p> <p> diff --git a/chrome/common/extensions/docs/templates/articles/event_pages.html b/chrome/common/extensions/docs/templates/articles/event_pages.html index f4bc54c..f5878ec 100644 --- a/chrome/common/extensions/docs/templates/articles/event_pages.html +++ b/chrome/common/extensions/docs/templates/articles/event_pages.html @@ -55,7 +55,7 @@ that will cause the event page to load: <li>A content script or other extension <a href="messaging.html">sends a message.</a> <li>Another view in the extension (for example, a popup) calls -<code><a href="runtime.html#method-getBackgroundPage">chrome.runtime.getBackgroundPage()</a></code>. +<code>$ref:runtime.getBackgroundPage</code>. </ul> <p> @@ -77,7 +77,7 @@ extension appears in the list of processes. <p> Once the event page has been idle a short time (a few seconds), the -<code><a href="runtime.html#event-onSuspend">chrome.runtime.onSuspend</a></code> +<code>$ref:runtime.onSuspend</code> event is dispatched. The event page has a few more seconds to handle this event before it is forcibly unloaded. Note that once the event is dispatched, new activity will not keep the event page open. @@ -97,7 +97,7 @@ load its event page for that event. Because the listeners themselves only exist in the context of the event page, you must use <code>addListener</code> each time the event page loads; only doing so at -<code><a href="runtime.html#event-onInstalled">chrome.runtime.onInstalled</a></code> +<code>$ref:runtime.onInstalled</code> by itself is insufficient. </p> @@ -122,12 +122,8 @@ Follow this checklist to convert your extension's <li>If you need to do some initialization when your extension is installed or upgraded, listen to the - <code><a href="runtime.html#event-onInstalled">chrome.runtime.onInstalled</a></code> - event. If you need to do some initialization each time the browser starts, - listen to the - <code><a href="runtime.html#event-onBrowserStartup">chrome.runtime.onBrowserStartup</a></code> - event; however, you should (in almost all cases) prefer - the <code>chrome.runtime.onInstalled</code> event. + <code>$ref:runtime.onInstalled</code> + event. <li>If you need to keep runtime state in memory throughout a browser session, use the <a href="storage.html">storage API</a> or @@ -136,15 +132,15 @@ Follow this checklist to convert your extension's <li>Use <a href="events.html#filtered">event filters</a> to restrict your event notifications to the cases you care about. For example, if - you listen to the <code><a href="tabs.html#event-onUpdated">tabs.onUpdated</a></code> + you listen to the <code>$ref:tabs.onUpdated</code> event, try using the - <code><a href="webNavigation.html#event-onCompleted">webNavigation.onComplete</a></code> + <code>$ref:webNavigation.onCompleted</code> event with filters instead (the tabs API does not support filters). That way, your event page will only be loaded for events that interest you. <li>Listen to the - <code><a href="runtime.html#event-onSuspend">chrome.runtime.onSuspend</a></code> + <code>$ref:runtime.onSuspend</code> event if you need to do last second cleanup before your event page is shut down. However, we recommend persisting periodically instead. That way if your extension crashes without receiving @@ -156,9 +152,9 @@ Follow this checklist to convert your extension's be honored if the event page shuts down. <li>If your extension uses, - <code><a href="extension.html#method-getBackgroundPage">chrome.extension.getBackgroundPage()</a></code>, + <code>$ref:extension.getBackgroundPage</code>, switch to - <code><a href="runtime.html#method-getBackgroundPage">chrome.runtime.getBackgroundPage()</a></code> + <code>$ref:runtime.getBackgroundPage</code> instead. The newer method is asynchronous so that it can start the event page if necessary before returning it. @@ -168,10 +164,10 @@ Follow this checklist to convert your extension's <li>If you're using the <a href="contextMenus.html">context menus</a> API, pass a string <code>id</code> parameter to - <code><a href="contextMenus.html#method-create">chrome.contextMenus.create</a></code>, + <code>$ref:contextMenus.create</code>, and use the - <code><a href="contextMenus.html#event-onClicked">chrome.contextMenus.onClicked</a></code> + <code>$ref:contextMenus.onClicked</code> callback instead of an <code>onclick</code> parameter to - <code><a href="contextMenus.html#method-create">chrome.contextMenus.create</a></code>. + <code>$ref:contextMenus.create</code>. </ol> </p> diff --git a/chrome/common/extensions/docs/templates/articles/faq.html b/chrome/common/extensions/docs/templates/articles/faq.html index 40a0d14..b129c44 100644 --- a/chrome/common/extensions/docs/templates/articles/faq.html +++ b/chrome/common/extensions/docs/templates/articles/faq.html @@ -276,7 +276,7 @@ cros,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####</pre> installed/uninstalled?</h3> <p> You can listen to the - <a href="runtime.html#event-onInstalled">runtime.onInstalled</a> + $ref:runtime.onInstalled event to be notified when your extension is installed or updated, or when Chrome itself is updated. There is no corresponding event for when your extension is uninstalled. @@ -353,7 +353,7 @@ cros,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####</pre> the first time?</h3> <p> You can listen to the - <a href="runtime.html#event-onInstalled">runtime.onInstalled</a> + $ref:runtime.onInstalled event. See <a href="#faq-lifecycle-events">this FAQ entry</a>. </p> diff --git a/chrome/common/extensions/docs/templates/articles/i18n-messages.html b/chrome/common/extensions/docs/templates/articles/i18n-messages.html index aad9927..66bc961 100644 --- a/chrome/common/extensions/docs/templates/articles/i18n-messages.html +++ b/chrome/common/extensions/docs/templates/articles/i18n-messages.html @@ -182,7 +182,7 @@ For example, use the following code to specify the message Although placeholders such as <code>$USER$</code> are the preferred way of referring to <em>substitution strings</em> (strings specified using the <em>substitutions</em> parameter of -<a href="i18n.html#method-getMessage"><code>getMessage()</code></a>) +$ref:i18n.getMessage) you can also refer to substitution strings directly within the message. For example, the following message @@ -266,7 +266,7 @@ as a <a href="#name">message name</a>. The "content" item's value is a string that can refer to substitution strings, which are specified using the -<a href="i18n.html#method-getMessage"><code>getMessage()</code></a> method's +$ref:i18n.getMessage method's <em>substitutions</em> parameter. The value of a "content" item is typically something like "Example.com" or "$1". diff --git a/chrome/common/extensions/docs/templates/articles/manifest.html b/chrome/common/extensions/docs/templates/articles/manifest.html index 7228160..21d756c 100644 --- a/chrome/common/extensions/docs/templates/articles/manifest.html +++ b/chrome/common/extensions/docs/templates/articles/manifest.html @@ -278,7 +278,7 @@ it is loaded during development. use this value. Instead, write your code so that the key value doesn't matter by using <a href="overview.html#relative-urls">relative paths</a> -and <a href="extension.html#method-getURL">chrome.extension.getURL()</a>. +and $ref:extension.getURL. </p> <p> @@ -550,9 +550,7 @@ etc.) as follows: <p> These resources would then be available in a webpage via the URL <code>chrome-extension://[PACKAGE ID]/[PATH]</code>, which can be generated with -the <a href="extension.html#method-getURL"> - <code>chrome.extension.getURL</code> -</a> method. Whitelisted resources are served with appropriate +the $ref:extension.getURL method. Whitelisted resources are served with appropriate <a href="http://www.w3.org/TR/cors/">CORS</a> headers, so they're available via mechanisms like XHR. </p> diff --git a/chrome/common/extensions/docs/templates/articles/manifestVersion.html b/chrome/common/extensions/docs/templates/articles/manifestVersion.html index a39ebb3..35fbe3a 100644 --- a/chrome/common/extensions/docs/templates/articles/manifestVersion.html +++ b/chrome/common/extensions/docs/templates/articles/manifestVersion.html @@ -133,9 +133,7 @@ The <code>icons</code> property of <code>browser_action</code> has been removed. Use <a href="browserAction.html#manifest"> the <code>default_icon</code> property - </a> or <a href="browserAction.html#method-setIcon"> - <code>chrome.browserAction.setIcon</code> - </a> instead. + </a> or $ref:browserAction.setIcon instead. </p> </li> <li> @@ -143,9 +141,7 @@ The <code>name</code> property of <code>browser_action</code> has been removed. Use <a href="browserAction.html#manifest"> the <code>default_title</code> property - </a> or <a href="browserAction.html#method-setTitle"> - <code>chrome.browserAction.setTitle</code> - </a> instead. + </a> or $ref:browserAction.setTitle instead. </p> </li> <li> @@ -153,9 +149,7 @@ The <code>popup</code> property of <code>browser_action</code> has been removed. Use <a href="browserAction.html#manifest"> the <code>default_popup</code> property - </a> or <a href="browserAction.html#method-setPopup"> - <code>chrome.browserAction.setPopup</code> - </a> instead. + </a> or $ref:browserAction.setPopup instead. </p> </li> <li> @@ -183,9 +177,7 @@ The <code>icons</code> property of <code>page_action</code> has been removed. Use <a href="pageAction.html#manifest"> the <code>default_icon</code> property - </a> or <a href="pageAction.html#method-setIcon"> - <code>chrome.pageAction.setIcon</code> - </a> instead. + </a> or $ref:pageAction.setIcon instead. </p> </li> <li> @@ -193,9 +185,7 @@ The <code>name</code> property of <code>page_action</code> has been removed. Use <a href="pageAction.html#manifest"> the <code>default_title</code> property - </a> or <a href="pageAction.html#method-setTitle"> - <code>chrome.pageAction.setTitle</code> - </a> instead. + </a> or $ref:pageAction.setTitle instead. </p> </li> <li> @@ -203,9 +193,7 @@ The <code>popup</code> property of <code>page_action</code> has been removed. Use <a href="pageAction.html#manifest"> the <code>default_popup</code> property - </a> or <a href="pageAction.html#method-setPopup"> - <code>chrome.pageAction.setPopup</code> - </a> instead. + </a> or $ref:pageAction.setPopup instead. </p> </li> <li> @@ -226,15 +214,13 @@ <p> <code>chrome.extension.getTabContentses</code> (!!!) and <code>chrome.extension.getExtensionTabs</code> are gone. Use - <a href="extension.html#method-getViews"> - <code>chrome.extension.getViews({ "type": "tab" })</code> - </a> instead. + $ref:extension.getViews instead. </p> </li> <li> <p> <code>Port.tab</code> is gone. Use - <a href="extension.html#type-Port"><code>Port.sender</code></a> + $ref:extension.Port instead. </p> </li> diff --git a/chrome/common/extensions/docs/templates/articles/messaging.html b/chrome/common/extensions/docs/templates/articles/messaging.html index fa1f32d..65a12e4 100644 --- a/chrome/common/extensions/docs/templates/articles/messaging.html +++ b/chrome/common/extensions/docs/templates/articles/messaging.html @@ -27,9 +27,9 @@ section. <p> If you only need to send a single message to another part of your extension (and optionally get a response back), you should use the simplified -<a href="extension.html#method-sendMessage">chrome.extension.sendMessage()</a> +$ref:extension.sendMessage or -<a href="tabs.html#method-sendMessage">chrome.tabs.sendMessage()</a> +$ref:tabs.sendMessage methods. This lets you send a one-time JSON-serializable message from a content script to extension, or vice versa, respectively. An optional callback parameter allows you handle the response from the other side, if @@ -61,7 +61,7 @@ chrome.tabs.getSelected(null, function(tab) { <p> On the receiving end, you need to set up an -<a href="extension.html#event-onMessage">chrome.extension.onMessage</a> +$ref:extension.onMessage event listener to handle the message. This looks the same from a content script or extension page. <pre> @@ -87,9 +87,9 @@ response. All other responses to that event will be ignored. Sometimes it's useful to have a conversation that lasts longer than a single request and response. In this case, you can open a long-lived channel from your content script to an extension page, or vice versa, using -<a href="extension.html#method-connect">chrome.extension.connect()</a> +$ref:extension.connect or -<a href="tabs.html#method-connect">chrome.tabs.connect()</a> respectively. The +$ref:tabs.connect respectively. The channel can optionally have a name, allowing you to distinguish between different types of connections. @@ -102,7 +102,7 @@ shared state linking the several messages coming from the content script. <p> When establishing a connection, each end is given a -<a href="extension.html#type-Port">Port</a> +$ref:extension.Port object which is used for sending and receiving messages through that connection. @@ -126,16 +126,15 @@ port.onMessage.addListener(function(msg) { Sending a request from the extension to a content script looks very similar, except that you need to specify which tab to connect to. Simply replace the call to connect in the above example with -<a href="tabs.html#method-connect">chrome.tabs.connect(tabId, {name: -"knockknock"})</a>. +$ref:tabs.connect. <p> In order to handle incoming connections, you need to set up a -<a href="extension.html#event-onConnect">chrome.extension.onConnect</a> +$ref:extension.onConnect event listener. This looks the same from a content script or an extension page. When another part of your extension calls "connect()", this event is fired, along with the -<a href="extension.html#type-Port">Port</a> +$ref:extension.Port object you can use to send and receive messages through the connection. Here's what it looks like to respond to incoming connections: <pre> @@ -155,10 +154,10 @@ chrome.extension.onConnect.addListener(function(port) { <p> You may want to find out when a connection is closed, for example if you are maintaining separate state for each open port. For this you can listen to the -<a href="extension.html#type-Port">Port.onDisconnect</a> +$ref:extension.Port event. This event is fired either when the other side of the channel manually calls -<a href="extension.html#type-Port">Port.disconnect()</a>, or when the page +$ref:extension.Port, or when the page containing the port is unloaded (for example if the tab is navigated). onDisconnect is guaranteed to be fired only once for any given port. @@ -172,9 +171,9 @@ This lets you expose a public API that other extensions can take advantage of. <p> Listening for incoming requests and connections is similar to the internal case, except you use the -<a href="extension.html#event-onMessageExternal">chrome.extension.onMessageExternal</a> +$ref:extension.onMessageExternal or -<a href="extension.html#event-onConnectExternal">chrome.extension.onConnectExternal</a> +$ref:extension.onConnectExternal methods. Here's an example of each: <pre> // For simple requests: diff --git a/chrome/common/extensions/docs/templates/articles/notifications.html b/chrome/common/extensions/docs/templates/articles/notifications.html index 20e74c2..84161e9 100644 --- a/chrome/common/extensions/docs/templates/articles/notifications.html +++ b/chrome/common/extensions/docs/templates/articles/notifications.html @@ -81,8 +81,8 @@ notification.show(); <p> You can communicate between a notification and other views in your extension using -<a href="extension.html#method-getBackgroundPage">getBackgroundPage()</a> and -<a href="extension.html#method-getViews">getViews()</a>. For example: +$ref:extension.getBackgroundPage and +$ref:extension.getViews. For example: </p> <pre> diff --git a/chrome/common/extensions/docs/templates/articles/overview.html b/chrome/common/extensions/docs/templates/articles/overview.html index 22b2f1894..2e78acb 100644 --- a/chrome/common/extensions/docs/templates/articles/overview.html +++ b/chrome/common/extensions/docs/templates/articles/overview.html @@ -281,7 +281,7 @@ Any extension can have an options page, which lets users customize how the extension works. Another type of special page is the override page. And finally, you can -use <a href="tabs.html#method-create">chrome.tabs.create()</a> +use $ref:tabs.create or <code>window.open()</code> to display any other HTML files that are in the extension. </p> @@ -391,7 +391,7 @@ For example, any extension or web app can use the standard <code>window.open()</code> method to open a URL. But if you want to specify which window that URL should be displayed in, your extension can use the Chrome-only -<a href="tabs.html#method-create">chrome.tabs.create()</a> +$ref:tabs.create method instead. </p> @@ -418,7 +418,7 @@ Synchronous methods never have a callback because they don't return until they've completed all their work. Often, synchronous methods have a return type. Consider the -<a href="runtime.html#method-getURL">chrome.runtime.getURL()</a> method: +$ref:runtime.getURL method: </p> <p> @@ -440,35 +440,35 @@ and performs no other, asynchronous work. Say you want to navigate the user's currently selected tab to a new URL. To do this, you need to get the current tab's ID -(using <a href="tabs.html#method-getSelected">chrome.tabs.getSelected()</a>) +(using $ref:tabs.query) and then make that tab go to the new URL -(using <a href="tabs.html#method-update">chrome.tabs.update()</a>). +(using $ref:tabs.update). </p> <p> -If <code>getSelected()</code> were synchronous, +If <code>query()</code> were synchronous, you might write code like this: </p> <pre> <b>//THIS CODE DOESN'T WORK</b> -<span class="linenumber">1: </span>var tab = chrome.tabs.getSelected(null); <b>//WRONG!!!</b> +<span class="linenumber">1: </span>var tab = chrome.tabs.query({'active': true}); <b>//WRONG!!!</b> <span class="linenumber">2: </span>chrome.tabs.update(tab.id, {url:newUrl}); <span class="linenumber">3: </span>someOtherFunction(); </pre> <p> That approach fails -because <code>getSelected()</code> is asynchronous. +because <code>query()</code> is asynchronous. It returns without waiting for its work to complete, and it doesn't even return a value (although some asynchronous methods do). -You can tell that <code>getSelected()</code> is asynchronous +You can tell that <code>query()</code> is asynchronous by the <em>callback</em> parameter in its signature: <p> <code> -chrome.tabs.getSelected(integer <em>windowId</em>, function <em>callback</em>) +chrome.tabs.query(object <em>queryInfo</em>, function <em>callback</em>) </code> </p> @@ -477,25 +477,25 @@ To fix the preceding code, you must use that callback parameter. The following code shows how to define a callback function -that gets the results from <code>getSelected()</code> +that gets the results from <code>query()</code> (as a parameter named <code>tab</code>) and calls <code>update()</code>. </p> <pre> <b>//THIS CODE WORKS</b> -<span class="linenumber">1: </span>chrome.tabs.getSelected(null, <b>function(tab) {</b> -<span class="linenumber">2: </span> chrome.tabs.update(tab.id, {url:newUrl}); +<span class="linenumber">1: </span>chrome.tabs.query({'active': true}, <b>function(tabs) {</b> +<span class="linenumber">2: </span> chrome.tabs.update(tabs[0].id, {url: newUrl}); <span class="linenumber">3: </span><b>}</b>); <span class="linenumber">4: </span>someOtherFunction(); </pre> <p> In this example, the lines are executed in the following order: 1, 4, 2. -The callback function specified to <code>getSelected</code> is called +The callback function specified to <code>query()</code> is called (and line 2 executed) only after information about the currently selected tab is available, -which is sometime after <code>getSelected()</code> returns. +which is sometime after <code>query()</code> returns. Although <code>update()</code> is asynchronous, this example doesn't use its callback parameter, since we don't do anything about the results of the update. @@ -573,8 +573,8 @@ don't store it if it's from an incognito window. <p> To detect whether a window is in incognito mode, check the <code>incognito</code> property of the relevant -<a href="tabs.html#type-Tab">Tab</a> or -<a href="windows.html#type-Window">Window</a> object. +$ref:tabs.Tab or +$ref:windows.Window object. For example: </p> diff --git a/chrome/common/extensions/docs/templates/articles/permission_warnings.html b/chrome/common/extensions/docs/templates/articles/permission_warnings.html index 2197b10..c4a2780 100644 --- a/chrome/common/extensions/docs/templates/articles/permission_warnings.html +++ b/chrome/common/extensions/docs/templates/articles/permission_warnings.html @@ -115,7 +115,7 @@ although the <code>chrome.tabs</code> API might be used only to open new tabs, it can also be used to see the URL that's associated with every newly opened tab -(using their <a href="tabs.html#type-Tab">Tab</a> objects). +(using their $ref:tabs.Tab objects). </p> <p class="note"> @@ -444,5 +444,5 @@ by clicking the <b>chrome://extensions</b> page's <p> You can get a list of permission warnings for any manifest with -<a href="management.html#method-getPermissionWarnings">chrome.management.getPermissionWarnings()</a>. +$ref:management.getPermissionWarningsByManifest. </p> diff --git a/chrome/common/extensions/docs/templates/articles/whats_new.html b/chrome/common/extensions/docs/templates/articles/whats_new.html index 4a74128..4d92fbe 100644 --- a/chrome/common/extensions/docs/templates/articles/whats_new.html +++ b/chrome/common/extensions/docs/templates/articles/whats_new.html @@ -47,32 +47,32 @@ made in recent releases. <h4> Additions to Existing Features </h4> <ul> - <li>The <a href="types.html#method-ChromeSetting-set" - >ChromeSetting.set()</a> method now has a + <li>The $ref:types.ChromeSetting.set + method now has a <code>regular_only</code> scope. - <li>The <a href="browsingData.html#type-RemovalOptions" - >browsingData.RemovalOptions</a> now has an <code>originTypes</code> + <li>The $ref:browsingData.RemovalOptions + now has an <code>originTypes</code> property. - <li>The <a href="management.html#method-uninstall" - >management.uninstall()</a> method now has a <code + <li>The $ref:management.uninstall + method now has a <code >showConfirmDialog</code> parameter. - <li>The <a href="contextMenus.html#method-create" - >contextMenus.create()</a> method now allows you to specify unique + <li>The $ref:contextMenus.create + method now allows you to specify unique IDs for each item. This is intended to be used with the new - <a href="contextMenus.html#event-onClicked" - >contextMenus.onClicked</a> event, to distinguish the clicked item. - <li>The <a href="browserAction.html#method-setIcon" - >browserAction.setIcon()</a> and - <a href="pageAction.html#method-setIcon" - >pageAction.setIcon()</a> methods now accept optional callbacks. - <li>The <a href="privacy.html#property-websites" - >privacy.websites</a> namespace now has a <code + $ref:contextMenus.onClicked + event, to distinguish the clicked item. + <li>The $ref:browserAction.setIcon + and + $ref:pageAction.setIcon + methods now accept optional callbacks. + <li>The $ref:privacy.websites + namespace now has a <code >protectedContentEnabled</code> property. - <li>The <code>index</code> parameter to the <a href="tabs.html#method-move" - >tabs.move()</a> method now accepts <code>-1</code> to indicate + <li>The <code>index</code> parameter to the $ref:tabs.move + method now accepts <code>-1</code> to indicate that the tab should be placed at the end. <li>The <code>windowId</code> parameter to the - <a href="tabs.html#method-highlight">tabs.highlight()</a> + $ref:tabs.highlight method is now optional. <li><a href="manifest.html#intents">Web intents</a> can now be used to register content-type viewers. @@ -98,14 +98,14 @@ made in recent releases. <h4> Additions to existing APIs </h4> <ul> <li>The <code>chrome.contextMenus</code> - <a href="contextMenus.html#method-create">create()</a> and - <a href="contextMenus.html#method-update">update()</a> + $ref:contextMenus.create and + $ref:contextMenus.update methods now have an <code>enabled</code> parameter.</li> - <li>The privacy API's <a href="privacy.html#property-services">services</a> object + <li>The privacy API's $ref:privacy.services object now has a <code>spellingServiceEnabled</code> setting.</li> <li>The <code>chrome.tabs</code> - <a href="tabs.html#method-executeScript">executeScript()</a> and - <a href="tabs.html#method-insertCSS">insertCSS()</a> + $ref:tabs.executeScript and + $ref:tabs.insertCSS now accept a <code>runAt</code> parameter.</li> </ul> @@ -115,8 +115,8 @@ made in recent releases. <li>The <code>sendRequest()</code> method has been deprecated in favor of the <code>sendMessage()</code> method for both the - <a href="extension.html#method-sendMessage">extension API</a> and - <a href="tabs.html#method-sendMessage">tabs API</a>.</li> + $ref:extension.sendMessage and + $ref:tabs.sendMessage.</li> <li>The <a href="external_extensions.html">external_extensions.json file</a> has been deprecated in favor of individual <code><extension-id>.json</code> files.</li> @@ -141,24 +141,23 @@ made in recent releases. <h4> Additions to existing APIs </h4> <ul> - <li>The window API's <a href="windows.html#type-Window">Window</a> + <li>The window API's $ref:windows.Window object now has an <code>alwaysOnTop</code> property and supports the "fullscreen" state. <li>The <code>chrome.tabs</code> - <a href="tabs.html#method-query">query()</a> method + $ref:tabs.query method now has the <code>currentWindow</code> and <code>lastFocusedWindow</code> parameters. <li>The <a href="browserAction.html">browser action API</a> has the following new getter functions: - <a href="browserAction.html#method-getTitle">getTitle</a>, - <a href="browserAction.html#method-getBadgeText">getBadgeText</a>, - <a href="browserAction.html#method-getBadgeBackgroundColor">getBadgeBackgr - oundColor</a>, and - <a href="browserAction.html#method-getPopup">getPopup</a>. + $ref:browserAction.getTitle, + $ref:browserAction.getBadgeText, + $ref:browserAction.getBadgeBackgroundColor, and + $ref:browserAction.getPopup. <li>The <a href="pageAction.html">page action API</a> has the following new getter functions: - <a href="pageAction.html#method-getTitle">getTitle</a> and - <a href="pageAction.html#method-getPopup">getPopup</a>. + $ref:pageAction.getTitle and + $ref:pageAction.getPopup. </ul> <h2 id="18"> Google Chrome 18 </h2> @@ -205,11 +204,11 @@ made in recent releases. <h4> Additions to existing APIs </h4> <ul> - <li>The <a href="windows.html#property-WINDOW_ID_CURRENT">windows API</a> + <li>The $ref:windows.WINDOW_ID_CURRENT now has a <code>WINDOW_ID_CURRENT</code> property. <li>The <code>chrome.tabs</code> - <a href="tabs.html#method-create">create()</a> and - <a href="tabs.html#method-update">update()</a> methods + $ref:tabs.create and + $ref:tabs.update methods now have an <code>openerTabId</code> parameter. </ul> @@ -235,7 +234,7 @@ made in recent releases. <h4> Additions to existing APIs </h4> <ul> <li>The management API's - <a href="management.html#type-ExtensionInfo">ExtensionInfo</a> object + $ref:management.ExtensionInfo object now has a <code>disabledReason</code> property. </ul> @@ -280,15 +279,15 @@ made in recent releases. <h4> Additions to existing APIs </h4> <ul> <li>The new - <a href="tabs.html#method-query">chrome.tabs.query()</a> method + $ref:tabs.query method gets all tabs that have the specified properties or all tabs if no properties are specified. <li>The new - <a href="tabs.html#method-reload">chrome.tabs.reload()</a> method + $ref:tabs.reload method reloads a tab and includes the option to preserve the local cache of the reloaded tab. <li>The management API's - <a href="management.html#type-ExtensionInfo">ExtensionInfo</a> object + $ref:management.ExtensionInfo object now has an <code>updateURL</code> property. <li>You can now limit the supported locales for an <a href="external_extensions.html">external extension</a> @@ -301,14 +300,14 @@ made in recent releases. <li>The methods <code>getAllInWindow()</code> and <code>getSelected()</code> have been deprecated. To get details about all tabs in the specified window, use - <a href="tabs.html#method-query">chrome.tabs.query()</a> + $ref:tabs.query with the argument <code>{'windowId': windowID}</code>. To get the tab that is selected in the specified window, use <code>chrome.tabs.query()</code> with the argument <code>{'active': true}</code>. <li>You are no longer required to specify the <code>tabID</code> for the - <a href="tabs.html#method-update">chrome.tabs.update()</a> method. + $ref:tabs.update method. When not provided, the <code>tabID</code> defaults to the selected tab of the current window. @@ -316,7 +315,7 @@ made in recent releases. within a wheel group (or an admin group). <li>The "experimental" permission is no longer required for the - <a href="windows.html#type-Window">window "panel"</a> type. + $ref:windows.Window type. By default, the "panel" type creates a popup unless the <code>--enable-panels</code> flag is set. </ul> @@ -343,11 +342,11 @@ made in recent releases. <h4> Additions to existing APIs </h4> <ul> <li>You can retrieve permission warnings using the new management API methods - <a href="management.html#method-getPermissionWarningsById">getPermissionWarningsById()</a> + $ref:management.getPermissionWarningsById and - <a href="management.html#method-getPermissionWarningsByManifest">getPermissionWarningsByManifest()</a>. + $ref:management.getPermissionWarningsByManifest. <li>The management API’s - <a href="management.html#type-ExtensionInfo">ExtensionInfo</a> object has + $ref:management.ExtensionInfo object has a new field, <code>offlineEnabled</code>. <li>You can now <a href="i18n.html">internationalize</a> content script CSS files by using <code>__MSG_messagename__</code> placeholders. @@ -355,7 +354,7 @@ made in recent releases. <h4> Changes to existing APIs </h4> <ul> - <li>The callback for the <a href="tabs.html#method-update">tabs.update</a> + <li>The callback for the $ref:tabs.update method is passed <code>null</code> instead of the tab details if the extension does not have the "tabs" permission. </ul> @@ -397,19 +396,19 @@ made in recent releases. Previously, they were restricted to documents with http:// or https:// URLs. <li>An optional <code>drawAttention</code> field in - <a href="windows.html#method-update">chrome.windows.update()</a>'s + $ref:windows.update's <code>updateInfo</code> object lets you specify that the window should entice the user to change focus to it. <li>The new - <a href="bookmarks.html#method-getSubTree">bookmarks.getSubTree()</a> + $ref:bookmarks.getSubTree function lets you retrieve just part of the Bookmarks hierarchy. </ul> <h4> Changes to existing APIs </h4> <ul> <li>The "tabs" permission is no longer required for - <a href="tabs.html#method-remove">tabs.remove</a> and - <a href="tabs.html#event-onRemoved">tabs.onRemoved</a>. + $ref:tabs.remove and + $ref:tabs.onRemoved. </ul> <h2 id="13"> Google Chrome 13 </h2> @@ -419,7 +418,7 @@ made in recent releases. <li>The <a href="proxy.html">proxy API</a> lets extensions manage Chrome's proxy settings. <li>The - <a href="types.html#type-ChromeSetting">chrome.types.ChromeSetting</a> prototype + $ref:types.ChromeSetting prototype provides an interface to browser settings; it's used by the proxy API. <li> <em>Chrome OS only:</em> @@ -459,27 +458,27 @@ made in recent releases. <h4> Additions to existing APIs </h4> <ul> <li>Two new <code>chrome.extension</code> - methods—<a href="extension.html#method-isAllowedFileSchemeAccess">isAllowedFileSchemeAccess()</a> and - <a href="extension.html#method-isAllowedIncognitoAccess">isAllowedIncognitoAccess()</a>—let you + methods—$ref:extension.isAllowedFileSchemeAccess and + $ref:extension.isAllowedIncognitoAccess—let you determine whether your extension has increased access, which the user specifies using the extensions management page (<b>chrome://extensions</b>). - <li>The <a href="windows.html#method-create">chrome.windows.create()</a> + <li>The $ref:windows.create method can now take a <code>focused</code> value. Previously, all new windows had the keyboard focus; now you can create windows without interrupting the user's typing. <li>If the manifest specifies "experimental" permission, your extension can specify "panel" as the value of the <code>type</code> field in - the <a href="windows.html#method-create">chrome.windows.create()</a> + the $ref:windows.create method - or the <a href="windows.html#type-Window">Window</a> type. - <li>The <a href="cookies.html#event-onChanged">onChanged</a> + or the $ref:windows.Window type. + <li>The $ref:cookies.onChanged event of <code>chrome.cookies</code> now has a <code>cause</code> parameter. <li>The <code>chrome.contextMenus</code> - <a href="contextMenus.html#method-create">create()</a> and - <a href="contextMenus.html#method-update">update()</a> + $ref:contextMenus.create and + $ref:contextMenus.update methods now let you specify a context value of "frame". </ul> @@ -488,7 +487,7 @@ made in recent releases. <h4> Changes to existing APIs </h4> <ul> <li>For security reasons, you can no longer call - <a href="tabs.html#method-captureVisibleTab">chrome.tab.captureVisibleTab()</a> + $ref:tabs.captureVisibleTab on just any tab. Instead, you now must have <a href="manifest.html#permissions">host permission</a> @@ -500,16 +499,16 @@ made in recent releases. <h4> Additions to existing APIs </h4> <ul> <li>The management API's - <a href="management.html#type-ExtensionInfo">ExtensionInfo</a> object + $ref:management.ExtensionInfo object now has a <code>homepageUrl</code> property. <li>The management API now lets you get the icons of disabled apps and extensions. Also, you can now modify the regular icon's URL to get its disabled equivalent. - See <a href="management.html#type-IconInfo">IconInfo</a> for details. + See $ref:management.IconInfo for details. <li>The cookies API - <a href="cookies.html#method-set">set()</a> - and <a href="cookies.html#method-remove">remove()</a> methods + $ref:cookies.set + and $ref:cookies.remove methods can now take callbacks. </ul> @@ -525,7 +524,7 @@ made in recent releases. <h4> Additions to existing APIs </h4> <ul> - <li>The <a href="windows.html#method-create">chrome.windows.create()</a> + <li>The $ref:windows.create method now has a <code>tabId</code> field. You can use it to move a tab or panel into a new window. <p class="note"> @@ -550,17 +549,17 @@ made in recent releases. <h4> Additions to existing APIs </h4> <ul> - <li>The <a href="tabs.html#type-Tab">Tab</a> object + <li>The $ref:tabs.Tab object now has a <code>pinned</code> property that's reflected in various <code>chrome.tabs</code> methods. For example, - you can <a href="tabs.html#method-create">create</a> + you can $ref:tabs.create a pinned tab. - <li>The <a href="windows.html#method-create">chrome.windows.create()</a> + <li>The $ref:windows.create method can now take a list of URLs, letting you create multiple tabs in the new window. <li>The new - <a href="management.html#method-get">chrome.management.get()</a> method + $ref:management.get method lets you get information about the specified extension or app. </ul> @@ -610,14 +609,14 @@ No API or manifest changes worth noting. <h4> Additions to existing APIs </h4> <ul> - <li>The <a - href="extension.html#method-getViews">chrome.extension.getViews()</a> + <li>The + $ref:extension.getViews method can now return popup views. - <li>A new <a - href="windows.html#property-WINDOW_ID_NONE">WINDOW_ID_NONE</a> constant + <li>A new + $ref:windows.WINDOW_ID_NONE constant identifies when focus shifts away from the browser. - <li>The new <a - href="tabs.html#method-getCurrent">chrome.tabs.getCurrent()</a> method + <li>The new + $ref:tabs.getCurrent method returns the tab associated with the currently executing script. </ul> diff --git a/chrome/common/extensions/docs/templates/intros/bookmarks.html b/chrome/common/extensions/docs/templates/intros/bookmarks.html index 7ebe4f1..eafbd52 100644 --- a/chrome/common/extensions/docs/templates/intros/bookmarks.html +++ b/chrome/common/extensions/docs/templates/intros/bookmarks.html @@ -31,18 +31,18 @@ is either a bookmark or a folder (sometimes called a <em>group</em>). Each node in the tree is represented by a -<a href="#type-BookmarkTreeNode"><code>BookmarkTreeNode</code></a> object. +$ref:bookmarks.BookmarkTreeNode object. </p> <p> <code>BookmarkTreeNode</code> properties are used throughout the <code>chrome.bookmarks</code> API. For example, when you call -<a href="#method-create"><code>create()</code></a>, +$ref:bookmarks.create, you pass in the new node's parent (<code>parentId</code>), and, optionally, the node's <code>index</code>, <code>title</code>, and <code>url</code> properties. -See <a href="#type-BookmarkTreeNode"><code>BookmarkTreeNode</code></a> +See $ref:bookmarks.BookmarkTreeNode for information about the properties a node can have. </p> diff --git a/chrome/common/extensions/docs/templates/intros/browserAction.html b/chrome/common/extensions/docs/templates/intros/browserAction.html index 55460e7..2f1d1bd 100644 --- a/chrome/common/extensions/docs/templates/intros/browserAction.html +++ b/chrome/common/extensions/docs/templates/intros/browserAction.html @@ -96,7 +96,7 @@ and a <a href="#popups">popup</a>. <p>To set the icon, use the <b>default_icon</b> field of <b>browser_action</b> in the <a href="#manifest">manifest</a>, - or call the <a href="#method-setIcon">setIcon()</a> method. + or call the $ref:browserAction.setIcon method. </p> <p>To properly display icon when screen pixel density (ratio @@ -113,7 +113,7 @@ and a <a href="#popups">popup</a>. To set the tooltip, use the <b>default_title</b> field of <b>browser_action</b> in the <a href="#manifest">manifest</a>, -or call the <a href="#method-setTitle">setTitle()</a> method. +or call the $ref:browserAction.setTitle method. You can specify locale-specific strings for the <b>default_title</b> field; see <a href="i18n.html">Internationalization</a> for details. </p> @@ -132,8 +132,8 @@ see <a href="i18n.html">Internationalization</a> for details. <p> Set the text and color of the badge using -<a href="#method-setBadgeText">setBadgeText()</a> and -<a href="#method-setBadgeBackgroundColor">setBadgeBackgroundColor()</a>, +$ref:browserAction.setBadgeText and +$ref:browserAction.setBadgeBackgroundColor, respectively. </p> @@ -152,7 +152,7 @@ To add a popup to your browser action, create an HTML file with the popup's contents. Specify the HTML file in the <b>default_popup</b> field of <b>browser_action</b> in the <a href="#manifest">manifest</a>, or call the -<a href="#method-setPopup">setPopup()</a> method. +$ref:browserAction.setPopup method. </p> <h2 id="tips">Tips</h2> diff --git a/chrome/common/extensions/docs/templates/intros/contentSettings.html b/chrome/common/extensions/docs/templates/intros/contentSettings.html index 2353b15..06414f8 100644 --- a/chrome/common/extensions/docs/templates/intros/contentSettings.html +++ b/chrome/common/extensions/docs/templates/intros/contentSettings.html @@ -80,12 +80,12 @@ in the hostname.</li> <p> The URL taken into account when deciding which content setting to apply depends on the content type. For example, for -<a href="#property-notifications">notifications</a> settings are +$ref:contentSettings.notifications settings are based on the URL shown in the omnibox. This URL is called the "primary" URL.</p> <p> Some content types can take additional URLs into account. For example, whether a site is allowed to set a -<a href="#property-cookies">cookie</a> is decided based on the URL +$ref:contentSettings.cookies is decided based on the URL of the HTTP request (which is the primary URL in this case) as well as the URL shown in the omnibox (which is called the "secondary" URL). </p> @@ -120,7 +120,7 @@ is ordered by precedence:</p> <p> Resource identifiers allow you to specify content settings for specific subtypes of a content type. Currently, the only content type that supports -resource identifiers is <a href="#property-plugins"><code>plugins</code></a>, +resource identifiers is $ref:contentSettings.plugins, where a resource identifier identifies a specific plug-in. When applying content settings, first the settings for the specific plug-in are checked. If there are no settings found for the specific plug-in, the general content settings for @@ -134,8 +134,7 @@ it takes precedence over a rule without a resource identifier and the pattern </p> <p> You can get a list of resource identifiers for a content type by calling the -<a href="contentSettings.html#method-ContentSetting-getResourceIdentifiers"> -<code>getResourceIdentifiers()</code></a> method. The returned list +$ref:contentSettings.ContentSetting.getResourceIdentifiers method. The returned list can change with the set of installed plug-ins on the user's machine, but Chrome tries to keep the identifiers stable across plug-in updates. </p> diff --git a/chrome/common/extensions/docs/templates/intros/devtools_inspectedWindow.html b/chrome/common/extensions/docs/templates/intros/devtools_inspectedWindow.html index 30c4384..c1685ee 100644 --- a/chrome/common/extensions/docs/templates/intros/devtools_inspectedWindow.html +++ b/chrome/common/extensions/docs/templates/intros/devtools_inspectedWindow.html @@ -12,7 +12,7 @@ general introduction to using Developer Tools APIs. <h2 id="overview">Overview</h2> <p> -The <a href="#property-tabId"><code>tabId</code></a> property +The $ref:devtools.inspectedWindow.tabId property provides the tab identifier that you can use with the <a href="tabs.html"><code>chrome.tabs.*</code></a> API calls. However, please note that <code>chrome.tabs.*</code> API is not @@ -57,8 +57,7 @@ extension.</em> <p class="caution"> <strong>Important:</strong> Due to the security considerations explained above, the -<a href="tabs.html#method-executeScript"><code ->chrome.tabs.executeScript()</code></a> method is the preferred way for an +$ref:tabs.executeScript method is the preferred way for an extension to access DOM data of the inspected page in cases where the access to JavaScript state of the inspected page is not required.</em> </p><p> diff --git a/chrome/common/extensions/docs/templates/intros/devtools_panels.html b/chrome/common/extensions/docs/templates/intros/devtools_panels.html index 6de12cf..914368a 100644 --- a/chrome/common/extensions/docs/templates/intros/devtools_panels.html +++ b/chrome/common/extensions/docs/templates/intros/devtools_panels.html @@ -18,8 +18,8 @@ available to the pages within Developer Tools window, but you may invoke them by sending a request to the background page of your extension, similarly to how it's done in the <a href="overview.html#contentScripts">content scripts</a>. </p><p> -You can use the <code><a href="#method-setOpenResourceHandler" ->setOpenResourceHandler()</a></code> method to install a +You can use the <code>$ref:devtools.panels.setOpenResourceHandler +</code> method to install a callback function that handles user requests to open a resource (typically, a click on a resource link in the Developer Tools window). At most one of the installed handlers gets called; users can specify (using the Developer Tools diff --git a/chrome/common/extensions/docs/templates/intros/downloads.html b/chrome/common/extensions/docs/templates/intros/downloads.html index ee107d1..624d733 100644 --- a/chrome/common/extensions/docs/templates/intros/downloads.html +++ b/chrome/common/extensions/docs/templates/intros/downloads.html @@ -6,7 +6,7 @@ manipulate, and search for downloads.</p> <p> You must declare the 'downloads' permission in the <a href='manifest.html'>extension manifest</a> to use this API, along with <a href='manifest.html#permissions'>host permissions</a> for any hosts that you -may pass to <a href='#method-download'>download()</a>.</p> +may pass to $ref:downloads.download.</p> <pre>{ 'name': 'My extension', @@ -18,10 +18,10 @@ may pass to <a href='#method-download'>download()</a>.</p> ... }</pre> -<p>If the URL's hostname is not specified in the permissions, then <a -href='#method-download'>download()</a> will call its callback with a null -<code>downloadId</code> and set the <a -href='extension.html#property-lastError'>chrome.extensions.lastError</a> +<p>If the URL's hostname is not specified in the permissions, then +$ref:downloads.download will call its callback with a null +<code>downloadId</code> and set the +$ref:runtime.lastError object to indicate that the extension does not have permission to access that hostname.</p> diff --git a/chrome/common/extensions/docs/templates/intros/events.html b/chrome/common/extensions/docs/templates/intros/events.html index d40e231..c0fab99 100644 --- a/chrome/common/extensions/docs/templates/intros/events.html +++ b/chrome/common/extensions/docs/templates/intros/events.html @@ -25,9 +25,9 @@ is always a function that you define to handle the event, but the parameters to the function depend on which event you're handling. Checking the documentation for -<a href="tabs.html#event-onCreated"><code>chrome.tabs.onCreated</code></a>, +$ref:tabs.onCreated, you can see that the function has a single parameter: -a <a href="tabs.html#type-Tab">Tab</a> object +a $ref:tabs.Tab object that has details about the newly created tab. </p> @@ -84,9 +84,9 @@ var rule = { don't call a callback function when events happen but test whether any registered rule has at least one fulfilled condition and execute the actions associated with this rule. Event objects supporting the declarative API have -three relevant methods: <a href="#method-addRules"><code>addRules()</code></a>, -<a href="#method-removeRules"><code>removeRules()</code></a>, and -<a href="#method-getRules"><code>getRules()</code></a>. +three relevant methods: $ref:events.Event.addRules, +$ref:events.Event.removeRules, and +$ref:events.Event.getRules. </p> <h3 id="addingrules">Adding rules</h3> @@ -108,8 +108,8 @@ contains an array of inserted rules appearing in the same order as in the passed <code>rule_list</code> where the optional parameters <code>id</code> and <code>priority</code> were filled with the generated values. If any rule is invalid, e.g., because it contained an invalid condition or action, none of the -rules are added and the <a - href="extension.html#property-lastError">lastError</a> variable is set when +rules are added and the + $ref:runtime.lastError variable is set when the callback function is called. Each rule in <code>rule_list</code> must contain a unique identifier that is not currently used by another rule or an empty identifier. @@ -118,7 +118,7 @@ empty identifier. <p class="note"> <strong>Note:</strong> Rules are persistent across browsing sessions. Therefore, you should install rules during extension installation time using the -<code><a href="runtime.html#event-onInstalled">chrome.runtime.onInstalled</a></code> +<code>$ref:runtime.onInstalled</code> event. Note that this event is also triggered when an extension is updated. Therefore, you should first clear previously installed rules and then register new rules. @@ -204,8 +204,8 @@ of filters that an event supports will be listed in the documentation for that event in the "filters" section.</p> <p>When matching URLs (as in the example above), event filters support the same -URL matching capabilities as expressable with a <a - href="events.html#type-UrlFilter">UrlFilter</a>, except for scheme and port +URL matching capabilities as expressable with a + $ref:events.UrlFilter, except for scheme and port matching.</p> </div> diff --git a/chrome/common/extensions/docs/templates/intros/experimental_speechInput.html b/chrome/common/extensions/docs/templates/intros/experimental_speechInput.html index af6b8e9..9c9f994 100644 --- a/chrome/common/extensions/docs/templates/intros/experimental_speechInput.html +++ b/chrome/common/extensions/docs/templates/intros/experimental_speechInput.html @@ -49,7 +49,7 @@ chrome.experimental.speechInput.onResult.addListener(callback); </pre> <p>The <code>result</code> object contains an array of -<a href="#type-SpeechInputResultHypothesis">SpeechInputResultHypothesis</a> +$ref:experimental.speechInput.SpeechInputResultHypothesis sorted by decreasing likelihood.</p> <p>Recording automatically stops when results are received. It is safe to call diff --git a/chrome/common/extensions/docs/templates/intros/extension.html b/chrome/common/extensions/docs/templates/intros/extension.html index 2ab3f08..3dd97ba 100644 --- a/chrome/common/extensions/docs/templates/intros/extension.html +++ b/chrome/common/extensions/docs/templates/intros/extension.html @@ -17,21 +17,21 @@ can be used by content scripts: <dl> <dt> - <a href="#method-sendMessage"><code>sendMessage()</code></a> and - <a href="#event-onMessage"><code>onMessage</code></a> + $ref:extension.sendMessage and + $ref:extension.onMessage </dt> <dd> Simple communication with extension pages </dd> <dt> - <a href="#method-connect"><code>connect()</code></a> and - <a href="#event-onConnect"><code>onConnect</code></a> + $ref:extension.connect and + $ref:extension.onConnect </dt> <dd> Extended communication with extension pages </dd> <dt> - <a href="#method-getURL"><code>getURL()</code></a> + $ref:extension.getURL </dt> <dd> Access to extension resources such as image files diff --git a/chrome/common/extensions/docs/templates/intros/i18n.html b/chrome/common/extensions/docs/templates/intros/i18n.html index 4c0c2be..6be494c 100644 --- a/chrome/common/extensions/docs/templates/intros/i18n.html +++ b/chrome/common/extensions/docs/templates/intros/i18n.html @@ -546,7 +546,7 @@ status.innerText = chrome.i18n.getMessage("error", errorDetails); For more information about placeholders, see the <a href="i18n-messages.html">Locale-Specific Messages</a> page. For details on calling <code>getMessage()</code>, see the -<a href="#method-getMessage">API reference</a>. +$ref:[i18n.getMessage API reference]. </p> <h3 id="example-accept-languages">Example: getAcceptLanguages</h3> @@ -566,5 +566,5 @@ function getAcceptLanguages() { <p> For details on calling <code>getAcceptLanguages()</code>, see the -<a href="#method-getAcceptLanguages">API reference</a>. +$ref:[i18n.getAcceptLanguages API reference]. </p>
\ No newline at end of file diff --git a/chrome/common/extensions/docs/templates/intros/management.html b/chrome/common/extensions/docs/templates/intros/management.html index ae5076a..4319a8d 100644 --- a/chrome/common/extensions/docs/templates/intros/management.html +++ b/chrome/common/extensions/docs/templates/intros/management.html @@ -19,5 +19,5 @@ For example:</p> <p> The one method that doesn't require the "management" permission is -<a href="#method-getPermissionWarningsByManifest"><code>getPermissionWarningsByManifest</code></a> +$ref:management.getPermissionWarningsByManifest </p>
\ No newline at end of file diff --git a/chrome/common/extensions/docs/templates/intros/pageAction.html b/chrome/common/extensions/docs/templates/intros/pageAction.html index cc95f44..f6c0deb 100644 --- a/chrome/common/extensions/docs/templates/intros/pageAction.html +++ b/chrome/common/extensions/docs/templates/intros/pageAction.html @@ -80,8 +80,8 @@ by reading about the <p> You make a page action appear and disappear using the -<a href="#method-show">show()</a> and -<a href="#method-hide">hide()</a> methods, respectively. +$ref:pageAction.show and +$ref:pageAction.hide methods, respectively. By default, a page action is hidden. When you show it, you specify the tab in which the icon should appear. diff --git a/chrome/common/extensions/docs/templates/intros/proxy.html b/chrome/common/extensions/docs/templates/intros/proxy.html index 7a61dd0..81fa769 100644 --- a/chrome/common/extensions/docs/templates/intros/proxy.html +++ b/chrome/common/extensions/docs/templates/intros/proxy.html @@ -23,10 +23,10 @@ For example:</p> <p> Proxy settings are defined in a -<a href="#type-ProxyConfig"><code>ProxyConfig</code></a> object. Depending on +$ref:proxy.ProxyConfig object. Depending on Chrome's proxy settings, the settings may contain -<a href="#type-ProxyRules"><code>ProxyRules</code></a> or a <a - href="#type-PacScript"><code>PacScript</code></a>. +$ref:proxy.ProxyRules or a + $ref:proxy.PacScript. </p> <h3 id="proxy_modes">Proxy modes</h3> @@ -51,15 +51,15 @@ values: <dt><code>pac_script</code></dt> <dd>In <code>pac_script</code> mode the proxy configuration is determined by a PAC script that is either retrieved from the URL specified in the - <a href="#type-PacScript"><code>PacScript</code></a> object or + $ref:proxy.PacScript object or taken literally from the <code>data</code> element specified in the - <a href="#type-PacScript"><code>PacScript</code></a> object. + $ref:proxy.PacScript object. Besides this, this mode allows no further parameters in the <code>ProxyConfig</code> object.</dd> <dt><code>fixed_servers</code></dt> <dd>In <code>fixed_servers</code> mode the proxy configuration is codified in - a <a href="#type-ProxyRules><code>ProxyRules"><code>ProxyRules</code></a> + a $ref:proxy.ProxyRules object. Its structure is described in <a href="#proxy_rules">Proxy rules</a>. Besides this, the <code>fixed_servers</code> mode allows no further parameters in the <code>ProxyConfig</code> object.</dd> @@ -77,7 +77,7 @@ values: <h3 id="proxy_rules">Proxy rules</h3> <p> -The <a href="#type-ProxyRules"><code>ProxyRules</code></a> object can contain +The $ref:proxy.ProxyRules object can contain either a <code>singleProxy</code> attribute or a subset of <code>proxyForHttp</code>, <code>proxyForHttps</code>, <code>proxyForFtp</code>, and <code>fallbackProxy</code>. @@ -98,7 +98,7 @@ proxy server. <p> A proxy server is configured in a -<a href="#type-ProxyServer"><code>ProxyServer</code></a> object. The connection +$ref:proxy.ProxyServer object. The connection to the proxy server (defined by the <code>host</code> attribute) uses the protocol defined in the <code>scheme</code> attribute. If no <code>scheme</code> is specified, the proxy connection defaults to <code>http</code>. @@ -106,7 +106,7 @@ is specified, the proxy connection defaults to <code>http</code>. <p> If no <code>port</code> is defined in a -<a href="#type-ProxyServer"><code>ProxyServer</code></a> object, the port is +$ref:proxy.ProxyServer object, the port is derived from the scheme. The default ports are: <table> <tr><th>Scheme</th><th>Port</th></tr> diff --git a/chrome/common/extensions/docs/templates/intros/pushMessaging.html b/chrome/common/extensions/docs/templates/intros/pushMessaging.html index 5438009..19ca09d 100644 --- a/chrome/common/extensions/docs/templates/intros/pushMessaging.html +++ b/chrome/common/extensions/docs/templates/intros/pushMessaging.html @@ -226,7 +226,7 @@ Your app or extension will need to send this value to its application server so that the server can trigger push messages back. To get the user's channel ID, -call <a href="http://developer.chrome.com/apps/pushMessaging.html#method-getChannelId">getChannelId</a>. +call $ref:pushMessaging.getChannelId. Use the callback function to send the channel ID back to your app or extension. </p> @@ -450,7 +450,7 @@ your app or extension on the Extensions management page (go to <strong>chrome://extensions</strong> in your browser). Your app or extension doesn't need to be running, just installed. You will need to get the channel ID at install time -using <a href="app.runtime.html#event-onLaunched">chrome.app.runtime.onLaunched.addListener</a>. +using $ref:app.runtime.onLaunched. Then, use that channel ID on the server to send a test push message through the system. All going well, diff --git a/chrome/common/extensions/docs/templates/intros/tabs.html b/chrome/common/extensions/docs/templates/intros/tabs.html index 8002b16..88e750e 100644 --- a/chrome/common/extensions/docs/templates/intros/tabs.html +++ b/chrome/common/extensions/docs/templates/intros/tabs.html @@ -26,10 +26,10 @@ For example: }</pre> <p> -Three methods (<a href="#method-create"><code>create</code></a>, -<a href="#method-update"><code>update</code></a> and -<a href="#method-remove"><code>remove</code></a>) and one event -(<a href="#event-onRemoved"><code>onRemoved</code></a>) don't require the "tabs" +Three methods ($ref:tabs.create, +$ref:tabs.update and +$ref:tabs.remove) and one event +($ref:tabs.onRemoved) don't require the "tabs" permission. </p> diff --git a/chrome/common/extensions/docs/templates/intros/tts.html b/chrome/common/extensions/docs/templates/intros/tts.html index 93b88ac..46a00ea 100644 --- a/chrome/common/extensions/docs/templates/intros/tts.html +++ b/chrome/common/extensions/docs/templates/intros/tts.html @@ -55,13 +55,13 @@ chrome.tts.speak( </pre> <p>A complete description of all options can be found in the -<a href="#method-speak">speak() method documentation</a> below. +$ref:tts.speak below. Not all speech engines will support all options.</p> <p>To catch errors and make sure you're calling <code>speak()</code> correctly, pass a callback function that takes no arguments. Inside the callback, check -<a href="extension.html#property-lastError">chrome.extension.lastError</a> +$ref:runtime.lastError to see if there were any errors.</p> <pre>chrome.tts.speak( diff --git a/chrome/common/extensions/docs/templates/intros/ttsEngine.html b/chrome/common/extensions/docs/templates/intros/ttsEngine.html index 38febe7..a1e766e 100644 --- a/chrome/common/extensions/docs/templates/intros/ttsEngine.html +++ b/chrome/common/extensions/docs/templates/intros/ttsEngine.html @@ -15,8 +15,8 @@ to the calling function to report the status. <p>An extension can register itself as a speech engine. By doing so, it can intercept some or all calls to functions such as -<a href="tts.html#method-speak"><code>speak()</code></a> and -<a href="tts.html#method-stop"><code>stop()</code></a> +$ref:tts.speak and +$ref:tts.stop and provide an alternate implementation. Extensions are free to use any available web technology to provide speech, including streaming audio from a server, HTML5 audio, @@ -117,7 +117,7 @@ not sent by the speech engine; they are generated automatically by Chrome.</p> <p>Text-to-speech clients can get the voice information from your extension's manifest by calling -<a href="tts.html#method-getVoices">getVoices()</a>, +$ref:tts.getVoices, assuming you've registered speech event listeners as described below.</p> <h2 id="handling_speech_events">Handling speech events</h2> diff --git a/chrome/common/extensions/docs/templates/intros/types.html b/chrome/common/extensions/docs/templates/intros/types.html index c2cf8b4..67257dd 100644 --- a/chrome/common/extensions/docs/templates/intros/types.html +++ b/chrome/common/extensions/docs/templates/intros/types.html @@ -2,8 +2,8 @@ The <code>chrome.types</code> module contains type declarations for Chrome. Currently this comprises only a prototype for giving other modules access to manage Chrome browser settings. This prototype is used, -for example, for <a - href="proxy.html#property-settings"><code>chrome.proxy.settings</code></a>. +for example, for + $ref:proxy.settings. </p> <h2 id="ChromeSetting">Chrome settings</h2> diff --git a/chrome/common/extensions/docs/templates/intros/webRequest.html b/chrome/common/extensions/docs/templates/intros/webRequest.html index 9bbcb7f..8dc5ae0 100644 --- a/chrome/common/extensions/docs/templates/intros/webRequest.html +++ b/chrome/common/extensions/docs/templates/intros/webRequest.html @@ -183,15 +183,15 @@ depends on the specific event type as well as the content of <p>If the optional <code>opt_extraInfoSpec</code> array contains the string <code>'blocking'</code> (only allowed for specific events), the callback function is handled synchronously. That means that the request is blocked until -the callback function returns. In this case, the callback can return a <a - href="#type-BlockingResponse">BlockingResponse</a> that determines the further +the callback function returns. In this case, the callback can return a + $ref:webRequest.BlockingResponse that determines the further life cycle of the request. Depending on the context, this response allows cancelling or redirecting a request (<code>onBeforeRequest</code>), cancelling a request or modifying headers (<code>onBeforeSendHeaders</code>, <code>onHeadersReceived</code>), or providing authentication credentials (<code>onAuthRequired</code>).</p> -<p>The <a href="#type-RequestFilter">RequestFilter</a> +<p>The $ref:webRequest.RequestFilter <code>filter</code> allows limiting the requests for which events are triggered in various dimensions: <dl> @@ -202,7 +202,7 @@ triggered in various dimensions: <dd>Request types such as <code>main_frame</code> (a document that is loaded for a top-level frame), <code>sub_frame</code> (a document that is loaded for an embedded frame), and <code>image</code> (an image on a web site). - See <a href="#type-RequestFilter">RequestFilter</a>.</dd> + See $ref:webRequest.RequestFilter.</dd> <dt>Tab ID</dt> <dd>The identifier for one tab.</dd> <dt>Window ID</dt> diff --git a/chrome/common/extensions/docs/templates/intros/windows.html b/chrome/common/extensions/docs/templates/intros/windows.html index 2b38b65..87e1c1b 100644 --- a/chrome/common/extensions/docs/templates/intros/windows.html +++ b/chrome/common/extensions/docs/templates/intros/windows.html @@ -43,7 +43,7 @@ different from the topmost or focused window. creates a few tabs or windows from a single HTML file, and that the HTML file contains a call to -<a href="tabs.html#method-getSelected">chrome.tabs.getSelected</a>. +$ref:tabs.query. The current window is the window that contains the page that made the call, no matter what the topmost window is. </p> diff --git a/chrome/common/extensions/docs/templates/private/event.html b/chrome/common/extensions/docs/templates/private/event.html index 100e8b4..b9443de 100644 --- a/chrome/common/extensions/docs/templates/private/event.html +++ b/chrome/common/extensions/docs/templates/private/event.html @@ -8,7 +8,7 @@ {{{description}}} </p>{{/description}} {{?supportsRules}} - <p>See <a href="events.html#method-Event-addRules"><code>chrome.events.Event.addRules()</code></a>.</p> + <p>See $ref:events.Event.addRules.</p> {{/supportsRules}} {{?conditions}} <h4>Supported conditions</h4> |