diff options
83 files changed, 459 insertions, 248 deletions
diff --git a/chrome/browser/extensions/extension_history_api.cc b/chrome/browser/extensions/extension_history_api.cc index 7edbf14..1614a80 100644 --- a/chrome/browser/extensions/extension_history_api.cc +++ b/chrome/browser/extensions/extension_history_api.cc @@ -49,8 +49,10 @@ void GetVisitInfoDictionary(const history::VisitRow& row, value->SetReal(keys::kVisitTime, MilliSecondsFromTime(row.visit_time)); value->SetString(keys::kReferringVisitId, Int64ToString(row.referring_visit)); - value->SetInteger(keys::kTransition, - row.transition && PageTransition::CORE_MASK); + + const char* trans = PageTransition::CoreTransitionString(row.transition); + DCHECK(trans) << "Invalid transition."; + value->SetString(keys::kTransition, trans); } void AddVisitNode(const history::VisitRow& row, ListValue* list) { diff --git a/chrome/browser/extensions/extension_history_api.h b/chrome/browser/extensions/extension_history_api.h index 184fbb2..71bb9be 100644 --- a/chrome/browser/extensions/extension_history_api.h +++ b/chrome/browser/extensions/extension_history_api.h @@ -96,7 +96,7 @@ class GetVisitsHistoryFunction : public HistoryFunctionWithCallback { public: // Override HistoryFunction. virtual bool RunAsyncImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("experimental.history.getVisits"); + DECLARE_EXTENSION_FUNCTION_NAME("history.getVisits"); // Callback for the history function to provide results. void QueryComplete(HistoryService::Handle request_service, @@ -108,7 +108,7 @@ class GetVisitsHistoryFunction : public HistoryFunctionWithCallback { class SearchHistoryFunction : public HistoryFunctionWithCallback { public: virtual bool RunAsyncImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("experimental.history.search"); + DECLARE_EXTENSION_FUNCTION_NAME("history.search"); // Callback for the history function to provide results. void SearchComplete(HistoryService::Handle request_handle, @@ -118,13 +118,13 @@ class SearchHistoryFunction : public HistoryFunctionWithCallback { class AddUrlHistoryFunction : public HistoryFunction { public: virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("experimental.history.addUrl"); + DECLARE_EXTENSION_FUNCTION_NAME("history.addUrl"); }; class DeleteAllHistoryFunction : public HistoryFunctionWithCallback { public: virtual bool RunAsyncImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("experimental.history.deleteAll"); + DECLARE_EXTENSION_FUNCTION_NAME("history.deleteAll"); // Callback for the history service to acknowledge deletion. void DeleteComplete(); @@ -134,13 +134,13 @@ class DeleteAllHistoryFunction : public HistoryFunctionWithCallback { class DeleteUrlHistoryFunction : public HistoryFunction { public: virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("experimental.history.deleteUrl"); + DECLARE_EXTENSION_FUNCTION_NAME("history.deleteUrl"); }; class DeleteRangeHistoryFunction : public HistoryFunctionWithCallback { public: virtual bool RunAsyncImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("experimental.history.deleteRange"); + DECLARE_EXTENSION_FUNCTION_NAME("history.deleteRange"); // Callback for the history service to acknowledge deletion. void DeleteComplete(); diff --git a/chrome/browser/extensions/extension_history_api_constants.cc b/chrome/browser/extensions/extension_history_api_constants.cc index 4abb406..927f76e 100644 --- a/chrome/browser/extensions/extension_history_api_constants.cc +++ b/chrome/browser/extensions/extension_history_api_constants.cc @@ -26,8 +26,8 @@ const wchar_t kUrlsKey[] = L"urls"; const wchar_t kVisitId[] = L"visitId"; const wchar_t kVisitTime[] = L"visitTime"; -const char kOnVisited[] = "experimental.history.onVisited"; -const char kOnVisitRemoved[] = "experimental.history.onVisitRemoved"; +const char kOnVisited[] = "history.onVisited"; +const char kOnVisitRemoved[] = "history.onVisitRemoved"; const char kInvalidIdError[] = "History item id is invalid."; const char kInvalidUrlError[] = "Url is invalid."; diff --git a/chrome/browser/extensions/extension_history_apitest.cc b/chrome/browser/extensions/extension_history_apitest.cc index 5dc3811..8124a18 100644 --- a/chrome/browser/extensions/extension_history_apitest.cc +++ b/chrome/browser/extensions/extension_history_apitest.cc @@ -9,9 +9,6 @@ // Flaky, http://crbug.com/26296. IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FLAKY_History) { - CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableExperimentalExtensionApis); - host_resolver()->AddRule("www.a.com", "127.0.0.1"); host_resolver()->AddRule("www.b.com", "127.0.0.1"); StartHTTPServer(); diff --git a/chrome/browser/extensions/extension_override_apitest.cc b/chrome/browser/extensions/extension_override_apitest.cc index a7a66b7..fd52440 100644 --- a/chrome/browser/extensions/extension_override_apitest.cc +++ b/chrome/browser/extensions/extension_override_apitest.cc @@ -3,11 +3,29 @@ // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" +#include "chrome/test/ui_test_utils.h" -IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Overrides) { - // The first pass response is the creation of a new tab. - ASSERT_TRUE(RunExtensionTest("override")) << message_; +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OverrideNewtab) { + ASSERT_TRUE(RunExtensionTest("override/newtab")) << message_; + { + ResultCatcher catcher; + // Navigate to the new tab page. The overridden new tab page + // will call chrome.test.notifyPass() . + ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab/")); + ASSERT_TRUE(catcher.GetNextResult()); + } - // TODO(erikkay) load a second override and verify behavior, then unload - // the first and verify behavior, etc. + // TODO(erikkay) Load a second extension with the same override. + // Verify behavior, then unload the first and verify behavior, etc. +} + +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OverrideHistory) { + ASSERT_TRUE(RunExtensionTest("override/history")) << message_; + { + ResultCatcher catcher; + // Navigate to the history page. The overridden history page + // will call chrome.test.notifyPass() . + ui_test_utils::NavigateToURL(browser(), GURL("chrome://history/")); + ASSERT_TRUE(catcher.GetNextResult()); + } } diff --git a/chrome/browser/extensions/permissions_apitest.cc b/chrome/browser/extensions/permissions_apitest.cc index 5554f82..55be326 100644 --- a/chrome/browser/extensions/permissions_apitest.cc +++ b/chrome/browser/extensions/permissions_apitest.cc @@ -29,3 +29,11 @@ IN_PROC_BROWSER_TEST_F(ExperimentalApiTest, PermissionsSucceed) { ASSERT_TRUE(RunExtensionTest("permissions/enabled")) << message_; } +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ExperimentalPermissionsFail) { + // At the time this test is being created, there is no experimental + // function that will not be graduating soon, and does not require a + // tab id as an argument. So, we need the tab permission to get + // a tab id. + ASSERT_TRUE(RunExtensionTest("permissions/experimental_disabled")) + << message_; +} diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index c47ca22..b9832d8 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -217,6 +217,7 @@ 'common/native_window_notification_source.h', 'common/owned_widget_gtk.cc', 'common/owned_widget_gtk.h', + 'common/page_transition_types.cc', 'common/page_transition_types.h', 'common/page_zoom.h', 'common/platform_util.h', diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 50d1491..f9a8b3b 100755 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -1758,7 +1758,7 @@ ] }, { - "namespace": "experimental.history", + "namespace": "history", "types": [ { "id": "HistoryItem", @@ -1782,7 +1782,11 @@ "visitId": {"type": "string", "description": "The unique identifier for this visit."}, "visitTime": {"type": "number", "optional": true, "description": "When this visit occurred, represented in milliseconds since the epoch."}, "referringVisitId": {"type": "string", "description": "The visit_id of the referrer."}, - "transition": {"type": "integer", "minimum": 0, "maximum": 10, "description": "The <a href='#transition_types'>transition type</a> for this visit from its referrer."} + "transition": { + "type": "string", + "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], + "description": "The <a href='#transition_types'>transition type</a> for this visit from its referrer." + } } } ], @@ -1817,6 +1821,7 @@ "description": "Retrieve information about visits to a URL.", "parameters": [ { + "name": "details", "type": "object", "properties": { "url": {"type": "string", "description": "The URL for which to retrieve visit information. It must be in the format as returned from a call to history.search."} @@ -1834,9 +1839,10 @@ { "name": "addUrl", "type": "function", - "description": "Adds a URL to the history at the current time with a <a href='#transition_types'>transition type</a> of LINK.", + "description": "Adds a URL to the history at the current time with a <a href='#transition_types'>transition type</a> of \"link\".", "parameters": [ { + "name": "details", "type": "object", "properties": { "url": {"type": "string", "description": "The URL to add."} @@ -1850,6 +1856,7 @@ "description": "Removes all occurrences of the given URL from the history.", "parameters": [ { + "name": "details", "type": "object", "properties": { "url": {"type": "string", "description": "The URL to remove."} @@ -1863,6 +1870,7 @@ "description": "Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.", "parameters": [ { + "name": "range", "type": "object", "properties": { "startTime": { "type": "number", "description": "Items added to history after this date, represented in milliseconds since the epoch." }, diff --git a/chrome/common/extensions/docs/api_index.html b/chrome/common/extensions/docs/api_index.html index effbedb..9b2a5f8 100644 --- a/chrome/common/extensions/docs/api_index.html +++ b/chrome/common/extensions/docs/api_index.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> @@ -280,7 +281,7 @@ Here are the supported chrome.* APIs: </p> <ul> - <li><a href="bookmarks.html" js="">bookmarks</a></li><li><a href="browserAction.html" js="">browserAction</a></li><li><a href="extension.html" js="">extension</a></li><li><a href="i18n.html" js="">i18n</a></li><li><a href="pageAction.html" js="">pageAction</a></li><li><a href="tabs.html" js="">tabs</a></li><li><a href="windows.html" js="">windows</a></li> + <li><a href="bookmarks.html" js="">bookmarks</a></li><li><a href="browserAction.html" js="">browserAction</a></li><li><a href="extension.html" js="">extension</a></li><li><a href="history.html" js="">history</a></li><li><a href="i18n.html" js="">i18n</a></li><li><a href="pageAction.html" js="">pageAction</a></li><li><a href="tabs.html" js="">tabs</a></li><li><a href="windows.html" js="">windows</a></li> </ul> <h2 id="experimental">Experimental APIs</h2> diff --git a/chrome/common/extensions/docs/api_other.html b/chrome/common/extensions/docs/api_other.html index 8681a86..55cf6ca 100644 --- a/chrome/common/extensions/docs/api_other.html +++ b/chrome/common/extensions/docs/api_other.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/autoupdate.html b/chrome/common/extensions/docs/autoupdate.html index 2544c2b..cee4da5 100644 --- a/chrome/common/extensions/docs/autoupdate.html +++ b/chrome/common/extensions/docs/autoupdate.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/background_pages.html b/chrome/common/extensions/docs/background_pages.html index 061d274..1522f26 100644 --- a/chrome/common/extensions/docs/background_pages.html +++ b/chrome/common/extensions/docs/background_pages.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/bookmarks.html b/chrome/common/extensions/docs/bookmarks.html index 6401670..011feeb 100644 --- a/chrome/common/extensions/docs/bookmarks.html +++ b/chrome/common/extensions/docs/bookmarks.html @@ -145,6 +145,7 @@ <ul> <li class="leftNavSelected">Bookmarks</li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/browserAction.html b/chrome/common/extensions/docs/browserAction.html index 16cddfa..f73c836 100644 --- a/chrome/common/extensions/docs/browserAction.html +++ b/chrome/common/extensions/docs/browserAction.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/content_scripts.html b/chrome/common/extensions/docs/content_scripts.html index 04ab106..8796370 100644 --- a/chrome/common/extensions/docs/content_scripts.html +++ b/chrome/common/extensions/docs/content_scripts.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/devguide.html b/chrome/common/extensions/docs/devguide.html index ad58f84..43fd3fc 100644 --- a/chrome/common/extensions/docs/devguide.html +++ b/chrome/common/extensions/docs/devguide.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/docs.html b/chrome/common/extensions/docs/docs.html index a630af4..ffb51c3 100644 --- a/chrome/common/extensions/docs/docs.html +++ b/chrome/common/extensions/docs/docs.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/events.html b/chrome/common/extensions/docs/events.html index da852b9..0d9df92 100644 --- a/chrome/common/extensions/docs/events.html +++ b/chrome/common/extensions/docs/events.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li class="leftNavSelected">Events</li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/experimental.clipboard.html b/chrome/common/extensions/docs/experimental.clipboard.html index 303c711..cca046e 100644 --- a/chrome/common/extensions/docs/experimental.clipboard.html +++ b/chrome/common/extensions/docs/experimental.clipboard.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/experimental.contextMenu.html b/chrome/common/extensions/docs/experimental.contextMenu.html index 3599eb3..ad5793a 100644 --- a/chrome/common/extensions/docs/experimental.contextMenu.html +++ b/chrome/common/extensions/docs/experimental.contextMenu.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/experimental.html b/chrome/common/extensions/docs/experimental.html index 354a741..8b52636 100644 --- a/chrome/common/extensions/docs/experimental.html +++ b/chrome/common/extensions/docs/experimental.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> @@ -258,7 +259,11 @@ on the following experimental APIs: </p> <ul> - <li><a href="experimental.clipboard.html" js="">experimental.clipboard</a></li><li><a href="experimental.contextMenu.html" js="">experimental.contextMenu</a></li><li><a href="experimental.history.html" js="">experimental.history</a></li><li><a href="experimental.infobars.html" js="">experimental.infobars</a></li><li><a href="experimental.processes.html" js="">experimental.processes</a></li> + <li> + <a href="experimental.clipboard.html">experimental.clipboard</a></li><li> + <a href="experimental.contextMenu.html">experimental.contextMenu</a></li><li> + <a href="experimental.infobars.html">experimental.infobars</a></li><li> + <a href="experimental.processes.html">experimental.processes</a></li> </ul> <p class="caution"> diff --git a/chrome/common/extensions/docs/experimental.infobars.html b/chrome/common/extensions/docs/experimental.infobars.html index a15eb83..db8a82c 100644 --- a/chrome/common/extensions/docs/experimental.infobars.html +++ b/chrome/common/extensions/docs/experimental.infobars.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/experimental.processes.html b/chrome/common/extensions/docs/experimental.processes.html index ec63518..226ea0d 100644 --- a/chrome/common/extensions/docs/experimental.processes.html +++ b/chrome/common/extensions/docs/experimental.processes.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/extension.html b/chrome/common/extensions/docs/extension.html index f4ba4dd..113b81a 100644 --- a/chrome/common/extensions/docs/extension.html +++ b/chrome/common/extensions/docs/extension.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/external_extensions.html b/chrome/common/extensions/docs/external_extensions.html index 57dc10d..ce832c3 100644 --- a/chrome/common/extensions/docs/external_extensions.html +++ b/chrome/common/extensions/docs/external_extensions.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/faq.html b/chrome/common/extensions/docs/faq.html index 7c5a86d..a76fd86 100644 --- a/chrome/common/extensions/docs/faq.html +++ b/chrome/common/extensions/docs/faq.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/getstarted.html b/chrome/common/extensions/docs/getstarted.html index 0ab221c..769a212 100644 --- a/chrome/common/extensions/docs/getstarted.html +++ b/chrome/common/extensions/docs/getstarted.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/experimental.history.html b/chrome/common/extensions/docs/history.html index 85a2397..be98deb 100644 --- a/chrome/common/extensions/docs/experimental.history.html +++ b/chrome/common/extensions/docs/history.html @@ -15,7 +15,7 @@ </script> <script type="text/javascript" src="js/api_page_generator.js"></script> <script type="text/javascript" src="js/bootstrap.js"></script> - <title>chrome.experimental.history - Google Chrome Extensions - Google Code</title></head><body> <div id="gc-container" class="labs"> + <title>chrome.history - Google Chrome Extensions - Google Code</title></head><body> <div id="gc-container" class="labs"> <div id="devModeWarning"> You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files. </div> @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li class="leftNavSelected">History</li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> @@ -194,7 +195,7 @@ <div class="g-unit" id="gc-pagecontent"> <div id="pageTitle"> - <h1 class="page_title">chrome.experimental.history</h1> + <h1 class="page_title">chrome.history</h1> </div> <!-- TABLE OF CONTENTS --> <div id="toc"> @@ -216,7 +217,7 @@ </ol> </li> <li> - <a href="#apiReference">API reference: chrome.experimental.history</a> + <a href="#apiReference">API reference: chrome.history</a> <ol> <li style="display: none; "> <a href="#properties">Properties</a> @@ -273,8 +274,13 @@ <!-- STATIC CONTENT PLACEHOLDER --> <div id="static"><!-- BEGIN AUTHORED CONTENT --> <p id="classSummary"> -For information on how to use experimental APIs, -see the <a href="experimental.html">chrome.experimental.* APIs</a> page. +Use the <code>chrome.history</code> module to interact with the +browser's record of visited pages. You can add, remove, and query +for URLs in the browser's history. + +To override the history page with your own version, see +<a href="override.html">Override Pages</a>. + </p> <h2 id="transition_types">Transition types</h2> @@ -285,55 +291,42 @@ how the browser navigated to a particular URL on a particular visit. For example, if a user visits a page by clicking a link on another page, -the transition type is LINK. -To be precise, -the type is -<a href="#LINK"><code>chrome.experimental.history.transitionType.LINK</code></a>, -which has an integer value of 0. -</p> - -<p class="note"> -<b>Note:</b> -The spelling of -<code>transitionType</code> changed in -<a href="http://src.chromium.org/viewvc/chrome?view=rev&revision=38850">revision 38850</a>. -Previously, it was <code>transistionType</code>. +the transition type is "link". </p> <p> -The following table describes each transition type defined by -<code>chrome.experimental.history.transitionType</code>. +The following table describes each transition type. </p> <table> <tbody><tr> - <th> Transition type </th> <th> Value </th> <th> Description </th> + <th> Transition type </th> <th> Description </th> </tr> -<tr id="LINK"> - <td>LINK</td> <td>0</td> +<tr id="tt_link"> + <td>"link"</td> <td> The user got to this page by clicking a link on another page. </td> </tr> -<tr id="TYPED"> - <td>TYPED</td> <td>1</td> +<tr id="tt_typed"> + <td>"typed"</td> <td> The user got this page by typing the URL in the address bar. Also used for other explicit navigation actions. - See also <a href="#GENERATED">GENERATED</a>, + See also <a href="#tt_generated">generated</a>, which is used for cases where the user selected a choice that didn't look at all like a URL. </td> </tr> -<tr id="AUTO_BOOKMARK"> - <td>AUTO_BOOKMARK</td><td>2</td> +<tr id="tt_auto_bookmark"> + <td>"auto_bookmark"</td> <td> The user got to this page through a suggestion in the UI — for example, through a menu item. </td> </tr> -<tr id="AUTO_SUBFRAME"> - <td>AUTO_SUBFRAME</td><td>3</td> +<tr id="tt_auto_subframe"> + <td>"auto_subframe"</td> <td> Subframe navigation. This is any content that is automatically @@ -343,11 +336,11 @@ The following table describes each transition type defined by those ad URLs have this transition type. The user may not even realize the content in these pages is a separate frame, and so may not care about the URL - (see also <a href="#MANUAL_SUBFRAME">MANUAL_SUBFRAME</a>). + (see also <a href="#tt_manual_subframe">manual_subframe</a>). </td> </tr> -<tr id="MANUAL_SUBFRAME"> - <td>MANUAL_SUBFRAME</td><td>4</td> +<tr id="tt_manual_subframe"> + <td>"manual_subframe"</td> <td> For subframe navigations that are explicitly requested by the user and generate new navigation entries in the back/forward list. @@ -357,26 +350,26 @@ The following table describes each transition type defined by the requested frame was loaded. </td> </tr> -<tr id="GENERATED"> - <td>GENERATED</td><td>5</td> +<tr id="tt_generated"> + <td>"generated"</td> <td> The user got to this page by typing in the address bar and selecting an entry that did not look like a URL. For example, a match might have the URL of a Google search result page, but it might appear to the user as "Search Google for ...". - These are not quite the same as <a href="#TYPED">TYPED</a> navigations + These are not quite the same as <a href="#tt_typed">typed</a> navigations because the user didn't type or see the destination URL. - See also <a href="#KEYWORD">KEYWORD</a>. + See also <a href="#tt_keyword">keyword</a>. </td> </tr> -<tr id="START_PAGE"> - <td>START_PAGE</td><td>6</td> +<tr id="tt_start_page"> + <td>"start_page"</td> <td> The page was specified in the command line or is the start page. </td> </tr> -<tr id="FORM_SUBMIT"> - <td>FORM_SUBMIT</td><td>7</td> +<tr id="tt_form_submit"> + <td>"form_submit"</td> <td> The user filled out values in a form and submitted it. Note that in some situations — @@ -384,8 +377,8 @@ The following table describes each transition type defined by submitting a form does not result in this transition type. </td> </tr> -<tr id="RELOAD"> - <td>RELOAD</td><td>8</td> +<tr id="tt_reload"> + <td>"reload"</td> <td> The user reloaded the page, either by clicking the reload button @@ -393,20 +386,20 @@ The following table describes each transition type defined by Session restore and Reopen closed tab use this transition type, too. </td> </tr> -<tr id="KEYWORD"> - <td>KEYWORD</td><td>9</td> +<tr id="tt_keyword"> + <td>"keyword"</td> <td> The URL was generated from a replaceable keyword other than the default search provider. See also - <a href="#KEYWORD_GENERATED">KEYWORD_GENERATED</a>. + <a href="#tt_keyword_generated">keyword_generated</a>. </td> </tr> -<tr id="KEYWORD_GENERATED"> - <td>KEYWORD_GENERATED</td><td>10</td> +<tr id="tt_keyword_generated"> + <td>"keyword_generated"</td> <td> Corresponds to a visit generated for a keyword. - See also <a href="#KEYWORD">KEYWORD</a>. + See also <a href="#tt_keyword">keyword</a>. </td> </tr> </tbody></table> @@ -424,7 +417,7 @@ For an example of using this API, see the <!-- API PAGE --> <div class="apiPage"> <a name="apiReference"></a> - <h2>API reference: chrome.experimental.history</h2> + <h2>API reference: chrome.history</h2> <!-- PROPERTIES --> <div class="apiGroup" style="display: none; "> @@ -456,12 +449,12 @@ For an example of using this API, see the <div class="summary"><span style="display: none; ">void</span> <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.history.addUrl</span>(<span class="null"><span style="display: none; ">, </span><span>object</span> - <var><span>undefined</span></var></span>)</div> + <span>chrome.history.addUrl</span>(<span class="null"><span style="display: none; ">, </span><span>object</span> + <var><span>details</span></var></span>)</div> <div class="description"> <p class="todo" style="display: none; ">Undocumented.</p> - <p>Adds a URL to the history at the current time with a <a href="#transition_types">transition type</a> of LINK.</p> + <p>Adds a URL to the history at the current time with a <a href="#transition_types">transition type</a> of "link".</p> <!-- PARAMETERS --> <h4>Parameters</h4> @@ -469,7 +462,7 @@ For an example of using this API, see the <div> <div> <dt> - <var style="display: none; ">paramName</var> + <var>details</var> <em> <!-- TYPE --> @@ -591,7 +584,7 @@ For an example of using this API, see the <div class="summary"><span style="display: none; ">void</span> <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.history.deleteAll</span>(<span class="null"><span style="display: none; ">, </span><span>function</span> + <span>chrome.history.deleteAll</span>(<span class="null"><span style="display: none; ">, </span><span>function</span> <var><span>callback</span></var></span>)</div> <div class="description"> @@ -688,8 +681,8 @@ For an example of using this API, see the <div class="summary"><span style="display: none; ">void</span> <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.history.deleteRange</span>(<span class="null"><span style="display: none; ">, </span><span>object</span> - <var><span>undefined</span></var></span><span class="null"><span>, </span><span>function</span> + <span>chrome.history.deleteRange</span>(<span class="null"><span style="display: none; ">, </span><span>object</span> + <var><span>range</span></var></span><span class="null"><span>, </span><span>function</span> <var><span>callback</span></var></span>)</div> <div class="description"> @@ -702,7 +695,7 @@ For an example of using this API, see the <div> <div> <dt> - <var style="display: none; ">paramName</var> + <var>range</var> <em> <!-- TYPE --> @@ -908,8 +901,8 @@ For an example of using this API, see the <div class="summary"><span style="display: none; ">void</span> <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.history.deleteUrl</span>(<span class="null"><span style="display: none; ">, </span><span>object</span> - <var><span>undefined</span></var></span>)</div> + <span>chrome.history.deleteUrl</span>(<span class="null"><span style="display: none; ">, </span><span>object</span> + <var><span>details</span></var></span>)</div> <div class="description"> <p class="todo" style="display: none; ">Undocumented.</p> @@ -921,7 +914,7 @@ For an example of using this API, see the <div> <div> <dt> - <var style="display: none; ">paramName</var> + <var>details</var> <em> <!-- TYPE --> @@ -1043,8 +1036,8 @@ For an example of using this API, see the <div class="summary"><span style="display: none; ">void</span> <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.history.getVisits</span>(<span class="null"><span style="display: none; ">, </span><span>object</span> - <var><span>undefined</span></var></span><span class="null"><span>, </span><span>function</span> + <span>chrome.history.getVisits</span>(<span class="null"><span style="display: none; ">, </span><span>object</span> + <var><span>details</span></var></span><span class="null"><span>, </span><span>function</span> <var><span>callback</span></var></span>)</div> <div class="description"> @@ -1057,7 +1050,7 @@ For an example of using this API, see the <div> <div> <dt> - <var style="display: none; ">paramName</var> + <var>details</var> <em> <!-- TYPE --> @@ -1224,7 +1217,7 @@ For an example of using this API, see the <span> array of <span><span> <span> - <a href="experimental.history.html#type-VisitItem">VisitItem</a> + <a href="history.html#type-VisitItem">VisitItem</a> </span> <span style="display: none; "> <span> @@ -1272,7 +1265,7 @@ For an example of using this API, see the <div class="summary"><span style="display: none; ">void</span> <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.history.search</span>(<span class="null"><span style="display: none; ">, </span><span>object</span> + <span>chrome.history.search</span>(<span class="null"><span style="display: none; ">, </span><span>object</span> <var><span>query</span></var></span><span class="null"><span>, </span><span>function</span> <var><span>callback</span></var></span>)</div> @@ -1576,7 +1569,7 @@ For an example of using this API, see the <span> array of <span><span> <span> - <a href="experimental.history.html#type-HistoryItem">HistoryItem</a> + <a href="history.html#type-HistoryItem">HistoryItem</a> </span> <span style="display: none; "> <span> @@ -1634,7 +1627,7 @@ For an example of using this API, see the <div class="summary"> <!-- Note: intentionally longer 80 columns --> - <span class="subdued">chrome.experimental.history.</span><span>onVisitRemoved</span><span class="subdued">.addListener</span>(function(<span>object removed</span>) <span class="subdued">{...}</span>); + <span class="subdued">chrome.history.</span><span>onVisitRemoved</span><span class="subdued">.addListener</span>(function(<span>object removed</span>) <span class="subdued">{...}</span>); </div> <div class="description"> @@ -1789,7 +1782,7 @@ For an example of using this API, see the <div class="summary"> <!-- Note: intentionally longer 80 columns --> - <span class="subdued">chrome.experimental.history.</span><span>onVisited</span><span class="subdued">.addListener</span>(function(<span>HistoryItem result</span>) <span class="subdued">{...}</span>); + <span class="subdued">chrome.history.</span><span>onVisited</span><span class="subdued">.addListener</span>(function(<span>HistoryItem result</span>) <span class="subdued">{...}</span>); </div> <div class="description"> @@ -1811,7 +1804,7 @@ For an example of using this API, see the <span class="optional" style="display: none; ">optional</span> <span id="typeTemplate"> <span> - <a href="experimental.history.html#type-HistoryItem">HistoryItem</a> + <a href="history.html#type-HistoryItem">HistoryItem</a> </span> <span style="display: none; "> <span> @@ -2076,7 +2069,7 @@ For an example of using this API, see the <span style="display: none; "> array of <span><span></span></span> </span> - <span>integer</span> + <span>string</span> </span> </span> ) diff --git a/chrome/common/extensions/docs/hosting.html b/chrome/common/extensions/docs/hosting.html index 1bba11a..1095b26 100644 --- a/chrome/common/extensions/docs/hosting.html +++ b/chrome/common/extensions/docs/hosting.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/i18n-messages.html b/chrome/common/extensions/docs/i18n-messages.html index d997dd2..4b2ce47 100644 --- a/chrome/common/extensions/docs/i18n-messages.html +++ b/chrome/common/extensions/docs/i18n-messages.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/i18n.html b/chrome/common/extensions/docs/i18n.html index af0377f..7d91741 100644 --- a/chrome/common/extensions/docs/i18n.html +++ b/chrome/common/extensions/docs/i18n.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/index.html b/chrome/common/extensions/docs/index.html index 58a2be9..ee90ab4 100644 --- a/chrome/common/extensions/docs/index.html +++ b/chrome/common/extensions/docs/index.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/manifest.html b/chrome/common/extensions/docs/manifest.html index 8b0de00..130c1a2 100644 --- a/chrome/common/extensions/docs/manifest.html +++ b/chrome/common/extensions/docs/manifest.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/match_patterns.html b/chrome/common/extensions/docs/match_patterns.html index e3d5116..05f772e 100644 --- a/chrome/common/extensions/docs/match_patterns.html +++ b/chrome/common/extensions/docs/match_patterns.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/messaging.html b/chrome/common/extensions/docs/messaging.html index e15dcdf..1ae04b4 100644 --- a/chrome/common/extensions/docs/messaging.html +++ b/chrome/common/extensions/docs/messaging.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/npapi.html b/chrome/common/extensions/docs/npapi.html index ca10265..4717629 100644 --- a/chrome/common/extensions/docs/npapi.html +++ b/chrome/common/extensions/docs/npapi.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/options.html b/chrome/common/extensions/docs/options.html index 6b2921b..f473d4b 100644 --- a/chrome/common/extensions/docs/options.html +++ b/chrome/common/extensions/docs/options.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/override.html b/chrome/common/extensions/docs/override.html index 1aba705..e6dd31b 100644 --- a/chrome/common/extensions/docs/override.html +++ b/chrome/common/extensions/docs/override.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> @@ -292,16 +293,20 @@ Override pages are a way to replace a page that Google Chrome provides with an HTML file that your extension provides. An override page usually has CSS and JavaScript code, -in addition to HTML. +in addition to HTML. A single extension can only override +one page. </p> <p> -Currently, the only page you can replace is -the <em>New Tab page</em> — -the page that appears -when the user creates a new tab or window. -</p> +Currently, extensions can replace two pages: +</p><ul> + <li> The <em>New Tab page</em> — + the page that appears when the user creates a new tab or window.</li> + <li> The <em>History page</em> — + the page that appears when the user selects the 'History' menu item.</li> +</ul> +<p></p> <table id="pics"> <tbody><tr> <td> <b>The default New Tab page</b> </td> @@ -317,13 +322,12 @@ when the user creates a new tab or window. </tr> </tbody></table> - <h2 id="manifest">Manifest</h2> <p> -Register your New Tab page in the +Register override pages in the <a href="manifest.html">extension manifest</a> -like this: +using property <code>chrome_url_overrides</code>. For example, the new tabs page can be overridden like this: </p> <pre>{ @@ -335,18 +339,31 @@ like this: ... }</pre> +You can override the history page like this: + +<pre>{ + "name": "My extension", + ... + <b>"chrome_url_overrides": { + "history": "history.html" + }</b>, + ... +}</pre> + +A single extension may only override one page. + <h2 id="tips">Tips</h2> <p> -For an effective New Tab page, follow these guidelines: +For an effective override pages, follow these guidelines: </p> <ul> <li> <p> <b>Make your page quick and small.</b> <br> - Because the New Tab page appears often, - its performance is important. + Users expect built in browser pages to open instantly. Avoid doing things that + may take a long time. For example, avoid synchronous fetches of network or database resources. </p> </li> @@ -368,7 +385,7 @@ For an effective New Tab page, follow these guidelines: </li> <li> <p> - <b>Don't try to emulate the default New Tab page.</b> <br> + <b>Don't try to emulate the default pages.</b> <br> The APIs necessary to create a slightly modified version of the default New Tab page — with top pages, diff --git a/chrome/common/extensions/docs/overview.html b/chrome/common/extensions/docs/overview.html index f58dea7..d3e896b 100644 --- a/chrome/common/extensions/docs/overview.html +++ b/chrome/common/extensions/docs/overview.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/packaging.html b/chrome/common/extensions/docs/packaging.html index bd2259d..d1608fb 100644 --- a/chrome/common/extensions/docs/packaging.html +++ b/chrome/common/extensions/docs/packaging.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/pageAction.html b/chrome/common/extensions/docs/pageAction.html index 10f4b21..269b299 100644 --- a/chrome/common/extensions/docs/pageAction.html +++ b/chrome/common/extensions/docs/pageAction.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/samples.html b/chrome/common/extensions/docs/samples.html index c21cac9..65edd5d 100644 --- a/chrome/common/extensions/docs/samples.html +++ b/chrome/common/extensions/docs/samples.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/static/experimental.html b/chrome/common/extensions/docs/static/experimental.html index 46df0f2..d36ffbe 100644 --- a/chrome/common/extensions/docs/static/experimental.html +++ b/chrome/common/extensions/docs/static/experimental.html @@ -6,7 +6,8 @@ on the following experimental APIs: </p> <ul> - <li jsselect="experimentalAPIs();"><a jsvalues=".href: $this + '.html'" jscontent="$this" href="experimental.history.html" js>experimental.history</a></li> + <li jsselect="experimentalAPIs();"> + <a jsvalues=".href: $this + '.html'" jscontent="$this"></a></li> </ul> <p class="caution"> diff --git a/chrome/common/extensions/docs/static/experimental.history.html b/chrome/common/extensions/docs/static/history.html index 3a968b6..65db709 100644 --- a/chrome/common/extensions/docs/static/experimental.history.html +++ b/chrome/common/extensions/docs/static/history.html @@ -1,7 +1,12 @@ <!-- BEGIN AUTHORED CONTENT --> <p id="classSummary"> -For information on how to use experimental APIs, -see the <a href="experimental.html">chrome.experimental.* APIs</a> page. +Use the <code>chrome.history</code> module to interact with the +browser's record of visited pages. You can add, remove, and query +for URLs in the browser's history. + +To override the history page with your own version, see +<a href="override.html">Override Pages</a>. + </p> <h2 id="transition_types">Transition types</h2> @@ -12,55 +17,42 @@ how the browser navigated to a particular URL on a particular visit. For example, if a user visits a page by clicking a link on another page, -the transition type is LINK. -To be precise, -the type is -<a href="#LINK"><code>chrome.experimental.history.transitionType.LINK</code></a>, -which has an integer value of 0. -</p> - -<p class="note"> -<b>Note:</b> -The spelling of -<code>transitionType</code> changed in -<a href="http://src.chromium.org/viewvc/chrome?view=rev&revision=38850">revision 38850</a>. -Previously, it was <code>transistionType</code>. +the transition type is "link". </p> <p> -The following table describes each transition type defined by -<code>chrome.experimental.history.transitionType</code>. +The following table describes each transition type. </p> <table> <tr> - <th> Transition type </th> <th> Value </th> <th> Description </th> + <th> Transition type </th> <th> Description </th> </tr> -<tr id="LINK"> - <td>LINK</td> <td>0</td> +<tr id="tt_link"> + <td>"link"</td> <td> The user got to this page by clicking a link on another page. </td> </tr> -<tr id="TYPED"> - <td>TYPED</td> <td>1</td> +<tr id="tt_typed"> + <td>"typed"</td> <td> The user got this page by typing the URL in the address bar. Also used for other explicit navigation actions. - See also <a href="#GENERATED">GENERATED</a>, + See also <a href="#tt_generated">generated</a>, which is used for cases where the user selected a choice that didn't look at all like a URL. </td> </tr> -<tr id="AUTO_BOOKMARK"> - <td>AUTO_BOOKMARK</td><td>2</td> +<tr id="tt_auto_bookmark"> + <td>"auto_bookmark"</td> <td> The user got to this page through a suggestion in the UI — for example, through a menu item. </td> </tr> -<tr id="AUTO_SUBFRAME"> - <td>AUTO_SUBFRAME</td><td>3</td> +<tr id="tt_auto_subframe"> + <td>"auto_subframe"</td> <td> Subframe navigation. This is any content that is automatically @@ -70,11 +62,11 @@ The following table describes each transition type defined by those ad URLs have this transition type. The user may not even realize the content in these pages is a separate frame, and so may not care about the URL - (see also <a href="#MANUAL_SUBFRAME">MANUAL_SUBFRAME</a>). + (see also <a href="#tt_manual_subframe">manual_subframe</a>). </td> </tr> -<tr id="MANUAL_SUBFRAME"> - <td>MANUAL_SUBFRAME</td><td>4</td> +<tr id="tt_manual_subframe"> + <td>"manual_subframe"</td> <td> For subframe navigations that are explicitly requested by the user and generate new navigation entries in the back/forward list. @@ -84,26 +76,26 @@ The following table describes each transition type defined by the requested frame was loaded. </td> </tr> -<tr id="GENERATED"> - <td>GENERATED</td><td>5</td> +<tr id="tt_generated"> + <td>"generated"</td> <td> The user got to this page by typing in the address bar and selecting an entry that did not look like a URL. For example, a match might have the URL of a Google search result page, but it might appear to the user as "Search Google for ...". - These are not quite the same as <a href="#TYPED">TYPED</a> navigations + These are not quite the same as <a href="#tt_typed">typed</a> navigations because the user didn't type or see the destination URL. - See also <a href="#KEYWORD">KEYWORD</a>. + See also <a href="#tt_keyword">keyword</a>. </td> </tr> -<tr id="START_PAGE"> - <td>START_PAGE</td><td>6</td> +<tr id="tt_start_page"> + <td>"start_page"</td> <td> The page was specified in the command line or is the start page. </td> </tr> -<tr id="FORM_SUBMIT"> - <td>FORM_SUBMIT</td><td>7</td> +<tr id="tt_form_submit"> + <td>"form_submit"</td> <td> The user filled out values in a form and submitted it. Note that in some situations — @@ -111,8 +103,8 @@ The following table describes each transition type defined by submitting a form does not result in this transition type. </td> </tr> -<tr id="RELOAD"> - <td>RELOAD</td><td>8</td> +<tr id="tt_reload"> + <td>"reload"</td> <td> The user reloaded the page, either by clicking the reload button @@ -120,20 +112,20 @@ The following table describes each transition type defined by Session restore and Reopen closed tab use this transition type, too. </td> </tr> -<tr id="KEYWORD"> - <td>KEYWORD</td><td>9</td> +<tr id="tt_keyword"> + <td>"keyword"</td> <td> The URL was generated from a replaceable keyword other than the default search provider. See also - <a href="#KEYWORD_GENERATED">KEYWORD_GENERATED</a>. + <a href="#tt_keyword_generated">keyword_generated</a>. </td> </tr> -<tr id="KEYWORD_GENERATED"> - <td>KEYWORD_GENERATED</td><td>10</td> +<tr id="tt_keyword_generated"> + <td>"keyword_generated"</td> <td> Corresponds to a visit generated for a keyword. - See also <a href="#KEYWORD">KEYWORD</a>. + See also <a href="#tt_keyword">keyword</a>. </td> </tr> </table> diff --git a/chrome/common/extensions/docs/static/override.html b/chrome/common/extensions/docs/static/override.html index 96b6897..53de45c 100644 --- a/chrome/common/extensions/docs/static/override.html +++ b/chrome/common/extensions/docs/static/override.html @@ -26,16 +26,20 @@ Override pages are a way to replace a page that Google Chrome provides with an HTML file that your extension provides. An override page usually has CSS and JavaScript code, -in addition to HTML. +in addition to HTML. A single extension can only override +one page. </p> <p> -Currently, the only page you can replace is -the <em>New Tab page</em> — -the page that appears -when the user creates a new tab or window. -</p> +Currently, extensions can replace two pages: +<ul> + <li> The <em>New Tab page</em> — + the page that appears when the user creates a new tab or window.</li> + <li> The <em>History page</em> — + the page that appears when the user selects the 'History' menu item.</li> +</ul> +</p> <table id="pics"> <tr> <td> <b>The default New Tab page</b> </td> @@ -55,13 +59,12 @@ when the user creates a new tab or window. </tr> </table> - <h2 id="manifest">Manifest</h2> <p> -Register your New Tab page in the +Register override pages in the <a href="manifest.html">extension manifest</a> -like this: +using property <code>chrome_url_overrides</code>. For example, the new tabs page can be overridden like this: </p> <pre>{ @@ -73,18 +76,31 @@ like this: ... }</pre> +You can override the history page like this: + +<pre>{ + "name": "My extension", + ... + <b>"chrome_url_overrides": { + "history": "history.html" + }</b>, + ... +}</pre> + +A single extension may only override one page. + <h2 id="tips">Tips</h2> <p> -For an effective New Tab page, follow these guidelines: +For an effective override pages, follow these guidelines: </p> <ul> <li> <p> <b>Make your page quick and small.</b> <br /> - Because the New Tab page appears often, - its performance is important. + Users expect built in browser pages to open instantly. Avoid doing things that + may take a long time. For example, avoid synchronous fetches of network or database resources. </p> </li> @@ -106,7 +122,7 @@ For an effective New Tab page, follow these guidelines: </li> <li> <p> - <b>Don't try to emulate the default New Tab page.</b> <br /> + <b>Don't try to emulate the default pages.</b> <br /> The APIs necessary to create a slightly modified version of the default New Tab page — with top pages, diff --git a/chrome/common/extensions/docs/tabs.html b/chrome/common/extensions/docs/tabs.html index e54d4c6..fa722bc 100644 --- a/chrome/common/extensions/docs/tabs.html +++ b/chrome/common/extensions/docs/tabs.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li class="leftNavSelected">Tabs</li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/template/api_template.html b/chrome/common/extensions/docs/template/api_template.html index c90dde5..a00ab02 100644 --- a/chrome/common/extensions/docs/template/api_template.html +++ b/chrome/common/extensions/docs/template/api_template.html @@ -132,6 +132,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/themes.html b/chrome/common/extensions/docs/themes.html index acf558d..0c90700 100644 --- a/chrome/common/extensions/docs/themes.html +++ b/chrome/common/extensions/docs/themes.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/tut_analytics.html b/chrome/common/extensions/docs/tut_analytics.html index ed08c41..3baa8a4 100644 --- a/chrome/common/extensions/docs/tut_analytics.html +++ b/chrome/common/extensions/docs/tut_analytics.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/tut_debugging.html b/chrome/common/extensions/docs/tut_debugging.html index 1a30310..ebd33c5 100644 --- a/chrome/common/extensions/docs/tut_debugging.html +++ b/chrome/common/extensions/docs/tut_debugging.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/tut_oauth.html b/chrome/common/extensions/docs/tut_oauth.html index 7cf4e91..b6146ac 100644 --- a/chrome/common/extensions/docs/tut_oauth.html +++ b/chrome/common/extensions/docs/tut_oauth.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/tutorials.html b/chrome/common/extensions/docs/tutorials.html index c2d9de7..c1d1e6c 100644 --- a/chrome/common/extensions/docs/tutorials.html +++ b/chrome/common/extensions/docs/tutorials.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/docs/windows.html b/chrome/common/extensions/docs/windows.html index 7241979..6c183f0 100644 --- a/chrome/common/extensions/docs/windows.html +++ b/chrome/common/extensions/docs/windows.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li class="leftNavSelected">Windows</li> </ul> diff --git a/chrome/common/extensions/docs/xhr.html b/chrome/common/extensions/docs/xhr.html index 96c040e..0cbe660 100644 --- a/chrome/common/extensions/docs/xhr.html +++ b/chrome/common/extensions/docs/xhr.html @@ -145,6 +145,7 @@ <ul> <li><a href="bookmarks.html">Bookmarks</a></li> <li><a href="events.html">Events</a></li> + <li><a href="history.html">History</a></li> <li><a href="tabs.html">Tabs</a></li> <li><a href="windows.html">Windows</a></li> </ul> diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 7deff53..c583bc9 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -106,13 +106,15 @@ const char* Extension::kBookmarkPermission = "bookmarks"; const char* Extension::kNotificationPermission = "notifications"; const char* Extension::kExperimentalPermission = "experimental"; const char* Extension::kUnlimitedStoragePermission = "unlimited_storage"; +const char* Extension::kHistoryPermission = "history"; const char* Extension::kPermissionNames[] = { Extension::kTabPermission, Extension::kBookmarkPermission, Extension::kNotificationPermission, Extension::kExperimentalPermission, - Extension::kUnlimitedStoragePermission + Extension::kUnlimitedStoragePermission, + Extension::kHistoryPermission }; const size_t Extension::kNumPermissions = arraysize(Extension::kPermissionNames); @@ -1371,12 +1373,11 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, for (DictionaryValue::key_iterator iter = overrides->begin_keys(); iter != overrides->end_keys(); ++iter) { std::string page = WideToUTF8(*iter); - // For now, only allow the new tab page. Others will work when we remove - // this check, but let's keep it simple for now. - // TODO(erikkay) enable other pages as well std::string val; + // Restrict override pages to a list of supported URLs. if ((page != chrome::kChromeUINewTabHost && - page != chrome::kChromeUIBookmarksHost) || + page != chrome::kChromeUIBookmarksHost && + page != chrome::kChromeUIHistoryHost) || !overrides->GetStringWithoutPathExpansion(*iter, &val)) { *error = errors::kInvalidChromeURLOverrides; return false; @@ -1384,6 +1385,12 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, // Replace the entry with a fully qualified chrome-extension:// URL. chrome_url_overrides_[page] = GetResourceURL(val); } + + // An extension may override at most one page. + if (overrides->size() > 1) { + *error = errors::kMultipleOverrides; + return false; + } } if (!CheckAppsAreEnabled(manifest_value_.get(), error) || diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index f4c797e..7964052 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -92,6 +92,7 @@ class Extension { static const char* kNotificationPermission; static const char* kExperimentalPermission; static const char* kUnlimitedStoragePermission; + static const char* kHistoryPermission; static const char* kPermissionNames[]; static const size_t kNumPermissions; diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc index f28fad1..0afb1255 100644 --- a/chrome/common/extensions/extension_constants.cc +++ b/chrome/common/extensions/extension_constants.cc @@ -190,6 +190,8 @@ const char* kManifestUnreadable = "Manifest file is missing or unreadable."; const char* kMissingFile = "At least one js or css file is required for 'content_scripts[*]'."; +const char* kMultipleOverrides = + "An extension cannot override more than one page."; const char* kInvalidTheme = "Invalid value for 'theme'."; const char* kInvalidThemeImages = diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h index e3f1a0c..7fb1113 100644 --- a/chrome/common/extensions/extension_constants.h +++ b/chrome/common/extensions/extension_constants.h @@ -144,6 +144,7 @@ namespace extension_manifest_errors { extern const char* kManifestParseError; extern const char* kManifestUnreadable; extern const char* kMissingFile; + extern const char* kMultipleOverrides; extern const char* kInvalidUpdateURL; extern const char* kInvalidDefaultLocale; extern const char* kLaunchContainerWithoutURL; diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc index d7a5c2b..37c4696 100644 --- a/chrome/common/extensions/extension_manifests_unittest.cc +++ b/chrome/common/extensions/extension_manifests_unittest.cc @@ -160,3 +160,21 @@ TEST_F(ManifestTest, AppLaunchURL) { EXPECT_EQ(GURL("http://www.google.com/launch.html"), extension->GetFullLaunchURL()); } + +TEST_F(ManifestTest, Override) { + LoadAndExpectError("override_newtab_and_history.json", + errors::kMultipleOverrides); + LoadAndExpectError("override_invalid_page.json", + errors::kInvalidChromeURLOverrides); + + scoped_ptr<Extension> extension; + + extension.reset(LoadAndExpectSuccess("override_new_tab.json")); + EXPECT_EQ(extension->url().spec() + "newtab.html", + extension->GetChromeURLOverrides().find("newtab")->second.spec()); + + extension.reset(LoadAndExpectSuccess("override_history.json")); + EXPECT_EQ(extension->url().spec() + "history.html", + extension->GetChromeURLOverrides().find("history")->second.spec()); + +} diff --git a/chrome/common/page_transition_types.cc b/chrome/common/page_transition_types.cc new file mode 100644 index 0000000..9fb49cd --- /dev/null +++ b/chrome/common/page_transition_types.cc @@ -0,0 +1,22 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/page_transition_types.h" + +const char* PageTransition::CoreTransitionString(Type type) { + switch (type & PageTransition::CORE_MASK) { + case 0: return "link"; + case 1: return "typed"; + case 2: return "auto_bookmark"; + case 3: return "auto_subframe"; + case 4: return "manual_subframe"; + case 5: return "generated"; + case 6: return "start_page"; + case 7: return "form_submit"; + case 8: return "reload"; + case 9: return "keyword"; + case 10: return "keyword_generated"; + } + return NULL; +} diff --git a/chrome/common/page_transition_types.h b/chrome/common/page_transition_types.h index e41734f..bb46006 100644 --- a/chrome/common/page_transition_types.h +++ b/chrome/common/page_transition_types.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -94,7 +94,7 @@ class PageTransition { KEYWORD_GENERATED = 10, // ADDING NEW CORE VALUE? Be sure to update the LAST_CORE and CORE_MASK - // values below. + // values below. Also update CoreTransitionString(). LAST_CORE = KEYWORD_GENERATED, CORE_MASK = 0xFF, @@ -162,6 +162,9 @@ class PageTransition { static int32 GetQualifier(Type type) { return type & QUALIFIER_MASK; } + + // Return a string version of the core type values. + static const char* CoreTransitionString(Type type); }; #endif // CHROME_COMMON_PAGE_TRANSITION_TYPES_H__ diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js index fe8499c..0879e91 100644 --- a/chrome/renderer/resources/extension_process_bindings.js +++ b/chrome/renderer/resources/extension_process_bindings.js @@ -619,21 +619,4 @@ var chrome = chrome || {}; if (!chrome.experimental.accessibility) chrome.experimental.accessibility = {}; - - if (!chrome.experimental.history) - chrome.experimental.history = {}; - - chrome.experimental.history.transitionType = { - LINK: 0, - TYPED: 1, - AUTO_BOOKMARK: 2, - AUTO_SUBFRAME: 3, - MANUAL_SUBFRAME: 4, - GENERATED: 5, - START_PAGE: 6, - FORM_SUBMIT: 7, - RELOAD: 8, - KEYWORD: 9, - KEYWORD_GENERATED: 10 - }; })(); diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js index 5138e93..92fe2e3 100644 --- a/chrome/renderer/resources/renderer_extension_bindings.js +++ b/chrome/renderer/resources/renderer_extension_bindings.js @@ -250,11 +250,11 @@ var chrome = chrome || {}; "experimental.contextMenu", "experimental.extension", "experimental.idle", - "experimental.history", "experimental.infobars", "experimental.metrics", "experimental.popup", "experimental.processes", + "history", "pageAction", "pageActions", "tabs", diff --git a/chrome/test/data/extensions/api_test/history/manifest.json b/chrome/test/data/extensions/api_test/history/manifest.json index b092269..d654b04 100644 --- a/chrome/test/data/extensions/api_test/history/manifest.json +++ b/chrome/test/data/extensions/api_test/history/manifest.json @@ -3,5 +3,5 @@ "version": "0.1", "description": "end-to-end browser test for chrome.history API", "background_page": "test.html", - "permissions": ["experimental", "tabs"] + "permissions": ["history", "tabs"] } diff --git a/chrome/test/data/extensions/api_test/history/test.js b/chrome/test/data/extensions/api_test/history/test.js index 250da5c..f916f5d 100644 --- a/chrome/test/data/extensions/api_test/history/test.js +++ b/chrome/test/data/extensions/api_test/history/test.js @@ -34,12 +34,12 @@ function itemVisitedListener(visited) { }; function removeItemVisitedListener() { - chrome.experimental.history.onVisited.removeListener(itemVisitedListener); + chrome.history.onVisited.removeListener(itemVisitedListener); itemVisitedCallback = null; } function setItemVisitedListener(callback) { - chrome.experimental.history.onVisited.addListener(itemVisitedListener); + chrome.history.onVisited.addListener(itemVisitedListener); itemVisitedCallback = callback; } @@ -59,12 +59,12 @@ function itemRemovedListener(removed) { }; function removeItemRemovedListener() { - chrome.experimental.history.onVisited.removeListener(itemRemovedListener); + chrome.history.onVisited.removeListener(itemRemovedListener); itemRemovedCallback = null; } function setItemRemovedListener(callback) { - chrome.experimental.history.onVisitRemoved.addListener(itemRemovedListener); + chrome.history.onVisitRemoved.addListener(itemRemovedListener); itemRemovedCallback = callback; } @@ -96,7 +96,7 @@ function tabsCompleteListener(tabId, changeInfo) { */ function countItemsInHistory(callback) { var query = {'text': ''}; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { callback(results.length); }); }; @@ -108,7 +108,7 @@ function countItemsInHistory(callback) { */ function populateHistory(urls, callback) { urls.forEach(function(url) { - chrome.experimental.history.addUrl({ 'url': url }); + chrome.history.addUrl({ 'url': url }); }); callback(); }; @@ -117,7 +117,7 @@ chrome.test.runTests([ // All the tests require a blank state to start from. This test is run // first to insure that state can be acheived. function clearHistory() { - chrome.experimental.history.deleteAll(pass(function() { + chrome.history.deleteAll(pass(function() { countItemsInHistory(pass(function(count) { assertEq(0, count); })); @@ -129,7 +129,7 @@ chrome.test.runTests([ function basicSearchTestVerification() { removeItemVisitedListener(); var query = { 'text': '' }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(1, results.length); assertEq(GOOGLE_URL, results[0].url); @@ -139,7 +139,7 @@ chrome.test.runTests([ }; // basicSearch entry point. - chrome.experimental.history.deleteAll(function() { + chrome.history.deleteAll(function() { setItemVisitedListener(basicSearchTestVerification); populateHistory([GOOGLE_URL], function() { }); }); @@ -155,7 +155,7 @@ chrome.test.runTests([ var query = { 'text': '', 'startTime': startDate.getTime(), 'endTime': endDate.getTime() }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(1, results.length); assertEq(GOOGLE_URL, results[0].url); @@ -178,7 +178,7 @@ chrome.test.runTests([ }; // timeScopedSearch entry point. - chrome.experimental.history.deleteAll(function() { + chrome.history.deleteAll(function() { // Set the test callback. setItemVisitedListener(onAddedItem); // Set the start time a few seconds in the past. @@ -189,12 +189,12 @@ chrome.test.runTests([ }, function searchWithIntegerTimes() { - chrome.experimental.history.deleteAll(function() { + chrome.history.deleteAll(function() { // Search with an integer time range. var query = { 'text': '', 'startTime': 0, 'endTime': 12345678 }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(0, results.length); chrome.test.succeed(); }); @@ -216,7 +216,7 @@ chrome.test.runTests([ var query = { 'text': '', 'startTime': startDate.getTime(), 'endTime': endDate.getTime() }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(1, results.length); assertEq(PICASA_URL, results[0].url); @@ -239,7 +239,7 @@ chrome.test.runTests([ }; // timeScopedSearch entry point. - chrome.experimental.history.deleteAll(function() { + chrome.history.deleteAll(function() { // Set the test callback. setItemVisitedListener(onAddedItem); populateHistory([GOOGLE_URL], function() { }); @@ -259,7 +259,7 @@ chrome.test.runTests([ removeItemVisitedListener(); var query = { 'text': '', 'maxResults': 1 }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(1, results.length); assertEq(PICASA_URL, results[0].url); @@ -269,26 +269,26 @@ chrome.test.runTests([ }; // lengthScopedSearch entry point. - chrome.experimental.history.deleteAll(function() { + chrome.history.deleteAll(function() { setItemVisitedListener(lengthScopedSearchTestVerification); populateHistory(urls, function() { }); }); }, function fullTextSearch() { - chrome.experimental.history.deleteAll(function() { + chrome.history.deleteAll(function() { // The continuation of the test after the windows have been opened. var validateTest = function() { // Continue with the test. // A title search for www.a.com should find a. var query = { 'text': 'www.a.com' }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(1, results.length); assertEq(A_RELATIVE_URL, results[0].url); // Text in the body of b.html. query = { 'text': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(1, results.length); assertEq(B_RELATIVE_URL, results[0].url); @@ -344,12 +344,12 @@ chrome.test.runTests([ // Verify that we received the url. var query = { 'text': '' }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(1, results.length); assertEq(GOOGLE_URL, results[0].url); var id = results[0].id; - chrome.experimental.history.getVisits({ 'url': GOOGLE_URL }, function(results) { + chrome.history.getVisits({ 'url': GOOGLE_URL }, function(results) { assertEq(1, results.length); assertEq(id, results[0].id); @@ -360,7 +360,7 @@ chrome.test.runTests([ }; // getVisits entry point. - chrome.experimental.history.deleteAll(function() { + chrome.history.deleteAll(function() { setItemVisitedListener(getVisitsTestVerification); populateHistory([GOOGLE_URL], function() { }); }); @@ -371,7 +371,7 @@ chrome.test.runTests([ removeItemRemovedListener(); var query = { 'text': '' }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(0, results.length); // The test has succeeded. @@ -383,16 +383,16 @@ chrome.test.runTests([ removeItemVisitedListener(); var query = { 'text': '' }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(1, results.length); assertEq(GOOGLE_URL, results[0].url); - chrome.experimental.history.deleteUrl({ 'url': GOOGLE_URL }); + chrome.history.deleteUrl({ 'url': GOOGLE_URL }); }); }; // deleteUrl entry point. - chrome.experimental.history.deleteAll(function() { + chrome.history.deleteAll(function() { setItemVisitedListener(onAddedItem); setItemRemovedListener(deleteUrlTestVerification); populateHistory([GOOGLE_URL], function() { }); @@ -409,7 +409,7 @@ chrome.test.runTests([ removeItemRemovedListener(); var query = { 'text': '' }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(1, results.length); assertEq(PICASA_URL, results[0].url); @@ -432,13 +432,13 @@ chrome.test.runTests([ }; removeItemVisitedListener(); - chrome.experimental.history.deleteRange({ 'startTime': startDate.getTime(), + chrome.history.deleteRange({ 'startTime': startDate.getTime(), 'endTime': endDate.getTime() }, function() { }); }; // deletRange entry point. - chrome.experimental.history.deleteAll(function() { + chrome.history.deleteAll(function() { setItemVisitedListener(onAddedItem); setItemRemovedListener(deleteRangeTestVerification); @@ -462,7 +462,7 @@ chrome.test.runTests([ removeItemRemovedListener(); var query = { 'text': '' }; - chrome.experimental.history.search(query, function(results) { + chrome.history.search(query, function(results) { assertEq(1, results.length); assertEq(GOOGLE_URL, results[0].url); @@ -488,13 +488,13 @@ chrome.test.runTests([ endDate = new Date(); endDate.setTime(endDate.getTime() + 1000); - chrome.experimental.history.deleteRange({ 'startTime': startDate.getTime(), + chrome.history.deleteRange({ 'startTime': startDate.getTime(), 'endTime': endDate.getTime() }, function() { }); }; // deletRange entry point. - chrome.experimental.history.deleteAll(function() { + chrome.history.deleteAll(function() { setItemVisitedListener(onAddedItem); setItemRemovedListener(deleteRange2TestVerification); populateHistory([urls[itemsAdded]], function() { }); diff --git a/chrome/test/data/extensions/api_test/override/background.html b/chrome/test/data/extensions/api_test/override/background.html deleted file mode 100644 index 3e7b4a4..0000000 --- a/chrome/test/data/extensions/api_test/override/background.html +++ /dev/null @@ -1 +0,0 @@ -<script src="test.js"></script>
diff --git a/chrome/test/data/extensions/api_test/override/downloads.html b/chrome/test/data/extensions/api_test/override/downloads.html deleted file mode 100644 index 17927f2..0000000 --- a/chrome/test/data/extensions/api_test/override/downloads.html +++ /dev/null @@ -1,6 +0,0 @@ -<title>download1</title>
-<script>
-console.log("download1");
-chrome.test.notifyPass();
-</script>
-Downloads Override
diff --git a/chrome/test/data/extensions/api_test/override/history.html b/chrome/test/data/extensions/api_test/override/history/background.html index fedd7a0..3605780 100644 --- a/chrome/test/data/extensions/api_test/override/history.html +++ b/chrome/test/data/extensions/api_test/override/history/background.html @@ -1,4 +1,3 @@ <script>
chrome.test.notifyPass();
</script>
-History Override
diff --git a/chrome/test/data/extensions/api_test/override/history/history.html b/chrome/test/data/extensions/api_test/override/history/history.html new file mode 100644 index 0000000..99b22d8 --- /dev/null +++ b/chrome/test/data/extensions/api_test/override/history/history.html @@ -0,0 +1,5 @@ +<script>
+console.log('Overridden history page loaded.');
+chrome.test.notifyPass();
+</script>
+History Override
diff --git a/chrome/test/data/extensions/api_test/override/history/manifest.json b/chrome/test/data/extensions/api_test/override/history/manifest.json new file mode 100644 index 0000000..ce17b80 --- /dev/null +++ b/chrome/test/data/extensions/api_test/override/history/manifest.json @@ -0,0 +1,12 @@ +{
+ "name": "History override test",
+ "version": "0.1",
+ "description": "Test chrome://history/ override",
+ "background_page": "background.html",
+ "permissions": [
+ "history"
+ ],
+ "chrome_url_overrides": {
+ "history": "history.html"
+ }
+}
diff --git a/chrome/test/data/extensions/api_test/override/newtab.html b/chrome/test/data/extensions/api_test/override/newtab/background.html index 20b8f82..3605780 100644 --- a/chrome/test/data/extensions/api_test/override/newtab.html +++ b/chrome/test/data/extensions/api_test/override/newtab/background.html @@ -1,4 +1,3 @@ <script>
chrome.test.notifyPass();
</script>
-New Tab Override
diff --git a/chrome/test/data/extensions/api_test/override/manifest.json b/chrome/test/data/extensions/api_test/override/newtab/manifest.json index 1fd8311..1d4720f 100644 --- a/chrome/test/data/extensions/api_test/override/manifest.json +++ b/chrome/test/data/extensions/api_test/override/newtab/manifest.json @@ -1,7 +1,7 @@ {
- "name": "Override Test 1",
+ "name": "New tab override test",
"version": "0.1",
- "description": "Test chrome:// overrides",
+ "description": "Test chrome://newtab override",
"background_page": "background.html",
"permissions": [
"tabs"
diff --git a/chrome/test/data/extensions/api_test/override/nonexistant.html b/chrome/test/data/extensions/api_test/override/newtab/newtab.html index 927f5ca..3c07179 100644 --- a/chrome/test/data/extensions/api_test/override/nonexistant.html +++ b/chrome/test/data/extensions/api_test/override/newtab/newtab.html @@ -1,4 +1,4 @@ <script>
chrome.test.notifyPass();
</script>
-Nonexistant Override
+New Tab Override!
diff --git a/chrome/test/data/extensions/api_test/override/test.js b/chrome/test/data/extensions/api_test/override/test.js deleted file mode 100644 index 52db94d..0000000 --- a/chrome/test/data/extensions/api_test/override/test.js +++ /dev/null @@ -1 +0,0 @@ -chrome.tabs.create({"url": "chrome://newtab/"}); diff --git a/chrome/test/data/extensions/api_test/permissions/disabled/background.html b/chrome/test/data/extensions/api_test/permissions/disabled/background.html index 1363291..b5c52c5 100755 --- a/chrome/test/data/extensions/api_test/permissions/disabled/background.html +++ b/chrome/test/data/extensions/api_test/permissions/disabled/background.html @@ -1,12 +1,12 @@ <script>
-// All of these tests should fail, since this extension has requested no
-// permissions.
+// All of the calls to chrome.* functions should fail, since this extension
+// has requested no permissions.
chrome.test.runTests([
function history() {
try {
var query = { 'text': '', 'maxResults': 1 };
- chrome.experimental.history.search(query, function(results) {
+ chrome.history.search(query, function(results) {
chrome.test.fail();
});
} catch (e) {
diff --git a/chrome/test/data/extensions/api_test/permissions/enabled/background.html b/chrome/test/data/extensions/api_test/permissions/enabled/background.html index 5ccd5e2..eb186e3 100755 --- a/chrome/test/data/extensions/api_test/permissions/enabled/background.html +++ b/chrome/test/data/extensions/api_test/permissions/enabled/background.html @@ -1,14 +1,28 @@ <script>
-// All of these tests should pass, since this extension has requested all of the
-// permissions.
+// All of the calls to chrome.* functions should succeed, since this extension
+// has requested all required permissions.
var pass = chrome.test.callbackPass;
chrome.test.runTests([
+ function experimental() {
+ // Test that use of an experimental API works.
+ // If/when chrome.experimental.processes is moved out of
+ // experimental, this test needs to be updated.
+ chrome.tabs.getSelected(null, function(tab) {
+ try {
+ chrome.experimental.processes.getProcessForTab(
+ tab.id, pass(function(process) {}));
+ } catch (e) {
+ chrome.test.fail();
+ }
+ });
+ },
+
function history() {
try {
var query = { 'text': '', 'maxResults': 1 };
- chrome.experimental.history.search(query, pass(function(results) {}));
+ chrome.history.search(query, pass(function(results) {}));
} catch (e) {
chrome.test.fail();
}
diff --git a/chrome/test/data/extensions/api_test/permissions/enabled/manifest.json b/chrome/test/data/extensions/api_test/permissions/enabled/manifest.json index 060964b..9d28349 100755 --- a/chrome/test/data/extensions/api_test/permissions/enabled/manifest.json +++ b/chrome/test/data/extensions/api_test/permissions/enabled/manifest.json @@ -1,7 +1,7 @@ {
- "name": "permissions failure apitest",
- "description": "permissions failure extension",
+ "name": "permissions success apitest",
+ "description": "permissions success extension",
"version": "0.1",
"background_page": "background.html",
- "permissions": [ "tabs", "bookmarks", "experimental" ]
+ "permissions": [ "tabs", "bookmarks", "history", "experimental" ]
}
diff --git a/chrome/test/data/extensions/api_test/permissions/experimental_disabled/background.html b/chrome/test/data/extensions/api_test/permissions/experimental_disabled/background.html new file mode 100755 index 0000000..c46b2e8 --- /dev/null +++ b/chrome/test/data/extensions/api_test/permissions/experimental_disabled/background.html @@ -0,0 +1,19 @@ +<script>
+// Calls to chrome.experimental.* functions should fail, since this extension
+// has not declared that permission.
+
+chrome.test.runTests([
+ function experimental() {
+ chrome.tabs.getSelected(null, function(tab) {
+ try {
+ chrome.experimental.processes.getProcessForTab(tab.id,
+ function(process) {
+ chrome.test.fail();
+ });
+ } catch (e) {
+ chrome.test.succeed();
+ }
+ });
+ }
+]);
+</script>
diff --git a/chrome/test/data/extensions/api_test/permissions/experimental_disabled/manifest.json b/chrome/test/data/extensions/api_test/permissions/experimental_disabled/manifest.json new file mode 100755 index 0000000..2f24662 --- /dev/null +++ b/chrome/test/data/extensions/api_test/permissions/experimental_disabled/manifest.json @@ -0,0 +1,7 @@ +{
+ "name": "permissions failure apitest",
+ "description": "permissions failure extension",
+ "version": "0.1",
+ "background_page": "background.html",
+ "permissions": [ "tabs" ]
+}
diff --git a/chrome/test/data/extensions/manifest_tests/override_history.json b/chrome/test/data/extensions/manifest_tests/override_history.json new file mode 100644 index 0000000..dc21ec6 --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/override_history.json @@ -0,0 +1,7 @@ +{ + "name": "test", + "version": "1", + "chrome_url_overrides": { + "history": "history.html" + } +} diff --git a/chrome/test/data/extensions/manifest_tests/override_invalid_page.json b/chrome/test/data/extensions/manifest_tests/override_invalid_page.json new file mode 100644 index 0000000..ff5296b --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/override_invalid_page.json @@ -0,0 +1,7 @@ +{ + "name": "test", + "version": "1", + "chrome_url_overrides": { + "no_such_override": "a_page.html" + } +} diff --git a/chrome/test/data/extensions/manifest_tests/override_new_tab.json b/chrome/test/data/extensions/manifest_tests/override_new_tab.json new file mode 100644 index 0000000..fd61b6d --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/override_new_tab.json @@ -0,0 +1,7 @@ +{ + "name": "test", + "version": "1", + "chrome_url_overrides": { + "newtab": "newtab.html" + } +} diff --git a/chrome/test/data/extensions/manifest_tests/override_newtab_and_history.json b/chrome/test/data/extensions/manifest_tests/override_newtab_and_history.json new file mode 100644 index 0000000..6462947 --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/override_newtab_and_history.json @@ -0,0 +1,8 @@ +{ + "name": "test", + "version": "1", + "chrome_url_overrides": { + "newtab": "newtab.html", + "history": "history.html" + } +} |