summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcindylau@google.com <cindylau@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-18 18:52:29 +0000
committercindylau@google.com <cindylau@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-18 18:52:29 +0000
commit898bbd3c04dafd8148bb8af0b7b211883767da82 (patch)
treea88c03880ad75e2664accdffbea209e88c250f81
parentec6a61b6d15a3cd665f8eb6f4f4a955130771f25 (diff)
downloadchromium_src-898bbd3c04dafd8148bb8af0b7b211883767da82.zip
chromium_src-898bbd3c04dafd8148bb8af0b7b211883767da82.tar.gz
chromium_src-898bbd3c04dafd8148bb8af0b7b211883767da82.tar.bz2
Add the new cookies API to Chrome Extensions, minus the event
handler. BUG=38398 TEST=none Review URL: http://codereview.chromium.org/841006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47540 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_cookies_api.cc255
-rw-r--r--chrome/browser/extensions/extension_cookies_api.h60
-rw-r--r--chrome/browser/extensions/extension_cookies_api_constants.cc32
-rw-r--r--chrome/browser/extensions/extension_cookies_api_constants.h38
-rw-r--r--chrome/browser/extensions/extension_cookies_apitest.cc14
-rw-r--r--chrome/browser/extensions/extension_cookies_helpers.cc192
-rw-r--r--chrome/browser/extensions/extension_cookies_helpers.h97
-rw-r--r--chrome/browser/extensions/extension_cookies_unittest.cc183
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.cc8
-rw-r--r--chrome/browser/extensions/extension_storage_apitest.cc4
-rw-r--r--chrome/chrome_browser.gypi6
-rw-r--r--chrome/chrome_tests.gypi2
-rw-r--r--chrome/common/extensions/api/extension_api.json162
-rw-r--r--chrome/common/extensions/docs/experimental.contextMenu.html594
-rw-r--r--chrome/common/extensions/docs/experimental.cookies.html2677
-rw-r--r--chrome/common/extensions/docs/experimental.html1
-rw-r--r--chrome/common/extensions/docs/extension.html250
-rw-r--r--chrome/renderer/resources/renderer_extension_bindings.js1
-rw-r--r--chrome/test/data/extensions/api_test/cookies/manifest.json9
-rw-r--r--chrome/test/data/extensions/api_test/cookies/tab.html290
20 files changed, 4737 insertions, 138 deletions
diff --git a/chrome/browser/extensions/extension_cookies_api.cc b/chrome/browser/extensions/extension_cookies_api.cc
new file mode 100644
index 0000000..c9c2d09
--- /dev/null
+++ b/chrome/browser/extensions/extension_cookies_api.cc
@@ -0,0 +1,255 @@
+// 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/browser/extensions/extension_cookies_api.h"
+
+#include "chrome/browser/browser_list.h"
+#include "chrome/browser/extensions/extension_cookies_api_constants.h"
+#include "chrome/browser/extensions/extension_cookies_helpers.h"
+#include "chrome/browser/profile.h"
+#include "chrome/common/extensions/extension_error_utils.h"
+#include "chrome/common/net/url_request_context_getter.h"
+#include "net/base/cookie_monster.h"
+
+namespace helpers = extension_cookies_helpers;
+namespace keys = extension_cookies_api_constants;
+
+bool CookiesFunction::ParseUrl(const DictionaryValue* details, GURL* url) {
+ DCHECK(details && url);
+ std::string url_string;
+ EXTENSION_FUNCTION_VALIDATE(details->GetString(keys::kUrlKey, &url_string));
+ *url = GURL(url_string);
+ if (!url->is_valid()) {
+ error_ = ExtensionErrorUtils::FormatErrorMessage(
+ keys::kInvalidUrlError, url_string);
+ return false;
+ }
+ return true;
+}
+
+bool CookiesFunction::ParseCookieStore(const DictionaryValue* details,
+ net::CookieStore** store,
+ std::string* store_id) {
+ DCHECK(details && (store || store_id));
+ Profile* store_profile = NULL;
+ if (details->HasKey(keys::kStoreIdKey)) {
+ std::string store_id_value;
+ EXTENSION_FUNCTION_VALIDATE(
+ details->GetString(keys::kStoreIdKey, &store_id_value));
+ store_profile = helpers::ChooseProfileFromStoreId(
+ store_id_value, profile(), include_incognito());
+ if (!store_profile) {
+ error_ = ExtensionErrorUtils::FormatErrorMessage(
+ keys::kInvalidStoreIdError, store_id_value);
+ return false;
+ }
+ } else {
+ // GetCurrentBrowser() already takes into account incognito settings.
+ Browser* current_browser = GetCurrentBrowser();
+ if (!current_browser) {
+ error_ = keys::kNoCookieStoreFoundError;
+ return false;
+ }
+ store_profile = current_browser->profile();
+ }
+ DCHECK(store_profile);
+ if (store)
+ *store = store_profile->GetRequestContext()->GetCookieStore();
+ if (store_id)
+ *store_id = helpers::GetStoreIdFromProfile(store_profile);
+ return true;
+}
+
+bool GetCookieFunction::RunImpl() {
+ EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY));
+ const DictionaryValue* details = args_as_dictionary();
+ DCHECK(details);
+
+ // Read/validate input parameters.
+ GURL url;
+ if (!ParseUrl(details, &url))
+ return false;
+ if (!GetExtension()->HasHostPermission(url)) {
+ error_ = ExtensionErrorUtils::FormatErrorMessage(
+ keys::kNoHostPermissionsError, url.spec());
+ return false;
+ }
+
+ std::string name;
+ EXTENSION_FUNCTION_VALIDATE(details->GetString(keys::kNameKey, &name));
+
+ net::CookieStore* cookie_store;
+ std::string store_id;
+ if (!ParseCookieStore(details, &cookie_store, &store_id))
+ return false;
+ DCHECK(cookie_store && !store_id.empty());
+
+ net::CookieMonster::CookieList cookie_list = helpers::GetCookieListFromStore(
+ cookie_store, url);
+ net::CookieMonster::CookieList::iterator it;
+ for (it = cookie_list.begin(); it != cookie_list.end(); ++it) {
+ // Return the first matching cookie; relies on the fact that the
+ // CookieMonster retrieves them in reverse domain-length order.
+ const net::CookieMonster::CanonicalCookie& cookie = it->second;
+ if (cookie.Name() == name) {
+ result_.reset(helpers::CreateCookieValue(*it, store_id));
+ return true;
+ }
+ }
+ // The cookie doesn't exist; return null.
+ result_.reset(Value::CreateNullValue());
+ return true;
+}
+
+bool GetAllCookiesFunction::RunImpl() {
+ EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY));
+ const DictionaryValue* details = args_as_dictionary();
+
+ // Read/validate input parameters.
+ GURL url;
+ if (details->HasKey(keys::kUrlKey) && !ParseUrl(details, &url))
+ return false;
+
+ net::CookieStore* cookie_store;
+ std::string store_id;
+ if (!ParseCookieStore(details, &cookie_store, &store_id))
+ return false;
+ DCHECK(cookie_store);
+
+ ListValue* matching_list = new ListValue();
+ helpers::AppendMatchingCookiesToList(cookie_store, store_id, url, details,
+ GetExtension(), matching_list);
+ result_.reset(matching_list);
+ return true;
+}
+
+bool SetCookieFunction::RunImpl() {
+ EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY));
+ const DictionaryValue* details = args_as_dictionary();
+
+ // Read/validate input parameters.
+ GURL url;
+ if (!ParseUrl(details, &url))
+ return false;
+ if (!GetExtension()->HasHostPermission(url)) {
+ error_ = ExtensionErrorUtils::FormatErrorMessage(
+ keys::kNoHostPermissionsError, url.spec());
+ return false;
+ }
+ std::string name;
+ if (details->HasKey(keys::kNameKey)) {
+ EXTENSION_FUNCTION_VALIDATE(details->GetString(keys::kNameKey, &name));
+ }
+ std::string value;
+ if (details->HasKey(keys::kValueKey)) {
+ EXTENSION_FUNCTION_VALIDATE(details->GetString(keys::kValueKey, &value));
+ }
+ std::string domain;
+ if (details->HasKey(keys::kDomainKey)) {
+ EXTENSION_FUNCTION_VALIDATE(details->GetString(keys::kDomainKey, &domain));
+ }
+ std::string path;
+ if (details->HasKey(keys::kPathKey)) {
+ EXTENSION_FUNCTION_VALIDATE(details->GetString(keys::kPathKey, &path));
+ }
+ bool secure = false;
+ if (details->HasKey(keys::kSecureKey)) {
+ EXTENSION_FUNCTION_VALIDATE(details->GetBoolean(keys::kSecureKey, &secure));
+ }
+ bool http_only = false;
+ if (details->HasKey(keys::kHttpOnlyKey)) {
+ EXTENSION_FUNCTION_VALIDATE(
+ details->GetBoolean(keys::kHttpOnlyKey, &http_only));
+ }
+ base::Time expiration_time;
+ if (details->HasKey(keys::kExpirationDateKey)) {
+ Value* expiration_date_value;
+ EXTENSION_FUNCTION_VALIDATE(details->Get(keys::kExpirationDateKey,
+ &expiration_date_value));
+ double expiration_date;
+ if (expiration_date_value->IsType(Value::TYPE_INTEGER)) {
+ int expiration_date_int;
+ EXTENSION_FUNCTION_VALIDATE(
+ expiration_date_value->GetAsInteger(&expiration_date_int));
+ expiration_date = static_cast<double>(expiration_date_int);
+ } else {
+ EXTENSION_FUNCTION_VALIDATE(
+ expiration_date_value->GetAsReal(&expiration_date));
+ }
+ expiration_time = base::Time::FromDoubleT(expiration_date);
+ }
+
+ net::CookieStore* cookie_store;
+ if (!ParseCookieStore(details, &cookie_store, NULL))
+ return false;
+ DCHECK(cookie_store);
+
+ if (!cookie_store->GetCookieMonster()->SetCookieWithDetails(
+ url, name, value, domain, path, expiration_time, secure, http_only)) {
+ error_ = ExtensionErrorUtils::FormatErrorMessage(
+ keys::kCookieSetFailedError, name);
+ return false;
+ }
+ return true;
+}
+
+bool RemoveCookieFunction::RunImpl() {
+ EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY));
+ const DictionaryValue* details = args_as_dictionary();
+
+ // Read/validate input parameters.
+ GURL url;
+ if (!ParseUrl(details, &url))
+ return false;
+ if (!GetExtension()->HasHostPermission(url)) {
+ error_ = ExtensionErrorUtils::FormatErrorMessage(
+ keys::kNoHostPermissionsError, url.spec());
+ return false;
+ }
+
+ std::string name;
+ EXTENSION_FUNCTION_VALIDATE(details->GetString(keys::kNameKey, &name));
+
+ net::CookieStore* cookie_store;
+ if (!ParseCookieStore(details, &cookie_store, NULL))
+ return false;
+ DCHECK(cookie_store);
+
+ cookie_store->DeleteCookie(url, name);
+ return true;
+}
+
+bool GetAllCookieStoresFunction::RunImpl() {
+ Profile* original_profile = profile()->GetOriginalProfile();
+ DCHECK(original_profile);
+ scoped_ptr<ListValue> original_tab_ids(new ListValue());
+ Profile* incognito_profile = NULL;
+ scoped_ptr<ListValue> incognito_tab_ids;
+ if (include_incognito()) {
+ incognito_profile = profile()->GetOffTheRecordProfile();
+ if (incognito_profile)
+ incognito_tab_ids.reset(new ListValue());
+ }
+ for (BrowserList::const_iterator iter = BrowserList::begin();
+ iter != BrowserList::end(); ++iter) {
+ Browser* browser = *iter;
+ if (browser->profile() == original_profile) {
+ helpers::AppendToTabIdList(browser, original_tab_ids.get());
+ } else if (incognito_tab_ids.get() &&
+ browser->profile() == incognito_profile) {
+ helpers::AppendToTabIdList(browser, incognito_tab_ids.get());
+ }
+ }
+ ListValue* cookie_store_list = new ListValue();
+ if (original_tab_ids->GetSize() > 0) {
+ cookie_store_list->Append(helpers::CreateCookieStoreValue(
+ original_profile, original_tab_ids.release()));
+ }
+ if (incognito_tab_ids.get() && incognito_tab_ids->GetSize() > 0) {
+ cookie_store_list->Append(helpers::CreateCookieStoreValue(
+ incognito_profile, incognito_tab_ids.release()));
+ }
+ result_.reset(cookie_store_list);
+ return true;
+}
diff --git a/chrome/browser/extensions/extension_cookies_api.h b/chrome/browser/extensions/extension_cookies_api.h
new file mode 100644
index 0000000..d0f981f
--- /dev/null
+++ b/chrome/browser/extensions/extension_cookies_api.h
@@ -0,0 +1,60 @@
+// 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.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_
+
+#include <string>
+
+#include "chrome/browser/extensions/extension_function.h"
+
+namespace net {
+class CookieStore;
+} // namespace net
+
+class CookiesFunction : public SyncExtensionFunction {
+ protected:
+ // Looks for a 'url' value in the given details dictionary and constructs a
+ // GURL from it. Returns false and assigns the internal error_ value if the
+ // URL is invalid or isn't found in the dictionary.
+ bool ParseUrl(const DictionaryValue* details, GURL* url);
+
+ // Checks the given details dictionary for a 'storeId' value, and retrieves
+ // the cookie store and the store ID associated with it. If the 'storeId'
+ // value isn't found in the dictionary, the current execution context's
+ // cookie store is retrieved. Returns false on error, and assigns the
+ // internal error_ value if that occurs.
+ // At least one of the output parameters store and store_id should be
+ // non-null.
+ bool ParseCookieStore(const DictionaryValue* details,
+ net::CookieStore** store, std::string* store_id);
+};
+
+class GetCookieFunction : public CookiesFunction {
+ public:
+ virtual bool RunImpl();
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.cookies.get")
+};
+class GetAllCookiesFunction : public CookiesFunction {
+ public:
+ virtual bool RunImpl();
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.cookies.getAll")
+};
+class SetCookieFunction : public CookiesFunction {
+ public:
+ virtual bool RunImpl();
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.cookies.set")
+};
+class RemoveCookieFunction : public CookiesFunction {
+ public:
+ virtual bool RunImpl();
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.cookies.remove")
+};
+class GetAllCookieStoresFunction : public CookiesFunction {
+ public:
+ virtual bool RunImpl();
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.cookies.getAllCookieStores")
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_
diff --git a/chrome/browser/extensions/extension_cookies_api_constants.cc b/chrome/browser/extensions/extension_cookies_api_constants.cc
new file mode 100644
index 0000000..921a966
--- /dev/null
+++ b/chrome/browser/extensions/extension_cookies_api_constants.cc
@@ -0,0 +1,32 @@
+// 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/browser/extensions/extension_cookies_api_constants.h"
+
+namespace extension_cookies_api_constants {
+
+const wchar_t kDomainKey[] = L"domain";
+const wchar_t kExpirationDateKey[] = L"expirationDate";
+const wchar_t kHostOnlyKey[] = L"hostOnly";
+const wchar_t kHttpOnlyKey[] = L"httpOnly";
+const wchar_t kIdKey[] = L"id";
+const wchar_t kNameKey[] = L"name";
+const wchar_t kPathKey[] = L"path";
+const wchar_t kSecureKey[] = L"secure";
+const wchar_t kSessionKey[] = L"session";
+const wchar_t kStoreIdKey[] = L"storeId";
+const wchar_t kTabIdsKey[] = L"tabIds";
+const wchar_t kUrlKey[] = L"url";
+const wchar_t kValueKey[] = L"value";
+
+const char kCookieSetFailedError[] =
+ "Failed to parse or set cookie named \"*\".";
+const char kInvalidStoreIdError[] = "Invalid cookie store id: \"*\".";
+const char kInvalidUrlError[] = "Invalid url: \"*\".";
+const char kNoCookieStoreFoundError[] =
+ "No accessible cookie store found for the current execution context.";
+const char kNoHostPermissionsError[] =
+ "No host permissions for cookies at url: \"*\".";
+
+} // namespace extension_cookies_api_constants
diff --git a/chrome/browser/extensions/extension_cookies_api_constants.h b/chrome/browser/extensions/extension_cookies_api_constants.h
new file mode 100644
index 0000000..28814b7
--- /dev/null
+++ b/chrome/browser/extensions/extension_cookies_api_constants.h
@@ -0,0 +1,38 @@
+// 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.
+
+// Constants used for the Cookies API.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_CONSTANTS_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_CONSTANTS_H_
+
+namespace extension_cookies_api_constants {
+
+// Keys.
+extern const wchar_t kDomainKey[];
+extern const wchar_t kExpirationDateKey[];
+extern const wchar_t kHostOnlyKey[];
+extern const wchar_t kHttpOnlyKey[];
+extern const wchar_t kIdKey[];
+extern const wchar_t kNameKey[];
+extern const wchar_t kPathKey[];
+extern const wchar_t kSecureKey[];
+extern const wchar_t kSessionKey[];
+extern const wchar_t kStoreIdKey[];
+extern const wchar_t kTabIdsKey[];
+extern const wchar_t kUrlKey[];
+extern const wchar_t kValueKey[];
+
+// TODO(cindylau): kOnChanged is not yet implemented.
+
+// Errors.
+extern const char kCookieSetFailedError[];
+extern const char kInvalidStoreIdError[];
+extern const char kInvalidUrlError[];
+extern const char kNoCookieStoreFoundError[];
+extern const char kNoHostPermissionsError[];
+
+} // namespace extension_cookies_api_constants
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_CONSTANTS_H_
diff --git a/chrome/browser/extensions/extension_cookies_apitest.cc b/chrome/browser/extensions/extension_cookies_apitest.cc
new file mode 100644
index 0000000..12c6373
--- /dev/null
+++ b/chrome/browser/extensions/extension_cookies_apitest.cc
@@ -0,0 +1,14 @@
+// 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 "base/command_line.h"
+#include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/common/chrome_switches.h"
+
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Cookies) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableExperimentalExtensionApis);
+
+ ASSERT_TRUE(RunExtensionTest("cookies")) << message_;
+}
diff --git a/chrome/browser/extensions/extension_cookies_helpers.cc b/chrome/browser/extensions/extension_cookies_helpers.cc
new file mode 100644
index 0000000..13f5742
--- /dev/null
+++ b/chrome/browser/extensions/extension_cookies_helpers.cc
@@ -0,0 +1,192 @@
+// 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/browser/extensions/extension_cookies_helpers.h"
+
+#include "base/logging.h"
+#include "chrome/browser/browser.h"
+#include "chrome/browser/extensions/extension_cookies_api_constants.h"
+#include "chrome/browser/extensions/extension_tabs_module.h"
+#include "chrome/browser/profile.h"
+#include "chrome/common/extensions/extension.h"
+#include "chrome/common/url_constants.h"
+#include "googleurl/src/gurl.h"
+
+namespace keys = extension_cookies_api_constants;
+
+namespace extension_cookies_helpers {
+
+static const char kOriginalProfileStoreId[] = "0";
+static const char kOffTheRecordProfileStoreId[] = "1";
+
+Profile* ChooseProfileFromStoreId(const std::string& store_id,
+ Profile* profile,
+ bool include_incognito) {
+ DCHECK(profile);
+ if (store_id == kOriginalProfileStoreId)
+ return profile->GetOriginalProfile();
+ if (store_id == kOffTheRecordProfileStoreId && include_incognito)
+ return profile->GetOffTheRecordProfile();
+ return NULL;
+}
+
+std::string GetStoreIdFromProfile(Profile* profile) {
+ DCHECK(profile);
+ return profile->IsOffTheRecord() ?
+ kOffTheRecordProfileStoreId : kOriginalProfileStoreId;
+}
+
+DictionaryValue* CreateCookieValue(
+ const net::CookieMonster::CookieListPair& cookie_pair,
+ const std::string& store_id) {
+ DictionaryValue* result = new DictionaryValue();
+
+ const net::CookieMonster::CanonicalCookie& cookie = cookie_pair.second;
+ result->SetString(keys::kNameKey, cookie.Name());
+ result->SetString(keys::kValueKey, cookie.Value());
+ result->SetString(keys::kDomainKey, cookie_pair.first);
+ result->SetBoolean(keys::kHostOnlyKey,
+ net::CookieMonster::DomainIsHostOnly(cookie_pair.first));
+ result->SetString(keys::kPathKey, cookie.Path());
+ result->SetBoolean(keys::kSecureKey, cookie.IsSecure());
+ result->SetBoolean(keys::kHttpOnlyKey, cookie.IsHttpOnly());
+ result->SetBoolean(keys::kSessionKey, !cookie.DoesExpire());
+ if (cookie.DoesExpire())
+ result->SetReal(keys::kExpirationDateKey, cookie.ExpiryDate().ToDoubleT());
+ result->SetString(keys::kStoreIdKey, store_id);
+
+ return result;
+}
+
+DictionaryValue* CreateCookieStoreValue(Profile* profile,
+ ListValue* tab_ids) {
+ DCHECK(profile);
+ DCHECK(tab_ids);
+ DictionaryValue* result = new DictionaryValue();
+ result->SetString(keys::kIdKey, GetStoreIdFromProfile(profile));
+ result->Set(keys::kTabIdsKey, tab_ids);
+ return result;
+}
+
+net::CookieMonster::CookieList GetCookieListFromStore(
+ net::CookieStore* cookie_store, const GURL& url) {
+ DCHECK(cookie_store);
+ net::CookieMonster* monster = cookie_store->GetCookieMonster();
+ if (!url.is_empty()) {
+ DCHECK(url.is_valid());
+ return monster->GetAllCookiesForURL(url);
+ } else {
+ return monster->GetAllCookies();
+ }
+}
+
+GURL GetURLFromCookiePair(
+ const net::CookieMonster::CookieListPair& cookie_pair) {
+ const std::string& domain_key = cookie_pair.first;
+ const net::CookieMonster::CanonicalCookie& cookie = cookie_pair.second;
+ const std::string scheme =
+ cookie.IsSecure() ? chrome::kHttpsScheme : chrome::kHttpScheme;
+ const std::string host =
+ domain_key.find('.') != 0 ? domain_key : domain_key.substr(1);
+ return GURL(scheme + chrome::kStandardSchemeSeparator + host + "/");
+}
+
+void AppendMatchingCookiesToList(
+ net::CookieStore* cookie_store, const std::string& store_id,
+ const GURL& url, const DictionaryValue* details,
+ const Extension* extension,
+ ListValue* match_list) {
+ net::CookieMonster::CookieList all_cookies = GetCookieListFromStore(
+ cookie_store, url);
+ net::CookieMonster::CookieList::const_iterator it;
+ for (it = all_cookies.begin(); it != all_cookies.end(); ++it) {
+ // Ignore any cookie whose domain doesn't match the extension's
+ // host permissions.
+ GURL cookie_domain_url = GetURLFromCookiePair(*it);
+ if (!extension->HasHostPermission(cookie_domain_url))
+ continue;
+ // Filter the cookie using the match filter.
+ extension_cookies_helpers::MatchFilter filter(details);
+ if (filter.MatchesCookie(*it))
+ match_list->Append(CreateCookieValue(*it, store_id));
+ }
+}
+
+void AppendToTabIdList(Browser* browser, ListValue* tab_ids) {
+ DCHECK(browser);
+ DCHECK(tab_ids);
+ TabStripModel* tab_strip = browser->tabstrip_model();
+ for (int i = 0; i < tab_strip->count(); ++i) {
+ tab_ids->Append(Value::CreateIntegerValue(
+ ExtensionTabUtil::GetTabId(tab_strip->GetTabContentsAt(i))));
+ }
+}
+
+MatchFilter::MatchFilter(const DictionaryValue* details)
+ : details_(details) {
+ DCHECK(details_);
+}
+
+bool MatchFilter::MatchesCookie(
+ const net::CookieMonster::CookieListPair& cookie_pair) {
+ const net::CookieMonster::CanonicalCookie& cookie = cookie_pair.second;
+ if (!MatchesString(keys::kNameKey, cookie.Name()))
+ return false;
+ if (!MatchesDomain(cookie_pair.first))
+ return false;
+ if (!MatchesString(keys::kPathKey, cookie.Path()))
+ return false;
+ if (!MatchesBoolean(keys::kSecureKey, cookie.IsSecure()))
+ return false;
+ if (!MatchesBoolean(keys::kSessionKey, !cookie.DoesExpire()))
+ return false;
+ return true;
+}
+
+bool MatchFilter::MatchesString(const wchar_t* key, const std::string& value) {
+ if (!details_->HasKey(key))
+ return true;
+ std::string filter_value;
+ return (details_->GetString(key, &filter_value) &&
+ value == filter_value);
+}
+
+bool MatchFilter::MatchesBoolean(const wchar_t* key, bool value) {
+ if (!details_->HasKey(key))
+ return true;
+ bool filter_value = false;
+ return (details_->GetBoolean(key, &filter_value) &&
+ value == filter_value);
+}
+
+bool MatchFilter::MatchesDomain(const std::string& domain) {
+ if (!details_->HasKey(keys::kDomainKey))
+ return true;
+
+ std::string filter_value;
+ if (!details_->GetString(keys::kDomainKey, &filter_value))
+ return false;
+ // Add a leading '.' character to the filter domain if it doesn't exist.
+ if (net::CookieMonster::DomainIsHostOnly(filter_value))
+ filter_value = "." + filter_value;
+
+ std::string sub_domain(domain);
+ // Strip any leading '.' character from the input cookie domain.
+ if (!net::CookieMonster::DomainIsHostOnly(sub_domain))
+ sub_domain = sub_domain.substr(1);
+
+ // Now check whether the domain argument is a subdomain of
+ // the filter domain.
+ for (sub_domain = "." + sub_domain;
+ sub_domain.length() >= filter_value.length();
+ ) {
+ if (sub_domain == filter_value)
+ return true;
+ const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot.
+ sub_domain.erase(0, next_dot);
+ }
+ return false;
+}
+
+} // namespace extension_cookies_helpers
diff --git a/chrome/browser/extensions/extension_cookies_helpers.h b/chrome/browser/extensions/extension_cookies_helpers.h
new file mode 100644
index 0000000..070b240
--- /dev/null
+++ b/chrome/browser/extensions/extension_cookies_helpers.h
@@ -0,0 +1,97 @@
+// 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.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_HELPERS_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_HELPERS_H_
+
+#include <string>
+
+#include "base/values.h"
+#include "net/base/cookie_monster.h"
+
+class Browser;
+class Extension;
+class Profile;
+
+namespace extension_cookies_helpers {
+
+// Returns either the original profile or the incognito profile, based on the
+// given store ID. Returns NULL if the profile doesn't exist or is not allowed
+// (e.g. if incognito is not enabled for the extension).
+Profile* ChooseProfileFromStoreId(const std::string& store_id,
+ Profile* profile,
+ bool include_incognito);
+
+std::string GetStoreIdFromProfile(Profile* profile);
+
+// Constructs a Cookie object as defined by the cookies API.
+DictionaryValue* CreateCookieValue(
+ const net::CookieMonster::CookieListPair& cookie_pair,
+ const std::string& store_id);
+
+// Constructs a CookieStore object as defined by the cookies API.
+DictionaryValue* CreateCookieStoreValue(Profile* profile,
+ ListValue* tab_ids);
+
+// Retrieves all cookies from the given cookie store corresponding to the given
+// URL. If the URL is empty, all cookies in the cookie store are retrieved.
+net::CookieMonster::CookieList GetCookieListFromStore(
+ net::CookieStore* cookie_store, const GURL& url);
+
+// Constructs a URL from a cookie's information for use in checking
+// a cookie against the extension's host permissions. The Secure
+// property of the cookie defines the URL scheme, and the cookie's
+// domain becomes the URL host.
+GURL GetURLFromCookiePair(
+ const net::CookieMonster::CookieListPair& cookie_pair);
+
+// Looks through all cookies in the given cookie store, and appends to the
+// match list all the cookies that both match the given URL and cookie details
+// and are allowed by extension host permissions.
+void AppendMatchingCookiesToList(
+ net::CookieStore* cookie_store, const std::string& store_id,
+ const GURL& url, const DictionaryValue* details,
+ const Extension* extension,
+ ListValue* match_list);
+
+// Appends the IDs of all tabs belonging to the given browser to the
+// given list.
+void AppendToTabIdList(Browser* browser, ListValue* tab_ids);
+
+// A class representing the cookie filter parameters passed into
+// cookies.getAll().
+// This class is essentially a convenience wrapper for the details dictionary
+// passed into the cookies.getAll() API by the user. If the dictionary contains
+// no filter parameters, the MatchFilter will always trivially
+// match all cookies.
+class MatchFilter {
+ public:
+ // Takes the details dictionary argument given by the user as input.
+ // This class does not take ownership of the lifetime of the DictionaryValue
+ // object.
+ explicit MatchFilter(const DictionaryValue* details);
+
+ // Returns true if the given cookie matches the properties in the match
+ // filter.
+ bool MatchesCookie(const net::CookieMonster::CookieListPair& cookie_pair);
+
+ private:
+ bool MatchesString(const wchar_t* key, const std::string& value);
+ bool MatchesBoolean(const wchar_t* key, bool value);
+
+ // Returns true if the given cookie domain string matches the filter's
+ // domain. Any cookie domain which is equal to or is a subdomain of the
+ // filter's domain will be matched; leading '.' characters indicating
+ // host-only domains have no meaning in the match filter domain (for
+ // instance, a match filter domain of 'foo.bar.com' will be treated the same
+ // as '.foo.bar.com', and both will match cookies with domain values of
+ // 'foo.bar.com', '.foo.bar.com', and 'baz.foo.bar.com'.
+ bool MatchesDomain(const std::string& domain);
+
+ const DictionaryValue* details_;
+};
+
+} // namespace extension_cookies_helpers
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_HELPERS_H_
diff --git a/chrome/browser/extensions/extension_cookies_unittest.cc b/chrome/browser/extensions/extension_cookies_unittest.cc
new file mode 100644
index 0000000..1bd5bdc
--- /dev/null
+++ b/chrome/browser/extensions/extension_cookies_unittest.cc
@@ -0,0 +1,183 @@
+// 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 "testing/gtest/include/gtest/gtest.h"
+
+#include "chrome/browser/extensions/extension_cookies_api_constants.h"
+#include "chrome/browser/extensions/extension_cookies_helpers.h"
+#include "chrome/test/testing_profile.h"
+
+namespace helpers = extension_cookies_helpers;
+namespace keys = extension_cookies_api_constants;
+
+namespace {
+
+struct DomainMatchCase {
+ const char* filter;
+ const char* domain;
+ const bool matches;
+};
+
+// A test profile that supports linking with another profile for off-the-record
+// support.
+class OtrTestingProfile : public TestingProfile {
+ public:
+ OtrTestingProfile() : linked_profile_(NULL) {}
+ virtual Profile* GetOriginalProfile() {
+ if (IsOffTheRecord())
+ return linked_profile_;
+ else
+ return this;
+ }
+
+ virtual Profile* GetOffTheRecordProfile() {
+ if (IsOffTheRecord())
+ return this;
+ else
+ return linked_profile_;
+ }
+
+ static void LinkProfiles(OtrTestingProfile* profile1,
+ OtrTestingProfile* profile2) {
+ profile1->set_linked_profile(profile2);
+ profile2->set_linked_profile(profile1);
+ }
+
+ void set_linked_profile(OtrTestingProfile* profile) {
+ linked_profile_ = profile;
+ }
+
+ private:
+ OtrTestingProfile* linked_profile_;
+};
+
+} // namespace
+
+class ExtensionCookiesTest : public testing::Test {
+};
+
+TEST_F(ExtensionCookiesTest, StoreIdProfileConversion) {
+ OtrTestingProfile profile, otrProfile;
+ otrProfile.set_off_the_record(true);
+ OtrTestingProfile::LinkProfiles(&profile, &otrProfile);
+
+ EXPECT_EQ("0", helpers::GetStoreIdFromProfile(&profile));
+ EXPECT_EQ(&profile, helpers::ChooseProfileFromStoreId("0", &profile, true));
+ EXPECT_EQ(&profile, helpers::ChooseProfileFromStoreId("0", &profile, false));
+ EXPECT_EQ(&otrProfile,
+ helpers::ChooseProfileFromStoreId("1", &profile, true));
+ EXPECT_EQ(NULL, helpers::ChooseProfileFromStoreId("1", &profile, false));
+
+ EXPECT_EQ("1", helpers::GetStoreIdFromProfile(&otrProfile));
+ EXPECT_EQ(&profile,
+ helpers::ChooseProfileFromStoreId("0", &otrProfile, true));
+ EXPECT_EQ(&profile,
+ helpers::ChooseProfileFromStoreId("0", &otrProfile, false));
+ EXPECT_EQ(&otrProfile,
+ helpers::ChooseProfileFromStoreId("1", &otrProfile, true));
+ EXPECT_EQ(NULL, helpers::ChooseProfileFromStoreId("1", &otrProfile, false));
+}
+
+TEST_F(ExtensionCookiesTest, ExtensionTypeCreation) {
+ std::string string_value;
+ bool boolean_value;
+ double double_value;
+ Value* value;
+
+ net::CookieMonster::CanonicalCookie cookie1(
+ "ABC", "DEF", "/", false, false,
+ base::Time(), base::Time(), false, base::Time());
+ net::CookieMonster::CookieListPair cookie_pair1("www.foobar.com", cookie1);
+ scoped_ptr<DictionaryValue> cookie_value1(
+ helpers::CreateCookieValue(cookie_pair1, "some cookie store"));
+ EXPECT_TRUE(cookie_value1->GetString(keys::kNameKey, &string_value));
+ EXPECT_EQ("ABC", string_value);
+ EXPECT_TRUE(cookie_value1->GetString(keys::kValueKey, &string_value));
+ EXPECT_EQ("DEF", string_value);
+ EXPECT_TRUE(cookie_value1->GetString(keys::kDomainKey, &string_value));
+ EXPECT_EQ("www.foobar.com", string_value);
+ EXPECT_TRUE(cookie_value1->GetBoolean(keys::kHostOnlyKey, &boolean_value));
+ EXPECT_EQ(true, boolean_value);
+ EXPECT_TRUE(cookie_value1->GetString(keys::kPathKey, &string_value));
+ EXPECT_EQ("/", string_value);
+ EXPECT_TRUE(cookie_value1->GetBoolean(keys::kSecureKey, &boolean_value));
+ EXPECT_EQ(false, boolean_value);
+ EXPECT_TRUE(cookie_value1->GetBoolean(keys::kHttpOnlyKey, &boolean_value));
+ EXPECT_EQ(false, boolean_value);
+ EXPECT_TRUE(cookie_value1->GetBoolean(keys::kSessionKey, &boolean_value));
+ EXPECT_EQ(true, boolean_value);
+ EXPECT_FALSE(
+ cookie_value1->GetReal(keys::kExpirationDateKey, &double_value));
+ EXPECT_TRUE(cookie_value1->GetString(keys::kStoreIdKey, &string_value));
+ EXPECT_EQ("some cookie store", string_value);
+
+ net::CookieMonster::CanonicalCookie cookie2(
+ "ABC", "DEF", "/", false, false,
+ base::Time(), base::Time(), true, base::Time::FromDoubleT(10000));
+ net::CookieMonster::CookieListPair cookie_pair2(".foobar.com", cookie2);
+ scoped_ptr<DictionaryValue> cookie_value2(
+ helpers::CreateCookieValue(cookie_pair2, "some cookie store"));
+ EXPECT_TRUE(cookie_value2->GetBoolean(keys::kHostOnlyKey, &boolean_value));
+ EXPECT_EQ(false, boolean_value);
+ EXPECT_TRUE(cookie_value2->GetBoolean(keys::kSessionKey, &boolean_value));
+ EXPECT_EQ(false, boolean_value);
+ EXPECT_TRUE(cookie_value2->GetReal(keys::kExpirationDateKey, &double_value));
+ EXPECT_EQ(10000, double_value);
+
+ TestingProfile profile;
+ ListValue* tab_ids = new ListValue();
+ scoped_ptr<DictionaryValue> cookie_store_value(
+ helpers::CreateCookieStoreValue(&profile, tab_ids));
+ EXPECT_TRUE(cookie_store_value->GetString(keys::kIdKey, &string_value));
+ EXPECT_EQ("0", string_value);
+ EXPECT_TRUE(cookie_store_value->Get(keys::kTabIdsKey, &value));
+ EXPECT_EQ(tab_ids, value);
+}
+
+TEST_F(ExtensionCookiesTest, GetURLFromCookiePair) {
+ net::CookieMonster::CanonicalCookie cookie1(
+ "ABC", "DEF", "/", false, false,
+ base::Time(), base::Time(), false, base::Time());
+ net::CookieMonster::CookieListPair cookie_pair1("www.foobar.com", cookie1);
+ EXPECT_EQ("http://www.foobar.com/",
+ helpers::GetURLFromCookiePair(cookie_pair1).spec());
+
+ net::CookieMonster::CanonicalCookie cookie2(
+ "ABC", "DEF", "/", true, false,
+ base::Time(), base::Time(), false, base::Time());
+ net::CookieMonster::CookieListPair cookie_pair2(".helloworld.com", cookie2);
+ EXPECT_EQ("https://helloworld.com/",
+ helpers::GetURLFromCookiePair(cookie_pair2).spec());
+}
+
+TEST_F(ExtensionCookiesTest, EmptyDictionary) {
+ scoped_ptr<DictionaryValue> details(new DictionaryValue());
+ helpers::MatchFilter filter(details.get());
+ std::string domain;
+ net::CookieMonster::CanonicalCookie cookie;
+ net::CookieMonster::CookieListPair cookie_pair(domain, cookie);
+
+ EXPECT_TRUE(filter.MatchesCookie(cookie_pair));
+}
+
+TEST_F(ExtensionCookiesTest, DomainMatching) {
+ const DomainMatchCase tests[] = {
+ { "bar.com", "bar.com", true },
+ { ".bar.com", "bar.com", true },
+ { "bar.com", "foo.bar.com", true },
+ { "bar.com", "bar.foo.com", false },
+ { ".bar.com", ".foo.bar.com", true },
+ { ".bar.com", "baz.foo.bar.com", true },
+ { "foo.bar.com", ".bar.com", false }
+ };
+
+ scoped_ptr<DictionaryValue> details(new DictionaryValue());
+ net::CookieMonster::CanonicalCookie cookie;
+ for (size_t i = 0; i < arraysize(tests); ++i) {
+ details->SetString(keys::kDomainKey, std::string(tests[i].filter));
+ helpers::MatchFilter filter(details.get());
+ net::CookieMonster::CookieListPair cookie_pair(tests[i].domain, cookie);
+ EXPECT_EQ(tests[i].matches, filter.MatchesCookie(cookie_pair));
+ }
+}
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 6bfbbbb..a0b846a 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/extensions/extension_browser_actions_api.h"
#include "chrome/browser/extensions/extension_clipboard_api.h"
#include "chrome/browser/extensions/extension_context_menu_api.h"
+#include "chrome/browser/extensions/extension_cookies_api.h"
#include "chrome/browser/extensions/extension_dom_ui.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/extensions/extension_history_api.h"
@@ -197,6 +198,13 @@ void FactoryRegistry::ResetFunctions() {
RegisterFunction<MetricsRecordMediumTimeFunction>();
RegisterFunction<MetricsRecordLongTimeFunction>();
+ // Cookies.
+ RegisterFunction<GetCookieFunction>();
+ RegisterFunction<GetAllCookiesFunction>();
+ RegisterFunction<SetCookieFunction>();
+ RegisterFunction<RemoveCookieFunction>();
+ RegisterFunction<GetAllCookieStoresFunction>();
+
// Test.
RegisterFunction<ExtensionTestPassFunction>();
RegisterFunction<ExtensionTestFailFunction>();
diff --git a/chrome/browser/extensions/extension_storage_apitest.cc b/chrome/browser/extensions/extension_storage_apitest.cc
index 9733dd6..032c6ba 100644
--- a/chrome/browser/extensions/extension_storage_apitest.cc
+++ b/chrome/browser/extensions/extension_storage_apitest.cc
@@ -14,7 +14,3 @@
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Storage) {
ASSERT_TRUE(RunExtensionTest("storage")) << message_;
}
-
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Cookies) {
- ASSERT_TRUE(RunExtensionTest("cookies")) << message_;
-}
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 4653ad4..32a2c1d 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1015,6 +1015,12 @@
'browser/extensions/extension_context_menu_api.h',
'browser/extensions/extension_context_menu_model.cc',
'browser/extensions/extension_context_menu_model.h',
+ 'browser/extensions/extension_cookies_api.cc',
+ 'browser/extensions/extension_cookies_api.h',
+ 'browser/extensions/extension_cookies_api_constants.cc',
+ 'browser/extensions/extension_cookies_api_constants.h',
+ 'browser/extensions/extension_cookies_helpers.cc',
+ 'browser/extensions/extension_cookies_helpers.h',
'browser/extensions/extension_creator.cc',
'browser/extensions/extension_creator.h',
'browser/extensions/extension_data_deleter.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 4b51194..3a46a7d 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1328,6 +1328,8 @@
'browser/extensions/extension_browsertests_misc.cc',
'browser/extensions/extension_clipboard_apitest.cc',
'browser/extensions/extension_context_menu_apitest.cc',
+ 'browser/extensions/extension_cookies_apitest.cc',
+ 'browser/extensions/extension_cookies_unittest.cc',
'browser/extensions/extension_crash_recovery_browsertest.cc',
'browser/extensions/extension_geolocation_apitest.cc',
'browser/extensions/extension_get_views_apitest.cc',
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index 794248a..24c473e 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -2758,6 +2758,168 @@
"events": []
},
{
+ "namespace": "experimental.cookies",
+ "types": [
+ {
+ "id": "Cookie",
+ "type": "object",
+ "description": "Represents information about an HTTP cookie.",
+ "properties": {
+ "name": {"type": "string", "description": "The name of the cookie."},
+ "value": {"type": "string", "description": "The value of the cookie."},
+ "domain": {"type": "string", "description": "The domain of the cookie (e.g. \"www.google.com\", \"example.com\")."},
+ "hostOnly": {"type": "boolean", "description": "True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie)."},
+ "path": {"type": "string", "description": "The path of the cookie."},
+ "secure": {"type": "boolean", "description": "True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS)."},
+ "httpOnly": {"type": "boolean", "description": "True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts)."},
+ "session": {"type": "boolean", "description": "True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date."},
+ "expirationDate": {"type": "number", "optional": true, "description": "The expiration date of the cookie as the number of milliseconds since the UNIX epoch. Not provided for session cookies."},
+ "storeId": {"type": "string", "description": "The ID of the cookie store containing this cookie, as provided in getAllCookieStores()."}
+ }
+ },
+ {
+ "id": "CookieStore",
+ "type": "object",
+ "description": "Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window.",
+ "properties": {
+ "id": {"type": "string", "description": "The unique identifier for the cookie store."},
+ "tabIds": {"type": "array", "items": {"type": "integer"}, "description": "Identifiers of all the browser tabs that share this cookie store."}
+ }
+ }
+ ],
+ "functions": [
+ {
+ "name": "get",
+ "type": "function",
+ "description": "Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest domain property will be returned. For cookies with the same domain property length, the one with the longest path length will be returned. If domains and paths are equal, then the cookie with the earliest creation time will be returned.",
+ "parameters": [
+ {
+ "type": "object",
+ "name": "details",
+ "description": "Details to identify the cookie being retrieved.",
+ "properties": {
+ "url": {"type": "string", "description": "The URL with which the cookie to retrieve is associated. This argument may be a full URL, in which case any data following the URL path (e.g. the query string) is simply ignored. If host permissions for this URL are not specified in the manifest file, the API call will fail."},
+ "name": {"type": "string", "description": "The name of the cookie to retrieve."},
+ "storeId": {"type": "string", "optional": true, "description": "The ID of the cookie store in which to look for the cookie. By default, the current execution context's cookie store will be used."}
+ }
+ },
+ {
+ "type": "function",
+ "name": "callback",
+ "parameters": [
+ {
+ "name": "cookie", "$ref": "Cookie", "optional": true, "description": "Contains details about the cookie. This parameter is null if no such cookie was found."
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "getAll",
+ "type": "function",
+ "description": "Retrieves all cookies from a single cookie store that match the given information.",
+ "parameters": [
+ {
+ "type": "object",
+ "name": "details",
+ "description": "Information to filter the cookies being retrieved.",
+ "properties": {
+ "url": {"type": "string", "optional": true, "description": "Restricts the retrieved cookies to those that would match the given URL."},
+ "name": {"type": "string", "optional": true, "description": "Filters the cookies by name."},
+ "domain": {"type": "string", "optional": true, "description": "Restricts the retrieved cookies to those whose domains match or are subdomains of this one."},
+ "path": {"type": "string", "optional": true, "description": "Restricts the retrieved cookies to those whose path exactly matches this string."},
+ "secure": {"type": "boolean", "optional": true, "description": "Filters the cookies by their Secure property."},
+ "session": {"type": "boolean", "optional": true, "description": "Filters out session vs. persistent cookies."},
+ "storeId": {"type": "string", "optional": true, "description": "The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used."}
+ }
+ },
+ {
+ "type": "function",
+ "name": "callback",
+ "parameters": [
+ {
+ "name": "cookies", "type": "array", "items": {"$ref": "Cookie"}, "description": "All the existing, unexpired cookies that match the given cookie info."
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "set",
+ "type": "function",
+ "description": "Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.",
+ "parameters": [
+ {
+ "type": "object",
+ "name": "details",
+ "description": "Details about the cookie being set.",
+ "properties": {
+ "url": {"type": "string", "description": "The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail."},
+ "name": {"type": "string", "optional": true, "description": "The name of the cookie. Empty by default if omitted."},
+ "value": {"type": "string", "optional": true, "description": "The value of the cookie. Empty by default if omitted."},
+ "domain": {"type": "string", "optional": true, "description": "The domain of the cookie. If omitted, the cookie becomes a host-only cookie."},
+ "path": {"type": "string", "optional": true, "description": "The path of the cookie. Defaults to the path portion of the url parameter."},
+ "secure": {"type": "boolean", "optional": true, "description": "Whether the cookie should be marked as Secure. Defaults to false."},
+ "httpOnly": {"type": "boolean", "optional": true, "description": "Whether the cookie should be marked as HttpOnly. Defaults to false."},
+ "expirationDate": {"type": "number", "optional": true, "description": "The expiration date of the cookie as the number of milliseconds since the UNIX epoch. If omitted, the cookie becomes a session cookie."},
+ "storeId": {"type": "string", "optional": true, "description": "The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store."}
+ }
+ }
+ ]
+ },
+ {
+ "name": "remove",
+ "type": "function",
+ "description": "Deletes a cookie by name.",
+ "parameters": [
+ {
+ "type": "object",
+ "name": "details",
+ "description": "Information to identify the cookie to remove.",
+ "properties": {
+ "url": {"type": "string", "description": "The URL associated with the cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail."},
+ "name": {"type": "string", "description": "The name of the cookie to remove."},
+ "storeId": {"type": "string", "optional": true, "description": "The ID of the cookie store to look in for the cookie. If unspecified, the cookie is looked for by default in the current execution context's cookie store."}
+ }
+ }
+ ]
+ },
+ {
+ "name": "getAllCookieStores",
+ "type": "function",
+ "description": "Lists all existing cookie stores.",
+ "parameters": [
+ {
+ "type": "function",
+ "name": "callback",
+ "parameters": [
+ {
+ "name": "cookieStores", "type": "array", "items": {"$ref": "CookieStore"}, "description": "All the existing cookie stores."
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "onChanged",
+ "type": "function",
+ "description": "Fired when a cookie is set or removed.",
+ "parameters": [
+ {
+ "type": "object",
+ "name": "changeInfo",
+ "properties": {
+ "removed": {"type": "boolean", "description": "True if a cookie was removed."},
+ "cookie": {"$ref": "Cookie", "description": "Information about the cookie that was set or removed."}
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
"namespace": "test",
"nodoc": true,
"types": [],
diff --git a/chrome/common/extensions/docs/experimental.contextMenu.html b/chrome/common/extensions/docs/experimental.contextMenu.html
index ad5793a..f416d0d 100644
--- a/chrome/common/extensions/docs/experimental.contextMenu.html
+++ b/chrome/common/extensions/docs/experimental.contextMenu.html
@@ -227,6 +227,10 @@
<a href="#method-create">create</a>
</li><li>
<a href="#method-remove">remove</a>
+ </li><li>
+ <a href="#method-removeAll">removeAll</a>
+ </li><li>
+ <a href="#method-update">update</a>
</li>
</ol>
</li>
@@ -911,6 +915,596 @@ see the <a href="experimental.html">chrome.experimental.* APIs</a> page.
</div> <!-- /description -->
+ </div><div class="apiItem">
+ <a name="method-removeAll"></a> <!-- method-anchor -->
+ <h4>removeAll</h4>
+
+ <div class="summary"><span style="display: none; ">void</span>
+ <!-- Note: intentionally longer 80 columns -->
+ <span>chrome.experimental.contextMenu.removeAll</span>(<span class="optional"><span style="display: none; ">, </span><span>function</span>
+ <var><span>callback</span></var></span>)</div>
+
+ <div class="description">
+ <p class="todo" style="display: none; ">Undocumented.</p>
+ <p>Remove all context menu items added by this extension.</p>
+
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>callback</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>function</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Called when removal is complete.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+
+ <!-- RETURNS -->
+ <h4 style="display: none; ">Returns</h4>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ <!-- CALLBACK -->
+ <div>
+ <div>
+ <h4>Callback function</h4>
+ <p style="display: none; ">
+ The callback <em>parameter</em> should specify a function
+ that looks like this:
+ </p>
+ <p>
+ If you specify the <em>callback</em> parameter, it should
+ specify a function that looks like this:
+ </p>
+
+ <!-- Note: intentionally longer 80 columns -->
+ <pre>function(<span></span>) <span class="subdued">{...}</span>);</pre>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+ </div>
+ </div>
+
+ </div> <!-- /description -->
+
+ </div><div class="apiItem">
+ <a name="method-update"></a> <!-- method-anchor -->
+ <h4>update</h4>
+
+ <div class="summary"><span style="display: none; ">void</span>
+ <!-- Note: intentionally longer 80 columns -->
+ <span>chrome.experimental.contextMenu.update</span>(<span class="null"><span style="display: none; ">, </span><span>integer</span>
+ <var><span>id</span></var></span><span class="null"><span>, </span><span>object</span>
+ <var><span>updateProperties</span></var></span><span class="optional"><span>, </span><span>function</span>
+ <var><span>callback</span></var></span>)</div>
+
+ <div class="description">
+ <p class="todo" style="display: none; ">Undocumented.</p>
+ <p>Update a previously created context menu item.</p>
+
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>id</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>integer</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The id of the item to update.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>updateProperties</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>object</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The properties to update. Accepts the same values as the create function.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>type</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>title</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>checked</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>boolean</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>contexts</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span>
+ array of <span><span>
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span></span>
+ </span>
+ <span style="display: none; ">paramType</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>enabledContexts</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span>
+ array of <span><span>
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span></span>
+ </span>
+ <span style="display: none; ">paramType</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>onclick</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>function</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>parentId</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>integer</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Note: you cannot change an item to be a child of one of it's own descendants.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>callback</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>function</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Called when the context menu has been updated.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+
+ <!-- RETURNS -->
+ <h4 style="display: none; ">Returns</h4>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ <!-- CALLBACK -->
+ <div>
+ <div>
+ <h4>Callback function</h4>
+ <p style="display: none; ">
+ The callback <em>parameter</em> should specify a function
+ that looks like this:
+ </p>
+ <p>
+ If you specify the <em>callback</em> parameter, it should
+ specify a function that looks like this:
+ </p>
+
+ <!-- Note: intentionally longer 80 columns -->
+ <pre>function(<span></span>) <span class="subdued">{...}</span>);</pre>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+ </div>
+ </div>
+
+ </div> <!-- /description -->
+
</div> <!-- /apiItem -->
</div> <!-- /apiGroup -->
diff --git a/chrome/common/extensions/docs/experimental.cookies.html b/chrome/common/extensions/docs/experimental.cookies.html
new file mode 100644
index 0000000..8a1208e
--- /dev/null
+++ b/chrome/common/extensions/docs/experimental.cookies.html
@@ -0,0 +1,2677 @@
+<!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc. Note:
+ 1) The <head> information in this page is significant, should be uniform
+ across api docs and should be edited only with knowledge of the
+ templating mechanism.
+ 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a
+ browser, it will be re-generated from the template, json schema and
+ authored overview content.
+ 4) The <body>.innerHTML is also generated by an offline step so that this
+ page may easily be indexed by search engines.
+--><html xmlns="http://www.w3.org/1999/xhtml"><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css">
+ <link href="css/print.css" rel="stylesheet" type="text/css" media="print">
+ <script type="text/javascript" src="../../../third_party/jstemplate/jstemplate_compiled.js">
+ </script>
+ <script type="text/javascript" src="js/api_page_generator.js"></script>
+ <script type="text/javascript" src="js/bootstrap.js"></script>
+ <title>chrome.experimental.cookies - 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>
+ <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION -->
+ <!-- In particular, sub-templates that recurse, must be used by allowing
+ jstemplate to make a copy of the template in this section which
+ are not operated on by way of the jsskip="true" -->
+ <div style="display:none">
+
+ <!-- VALUE -->
+ <div id="valueTemplate">
+ <dt>
+ <var>paramName</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span>
+ <a> Type</a>
+ </span>
+ <span>
+ <span>
+ array of <span><span></span></span>
+ </span>
+ <span>paramType</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd>
+ Description of this parameter from the json schema.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd>
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div> <!-- /VALUE -->
+
+ </div> <!-- /SUBTEMPLATES -->
+
+ <a id="top"></a>
+ <div id="skipto">
+ <a href="#gc-pagecontent">Skip to page content</a>
+ <a href="#gc-toc">Skip to main navigation</a>
+ </div>
+ <!-- API HEADER -->
+ <table id="header" width="100%" cellspacing="0" border="0">
+ <tbody><tr>
+ <td valign="middle"><a href="http://code.google.com/"><img src="images/code_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border:0; margin:0;"></a></td>
+ <td valign="middle" width="100%" style="padding-left:0.6em;">
+ <form action="http://www.google.com/cse" id="cse" style="margin-top:0.5em">
+ <div id="gsc-search-box">
+ <input type="hidden" name="cx" value="002967670403910741006:61_cvzfqtno">
+ <input type="hidden" name="ie" value="UTF-8">
+ <input type="text" name="q" value="" size="55">
+ <input class="gsc-search-button" type="submit" name="sa" value="Search">
+ <br>
+ <span class="greytext">e.g. "page action" or "tabs"</span>
+ </div>
+ </form>
+
+ <script type="text/javascript" src="http://www.google.com/jsapi"></script>
+ <script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script>
+ <script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse&amp;t13n_langs=en"></script>
+ <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse&amp;lang=en"></script>
+ </td>
+ </tr>
+ </tbody></table>
+
+ <div id="codesiteContent" class="">
+
+ <a id="gc-topnav-anchor"></a>
+ <div id="gc-topnav">
+ <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Labs</a>)</h1>
+ <ul id="home" class="gc-topnav-tabs">
+ <li id="home_link">
+ <a href="index.html" title="Google Chrome Extensions home page">Home</a>
+ </li>
+ <li id="docs_link">
+ <a href="docs.html" title="Official Google Chrome Extensions documentation">Docs</a>
+ </li>
+ <li id="faq_link">
+ <a href="faq.html" title="Answers to frequently asked questions about Google Chrome Extensions">FAQ</a>
+ </li>
+ <li id="samples_link">
+ <a href="samples.html" title="Sample extensions (with source code)">Samples</a>
+ </li>
+ <li id="group_link">
+ <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions" title="Google Chrome Extensions developer forum">Group</a>
+ </li>
+ </ul>
+ </div> <!-- end gc-topnav -->
+
+ <div class="g-section g-tpl-170">
+ <!-- SIDENAV -->
+ <div class="g-unit g-first" id="gc-toc">
+ <ul>
+ <li><a href="getstarted.html">Getting Started</a></li>
+ <li><a href="overview.html">Overview</a></li>
+ <li><h2><a href="devguide.html">Developer's Guide</a></h2>
+ <ul>
+ <li>Browser UI
+ <ul>
+ <li><a href="browserAction.html">Browser Actions</a></li>
+ <li><a href="options.html">Options Pages</a></li>
+ <li><a href="override.html">Override Pages</a></li>
+ <li><a href="pageAction.html">Page Actions</a></li>
+ <li><a href="themes.html">Themes</a></li>
+ </ul>
+ </li>
+ <li>Browser Interaction
+ <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>
+ </li>
+ <li>Implementation
+ <ul>
+ <li><a href="background_pages.html">Background Pages</a></li>
+ <li><a href="content_scripts.html">Content Scripts</a></li>
+ <li><a href="xhr.html">Cross-Origin XHR</a></li>
+ <li><a href="i18n.html">Internationalization</a></li>
+ <li><a href="messaging.html">Message Passing</a></li>
+ <li><a href="npapi.html">NPAPI Plugins</a></li>
+ </ul>
+ </li>
+ <li>Finishing
+ <ul>
+ <li><a href="autoupdate.html">Autoupdating</a></li>
+ <li><a href="packaging.html">Packaging</a></li>
+ <li><a href="external_extensions.html">External Extensions</a></li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li><h2><a href="tutorials.html">Tutorials</a></h2>
+ <ul>
+ <li><a href="tut_debugging.html">Debugging</a></li>
+ <li><a href="tut_analytics.html">Google Analytics</a></li>
+ <li><a href="tut_oauth.html">OAuth</a></li>
+ </ul>
+ </li>
+ <li><h2>Reference</h2>
+ <ul>
+ <li>Formats
+ <ul>
+ <li><a href="manifest.html">Manifest Files</a></li>
+ <li><a href="match_patterns.html">Match Patterns</a></li>
+ <!-- <li>Packages (.crx)</li> -->
+ </ul>
+ </li>
+ <li><a href="api_index.html">chrome.* APIs</a></li>
+ <li><a href="api_other.html">Other APIs</a></li>
+ </ul>
+ </li>
+ <li><h2><a href="samples.html">Samples</a></h2></li>
+ </ul>
+ </div>
+
+ <div class="g-unit" id="gc-pagecontent">
+ <div id="pageTitle">
+ <h1 class="page_title">chrome.experimental.cookies</h1>
+ </div>
+ <!-- TABLE OF CONTENTS -->
+ <div id="toc">
+ <h2>Contents</h2>
+ <ol>
+ <li style="display: none; ">
+ <a>h2Name</a>
+ <ol>
+ <li>
+ <a>h3Name</a>
+ </li>
+ </ol>
+ </li>
+ <li>
+ <a href="#apiReference">API reference: chrome.experimental.cookies</a>
+ <ol>
+ <li style="display: none; ">
+ <a href="#properties">Properties</a>
+ <ol>
+ <li>
+ <a href="#property-anchor">propertyName</a>
+ </li>
+ </ol>
+ </li>
+ <li>
+ <a href="#methods">Methods</a>
+ <ol>
+ <li>
+ <a href="#method-get">get</a>
+ </li><li>
+ <a href="#method-getAll">getAll</a>
+ </li><li>
+ <a href="#method-getAllCookieStores">getAllCookieStores</a>
+ </li><li>
+ <a href="#method-remove">remove</a>
+ </li><li>
+ <a href="#method-set">set</a>
+ </li>
+ </ol>
+ </li>
+ <li>
+ <a href="#events">Events</a>
+ <ol>
+ <li>
+ <a href="#event-onChanged">onChanged</a>
+ </li>
+ </ol>
+ </li>
+ <li>
+ <a href="#types">Types</a>
+ <ol>
+ <li>
+ <a href="#type-Cookie">Cookie</a>
+ </li><li>
+ <a href="#type-CookieStore">CookieStore</a>
+ </li>
+ </ol>
+ </li>
+ </ol>
+ </li>
+ </ol>
+ </div>
+ <!-- /TABLE OF CONTENTS -->
+
+ <!-- STATIC CONTENT PLACEHOLDER -->
+ <div id="static"></div>
+
+ <!-- API PAGE -->
+ <div class="apiPage">
+ <a name="apiReference"></a>
+ <h2>API reference: chrome.experimental.cookies</h2>
+
+ <!-- PROPERTIES -->
+ <div class="apiGroup" style="display: none; ">
+ <a name="properties"></a>
+ <h3 id="properties">Properties</h3>
+
+ <div>
+ <a></a>
+ <h4>getLastError</h4>
+ <div class="summary">
+ <!-- Note: intentionally longer 80 columns -->
+ <span>chrome.extension</span><span>lastError</span>
+ </div>
+ <div>
+ </div>
+ </div>
+
+ </div> <!-- /apiGroup -->
+
+ <!-- METHODS -->
+ <div class="apiGroup" id="methods">
+ <a name="methods"></a>
+ <h3>Methods</h3>
+
+ <!-- iterates over all functions -->
+ <div class="apiItem">
+ <a name="method-get"></a> <!-- method-anchor -->
+ <h4>get</h4>
+
+ <div class="summary"><span style="display: none; ">void</span>
+ <!-- Note: intentionally longer 80 columns -->
+ <span>chrome.experimental.cookies.get</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">
+ <p class="todo" style="display: none; ">Undocumented.</p>
+ <p>Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest domain property will be returned. For cookies with the same domain property length, the one with the longest path length will be returned. If domains and paths are equal, then the cookie with the earliest creation time will be returned.</p>
+
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>details</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>object</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Details to identify the cookie being retrieved.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>url</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The URL with which the cookie to retrieve is associated. This argument may be a full URL, in which case any data following the URL path (e.g. the query string) is simply ignored. If host permissions for this URL are not specified in the manifest file, the API call will fail.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>name</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The name of the cookie to retrieve.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>storeId</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The ID of the cookie store in which to look for the cookie. By default, the current execution context's cookie store will be used.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>callback</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>function</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+
+ <!-- RETURNS -->
+ <h4 style="display: none; ">Returns</h4>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ <!-- CALLBACK -->
+ <div>
+ <div>
+ <h4>Callback function</h4>
+ <p>
+ The callback <em>parameter</em> should specify a function
+ that looks like this:
+ </p>
+ <p style="display: none; ">
+ If you specify the <em>callback</em> parameter, it should
+ specify a function that looks like this:
+ </p>
+
+ <!-- Note: intentionally longer 80 columns -->
+ <pre>function(<span>Cookie cookie</span>) <span class="subdued">{...}</span>);</pre>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>cookie</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span>
+ <a href="experimental.cookies.html#type-Cookie">Cookie</a>
+ </span>
+ <span style="display: none; ">
+ <span>
+ array of <span><span></span></span>
+ </span>
+ <span>paramType</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Contains details about the cookie. This parameter is null if no such cookie was found.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ </div>
+ </div>
+
+ </div> <!-- /description -->
+
+ </div><div class="apiItem">
+ <a name="method-getAll"></a> <!-- method-anchor -->
+ <h4>getAll</h4>
+
+ <div class="summary"><span style="display: none; ">void</span>
+ <!-- Note: intentionally longer 80 columns -->
+ <span>chrome.experimental.cookies.getAll</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">
+ <p class="todo" style="display: none; ">Undocumented.</p>
+ <p>Retrieves all cookies from a single cookie store that match the given information.</p>
+
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>details</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>object</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Information to filter the cookies being retrieved.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>url</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Restricts the retrieved cookies to those that would match the given URL.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>name</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Filters the cookies by name.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>domain</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Restricts the retrieved cookies to those whose domains match or are subdomains of this one.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>path</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Restricts the retrieved cookies to those whose path exactly matches this string.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>secure</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>boolean</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Filters the cookies by their Secure property.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>session</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>boolean</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Filters out session vs. persistent cookies.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>storeId</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>callback</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>function</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+
+ <!-- RETURNS -->
+ <h4 style="display: none; ">Returns</h4>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ <!-- CALLBACK -->
+ <div>
+ <div>
+ <h4>Callback function</h4>
+ <p>
+ The callback <em>parameter</em> should specify a function
+ that looks like this:
+ </p>
+ <p style="display: none; ">
+ If you specify the <em>callback</em> parameter, it should
+ specify a function that looks like this:
+ </p>
+
+ <!-- Note: intentionally longer 80 columns -->
+ <pre>function(<span>array of Cookie cookies</span>) <span class="subdued">{...}</span>);</pre>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>cookies</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span>
+ array of <span><span>
+ <span>
+ <a href="experimental.cookies.html#type-Cookie">Cookie</a>
+ </span>
+ <span style="display: none; ">
+ <span>
+ array of <span><span></span></span>
+ </span>
+ <span>paramType</span>
+ </span>
+ </span></span>
+ </span>
+ <span style="display: none; ">paramType</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>All the existing, unexpired cookies that match the given cookie info.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ </div>
+ </div>
+
+ </div> <!-- /description -->
+
+ </div><div class="apiItem">
+ <a name="method-getAllCookieStores"></a> <!-- method-anchor -->
+ <h4>getAllCookieStores</h4>
+
+ <div class="summary"><span style="display: none; ">void</span>
+ <!-- Note: intentionally longer 80 columns -->
+ <span>chrome.experimental.cookies.getAllCookieStores</span>(<span class="null"><span style="display: none; ">, </span><span>function</span>
+ <var><span>callback</span></var></span>)</div>
+
+ <div class="description">
+ <p class="todo" style="display: none; ">Undocumented.</p>
+ <p>Lists all existing cookie stores.</p>
+
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>callback</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>function</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+
+ <!-- RETURNS -->
+ <h4 style="display: none; ">Returns</h4>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ <!-- CALLBACK -->
+ <div>
+ <div>
+ <h4>Callback function</h4>
+ <p>
+ The callback <em>parameter</em> should specify a function
+ that looks like this:
+ </p>
+ <p style="display: none; ">
+ If you specify the <em>callback</em> parameter, it should
+ specify a function that looks like this:
+ </p>
+
+ <!-- Note: intentionally longer 80 columns -->
+ <pre>function(<span>array of CookieStore cookieStores</span>) <span class="subdued">{...}</span>);</pre>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>cookieStores</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span>
+ array of <span><span>
+ <span>
+ <a href="experimental.cookies.html#type-CookieStore">CookieStore</a>
+ </span>
+ <span style="display: none; ">
+ <span>
+ array of <span><span></span></span>
+ </span>
+ <span>paramType</span>
+ </span>
+ </span></span>
+ </span>
+ <span style="display: none; ">paramType</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>All the existing cookie stores.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ </div>
+ </div>
+
+ </div> <!-- /description -->
+
+ </div><div class="apiItem">
+ <a name="method-remove"></a> <!-- method-anchor -->
+ <h4>remove</h4>
+
+ <div class="summary"><span style="display: none; ">void</span>
+ <!-- Note: intentionally longer 80 columns -->
+ <span>chrome.experimental.cookies.remove</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>Deletes a cookie by name.</p>
+
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>details</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>object</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Information to identify the cookie to remove.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>url</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The URL associated with the cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>name</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The name of the cookie to remove.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>storeId</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The ID of the cookie store to look in for the cookie. If unspecified, the cookie is looked for by default in the current execution context's cookie store.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+
+ <!-- RETURNS -->
+ <h4 style="display: none; ">Returns</h4>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ <!-- CALLBACK -->
+ <div style="display: none; ">
+ <div>
+ <h4>Callback function</h4>
+ <p>
+ The callback <em>parameter</em> should specify a function
+ that looks like this:
+ </p>
+ <p>
+ If you specify the <em>callback</em> parameter, it should
+ specify a function that looks like this:
+ </p>
+
+ <!-- Note: intentionally longer 80 columns -->
+ <pre>function(<span>Type param1, Type param2</span>) <span class="subdued">{...}</span>);</pre>
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </div>
+ </div>
+
+ </div> <!-- /description -->
+
+ </div><div class="apiItem">
+ <a name="method-set"></a> <!-- method-anchor -->
+ <h4>set</h4>
+
+ <div class="summary"><span style="display: none; ">void</span>
+ <!-- Note: intentionally longer 80 columns -->
+ <span>chrome.experimental.cookies.set</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>Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.</p>
+
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>details</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>object</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Details about the cookie being set.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>url</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>name</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The name of the cookie. Empty by default if omitted.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>value</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The value of the cookie. Empty by default if omitted.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>domain</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The domain of the cookie. If omitted, the cookie becomes a host-only cookie.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>path</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The path of the cookie. Defaults to the path portion of the url parameter.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>secure</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>boolean</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Whether the cookie should be marked as Secure. Defaults to false.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>httpOnly</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>boolean</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Whether the cookie should be marked as HttpOnly. Defaults to false.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>expirationDate</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>number</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The expiration date of the cookie as the number of milliseconds since the UNIX epoch. If omitted, the cookie becomes a session cookie.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>storeId</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+
+ <!-- RETURNS -->
+ <h4 style="display: none; ">Returns</h4>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ <!-- CALLBACK -->
+ <div style="display: none; ">
+ <div>
+ <h4>Callback function</h4>
+ <p>
+ The callback <em>parameter</em> should specify a function
+ that looks like this:
+ </p>
+ <p>
+ If you specify the <em>callback</em> parameter, it should
+ specify a function that looks like this:
+ </p>
+
+ <!-- Note: intentionally longer 80 columns -->
+ <pre>function(<span>Type param1, Type param2</span>) <span class="subdued">{...}</span>);</pre>
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </div>
+ </div>
+
+ </div> <!-- /description -->
+
+ </div> <!-- /apiItem -->
+
+ </div> <!-- /apiGroup -->
+
+ <!-- EVENTS -->
+ <div class="apiGroup">
+ <a name="events"></a>
+ <h3 id="events">Events</h3>
+
+ <!-- iterates over all events -->
+ <div class="apiItem">
+ <a name="event-onChanged"></a>
+ <h4>onChanged</h4>
+
+ <div class="summary">
+ <!-- Note: intentionally longer 80 columns -->
+ <span class="subdued">chrome.experimental.cookies.</span><span>onChanged</span><span class="subdued">.addListener</span>(function(<span>object changeInfo</span>) <span class="subdued">{...}</span>);
+ </div>
+
+ <div class="description">
+ <p class="todo" style="display: none; ">Undocumented.</p>
+ <p>Fired when a cookie is set or removed.</p>
+
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>changeInfo</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>object</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>removed</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>boolean</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>True if a cookie was removed.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>cookie</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span>
+ <a href="experimental.cookies.html#type-Cookie">Cookie</a>
+ </span>
+ <span style="display: none; ">
+ <span>
+ array of <span><span></span></span>
+ </span>
+ <span>paramType</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Information about the cookie that was set or removed.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+
+ </div> <!-- /decription -->
+
+ </div> <!-- /apiItem -->
+
+ </div> <!-- /apiGroup -->
+
+ <!-- TYPES -->
+ <div class="apiGroup">
+ <a name="types.sort(sortByName)"></a>
+ <h3 id="types">Types</h3>
+
+ <!-- iterates over all types -->
+ <div class="apiItem">
+ <a name="type-Cookie"></a>
+ <h4>Cookie</h4>
+
+ <div>
+ <dt>
+ <var style="display: none; ">paramName</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>object</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Represents information about an HTTP cookie.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>name</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The name of the cookie.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>value</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The value of the cookie.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>domain</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The domain of the cookie (e.g. "www.google.com", "example.com").</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>hostOnly</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>boolean</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie).</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>path</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The path of the cookie.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>secure</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>boolean</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS).</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>httpOnly</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>boolean</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts).</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>session</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>boolean</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>expirationDate</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>number</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The expiration date of the cookie as the number of milliseconds since the UNIX epoch. Not provided for session cookies.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>storeId</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The ID of the cookie store containing this cookie, as provided in getAllCookieStores().</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+
+ </div><div class="apiItem">
+ <a name="type-CookieStore"></a>
+ <h4>CookieStore</h4>
+
+ <div>
+ <dt>
+ <var style="display: none; ">paramName</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>object</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>id</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The unique identifier for the cookie store.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>tabIds</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span>
+ array of <span><span>
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>integer</span>
+ </span>
+ </span></span>
+ </span>
+ <span style="display: none; ">paramType</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>Identifiers of all the browser tabs that share this cookie store.</dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+
+ </div> <!-- /apiItem -->
+
+ </div> <!-- /apiGroup -->
+
+ </div> <!-- /apiPage -->
+ </div> <!-- /gc-pagecontent -->
+ </div> <!-- /g-section -->
+ </div> <!-- /codesiteContent -->
+ <div id="gc-footer" --="">
+ <div class="text">
+ <p>
+ Except as otherwise <a href="http://code.google.com/policies.html#restrictions">noted</a>,
+ the content of this page is licensed under the <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons
+ Attribution 3.0 License</a>, and code samples are licensed under the
+ <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
+ </p>
+ <p>
+ ©2009 Google
+ </p>
+
+<!-- begin analytics -->
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
+<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>
+
+<script type="text/javascript">
+ // chrome doc tracking
+ try {
+ var engdocs = _gat._getTracker("YT-10763712-2");
+ engdocs._trackPageview();
+ } catch(err) {}
+
+ // code.google.com site-wide tracking
+ try {
+ _uacct="UA-18071-1";
+ _uanchor=1;
+ _uff=0;
+ urchinTracker();
+ }
+ catch(e) {/* urchinTracker not available. */}
+</script>
+<!-- end analytics -->
+ </div>
+ </div> <!-- /gc-footer -->
+ </div> <!-- /gc-container -->
+</body></html>
diff --git a/chrome/common/extensions/docs/experimental.html b/chrome/common/extensions/docs/experimental.html
index 8b52636..c21d70b 100644
--- a/chrome/common/extensions/docs/experimental.html
+++ b/chrome/common/extensions/docs/experimental.html
@@ -262,6 +262,7 @@ on the following experimental APIs:
<li>
<a href="experimental.clipboard.html">experimental.clipboard</a></li><li>
<a href="experimental.contextMenu.html">experimental.contextMenu</a></li><li>
+ <a href="experimental.cookies.html">experimental.cookies</a></li><li>
<a href="experimental.infobars.html">experimental.infobars</a></li><li>
<a href="experimental.processes.html">experimental.processes</a></li>
</ul>
diff --git a/chrome/common/extensions/docs/extension.html b/chrome/common/extensions/docs/extension.html
index 3c7f0cb..4a1f223 100644
--- a/chrome/common/extensions/docs/extension.html
+++ b/chrome/common/extensions/docs/extension.html
@@ -260,11 +260,11 @@
<a href="#types">Types</a>
<ol>
<li>
+ <a href="#type-MessageSender">MessageSender</a>
+ </li><li>
<a href="#type-Event">Event</a>
</li><li>
<a href="#type-Port">Port</a>
- </li><li>
- <a href="#type-MessageSender">MessageSender</a>
</li>
</ol>
</li>
@@ -1963,8 +1963,8 @@ For details, see
<!-- iterates over all types -->
<div class="apiItem">
- <a name="type-Event"></a>
- <h4>Event</h4>
+ <a name="type-MessageSender"></a>
+ <h4>MessageSender</h4>
<div>
<dt>
@@ -1994,7 +1994,7 @@ For details, see
<dd class="todo" style="display: none; ">
Undocumented.
</dd>
- <dd>An object which allows the addition and removal of listeners for a Chrome event.</dd>
+ <dd>An object containing information about the script context that sent a message or request.</dd>
<!-- OBJECT PROPERTIES -->
<dd>
@@ -2002,22 +2002,22 @@ For details, see
<div>
<div>
<dt>
- <var>addListener</var>
+ <var>tab</var>
<em>
<!-- TYPE -->
<div style="display:inline">
(
- <span class="optional" style="display: none; ">optional</span>
+ <span class="optional">optional</span>
<span id="typeTemplate">
- <span style="display: none; ">
- <a> Type</a>
- </span>
<span>
- <span style="display: none; ">
+ <a href="tabs.html#type-Tab">Tab</a>
+ </span>
+ <span style="display: none; ">
+ <span>
array of <span><span></span></span>
</span>
- <span>function</span>
+ <span>paramType</span>
</span>
</span>
)
@@ -2025,12 +2025,10 @@ For details, see
</em>
</dt>
- <dd class="todo">
+ <dd class="todo" style="display: none; ">
Undocumented.
</dd>
- <dd style="display: none; ">
- Description of this parameter from the json schema.
- </dd>
+ <dd>This property will <b>only</b> be present when the connection was opened from a tab or content script.</dd>
<!-- OBJECT PROPERTIES -->
<dd style="display: none; ">
@@ -2045,7 +2043,7 @@ For details, see
</div><div>
<div>
<dt>
- <var>removeListener</var>
+ <var>id</var>
<em>
<!-- TYPE -->
@@ -2060,7 +2058,7 @@ For details, see
<span style="display: none; ">
array of <span><span></span></span>
</span>
- <span>function</span>
+ <span>string</span>
</span>
</span>
)
@@ -2068,12 +2066,10 @@ For details, see
</em>
</dt>
- <dd class="todo">
+ <dd class="todo" style="display: none; ">
Undocumented.
</dd>
- <dd style="display: none; ">
- Description of this parameter from the json schema.
- </dd>
+ <dd>The extension ID of the extension that opened the connection.</dd>
<!-- OBJECT PROPERTIES -->
<dd style="display: none; ">
@@ -2085,10 +2081,18 @@ For details, see
</dl>
</dd>
</div>
- </div><div>
- <div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+
+ </div><div class="apiItem">
+ <a name="type-Event"></a>
+ <h4>Event</h4>
+
+ <div>
<dt>
- <var>hasListener</var>
+ <var style="display: none; ">paramName</var>
<em>
<!-- TYPE -->
@@ -2103,7 +2107,7 @@ For details, see
<span style="display: none; ">
array of <span><span></span></span>
</span>
- <span>function</span>
+ <span>object</span>
</span>
</span>
)
@@ -2111,27 +2115,18 @@ For details, see
</em>
</dt>
- <dd class="todo">
+ <dd class="todo" style="display: none; ">
Undocumented.
</dd>
- <dd style="display: none; ">
- Description of this parameter from the json schema.
- </dd>
+ <dd>An object which allows the addition and removal of listeners for a Chrome event.</dd>
<!-- OBJECT PROPERTIES -->
- <dd style="display: none; ">
+ <dd>
<dl>
<div>
<div>
- </div>
- </div>
- </dl>
- </dd>
- </div>
- </div><div>
- <div>
<dt>
- <var>hasListeners</var>
+ <var>addListener</var>
<em>
<!-- TYPE -->
@@ -2171,18 +2166,10 @@ For details, see
</dl>
</dd>
</div>
- </div>
- </dl>
- </dd>
- </div>
-
- </div><div class="apiItem">
- <a name="type-Port"></a>
- <h4>Port</h4>
-
- <div>
+ </div><div>
+ <div>
<dt>
- <var style="display: none; ">paramName</var>
+ <var>removeListener</var>
<em>
<!-- TYPE -->
@@ -2197,7 +2184,7 @@ For details, see
<span style="display: none; ">
array of <span><span></span></span>
</span>
- <span>object</span>
+ <span>function</span>
</span>
</span>
)
@@ -2205,18 +2192,27 @@ For details, see
</em>
</dt>
- <dd class="todo" style="display: none; ">
+ <dd class="todo">
Undocumented.
</dd>
- <dd>An object which allows two way communication with other pages.</dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
<!-- OBJECT PROPERTIES -->
- <dd>
+ <dd style="display: none; ">
<dl>
<div>
<div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
<dt>
- <var>name</var>
+ <var>hasListener</var>
<em>
<!-- TYPE -->
@@ -2231,7 +2227,7 @@ For details, see
<span style="display: none; ">
array of <span><span></span></span>
</span>
- <span>string</span>
+ <span>function</span>
</span>
</span>
)
@@ -2259,7 +2255,7 @@ For details, see
</div><div>
<div>
<dt>
- <var>onDisconnect</var>
+ <var>hasListeners</var>
<em>
<!-- TYPE -->
@@ -2267,14 +2263,14 @@ For details, see
(
<span class="optional" style="display: none; ">optional</span>
<span id="typeTemplate">
- <span>
- <a href="extension.html#type-Event">Event</a>
- </span>
<span style="display: none; ">
- <span>
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
array of <span><span></span></span>
</span>
- <span>paramType</span>
+ <span>function</span>
</span>
</span>
)
@@ -2299,10 +2295,18 @@ For details, see
</dl>
</dd>
</div>
- </div><div>
- <div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+
+ </div><div class="apiItem">
+ <a name="type-Port"></a>
+ <h4>Port</h4>
+
+ <div>
<dt>
- <var>onMessage</var>
+ <var style="display: none; ">paramName</var>
<em>
<!-- TYPE -->
@@ -2310,14 +2314,14 @@ For details, see
(
<span class="optional" style="display: none; ">optional</span>
<span id="typeTemplate">
- <span>
- <a href="extension.html#type-Event">Event</a>
- </span>
<span style="display: none; ">
- <span>
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
array of <span><span></span></span>
</span>
- <span>paramType</span>
+ <span>object</span>
</span>
</span>
)
@@ -2325,27 +2329,18 @@ For details, see
</em>
</dt>
- <dd class="todo">
+ <dd class="todo" style="display: none; ">
Undocumented.
</dd>
- <dd style="display: none; ">
- Description of this parameter from the json schema.
- </dd>
+ <dd>An object which allows two way communication with other pages.</dd>
<!-- OBJECT PROPERTIES -->
- <dd style="display: none; ">
+ <dd>
<dl>
<div>
<div>
- </div>
- </div>
- </dl>
- </dd>
- </div>
- </div><div>
- <div>
<dt>
- <var>postMessage</var>
+ <var>name</var>
<em>
<!-- TYPE -->
@@ -2360,7 +2355,7 @@ For details, see
<span style="display: none; ">
array of <span><span></span></span>
</span>
- <span>function</span>
+ <span>string</span>
</span>
</span>
)
@@ -2388,16 +2383,16 @@ For details, see
</div><div>
<div>
<dt>
- <var>sender</var>
+ <var>onDisconnect</var>
<em>
<!-- TYPE -->
<div style="display:inline">
(
- <span class="optional">optional</span>
+ <span class="optional" style="display: none; ">optional</span>
<span id="typeTemplate">
<span>
- <a href="extension.html#type-MessageSender">MessageSender</a>
+ <a href="extension.html#type-Event">Event</a>
</span>
<span style="display: none; ">
<span>
@@ -2411,10 +2406,12 @@ For details, see
</em>
</dt>
- <dd class="todo" style="display: none; ">
+ <dd class="todo">
Undocumented.
</dd>
- <dd>This property will <b>only</b> be present on ports passed to onConnect/onConnectExternal listeners.</dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
<!-- OBJECT PROPERTIES -->
<dd style="display: none; ">
@@ -2426,18 +2423,10 @@ For details, see
</dl>
</dd>
</div>
- </div>
- </dl>
- </dd>
- </div>
-
- </div><div class="apiItem">
- <a name="type-MessageSender"></a>
- <h4>MessageSender</h4>
-
- <div>
+ </div><div>
+ <div>
<dt>
- <var style="display: none; ">paramName</var>
+ <var>onMessage</var>
<em>
<!-- TYPE -->
@@ -2445,14 +2434,14 @@ For details, see
(
<span class="optional" style="display: none; ">optional</span>
<span id="typeTemplate">
- <span style="display: none; ">
- <a> Type</a>
- </span>
<span>
- <span style="display: none; ">
+ <a href="extension.html#type-Event">Event</a>
+ </span>
+ <span style="display: none; ">
+ <span>
array of <span><span></span></span>
</span>
- <span>object</span>
+ <span>paramType</span>
</span>
</span>
)
@@ -2460,33 +2449,42 @@ For details, see
</em>
</dt>
- <dd class="todo" style="display: none; ">
+ <dd class="todo">
Undocumented.
</dd>
- <dd>An object containing information about the script context that sent a message or request.</dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
<!-- OBJECT PROPERTIES -->
- <dd>
+ <dd style="display: none; ">
<dl>
<div>
<div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+ </div>
+ </div><div>
+ <div>
<dt>
- <var>tab</var>
+ <var>postMessage</var>
<em>
<!-- TYPE -->
<div style="display:inline">
(
- <span class="optional">optional</span>
+ <span class="optional" style="display: none; ">optional</span>
<span id="typeTemplate">
- <span>
- <a href="tabs.html#type-Tab">Tab</a>
- </span>
<span style="display: none; ">
- <span>
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
array of <span><span></span></span>
</span>
- <span>paramType</span>
+ <span>function</span>
</span>
</span>
)
@@ -2494,10 +2492,12 @@ For details, see
</em>
</dt>
- <dd class="todo" style="display: none; ">
+ <dd class="todo">
Undocumented.
</dd>
- <dd>This property will <b>only</b> be present when the connection was opened from a tab or content script.</dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </dd>
<!-- OBJECT PROPERTIES -->
<dd style="display: none; ">
@@ -2512,22 +2512,22 @@ For details, see
</div><div>
<div>
<dt>
- <var>id</var>
+ <var>sender</var>
<em>
<!-- TYPE -->
<div style="display:inline">
(
- <span class="optional" style="display: none; ">optional</span>
+ <span class="optional">optional</span>
<span id="typeTemplate">
- <span style="display: none; ">
- <a> Type</a>
- </span>
<span>
- <span style="display: none; ">
+ <a href="extension.html#type-MessageSender">MessageSender</a>
+ </span>
+ <span style="display: none; ">
+ <span>
array of <span><span></span></span>
</span>
- <span>string</span>
+ <span>paramType</span>
</span>
</span>
)
@@ -2538,7 +2538,7 @@ For details, see
<dd class="todo" style="display: none; ">
Undocumented.
</dd>
- <dd>The extension ID of the extension that opened the connection.</dd>
+ <dd>This property will <b>only</b> be present on ports passed to onConnect/onConnectExternal listeners.</dd>
<!-- OBJECT PROPERTIES -->
<dd style="display: none; ">
diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js
index 92fe2e3..b4ff23f 100644
--- a/chrome/renderer/resources/renderer_extension_bindings.js
+++ b/chrome/renderer/resources/renderer_extension_bindings.js
@@ -248,6 +248,7 @@ var chrome = chrome || {};
"experimental.bookmarkManager",
"experimental.clipboard",
"experimental.contextMenu",
+ "experimental.cookies",
"experimental.extension",
"experimental.idle",
"experimental.infobars",
diff --git a/chrome/test/data/extensions/api_test/cookies/manifest.json b/chrome/test/data/extensions/api_test/cookies/manifest.json
index ec86d63..ae162c9 100644
--- a/chrome/test/data/extensions/api_test/cookies/manifest.json
+++ b/chrome/test/data/extensions/api_test/cookies/manifest.json
@@ -3,5 +3,12 @@
"version": "0.1",
"description": "sanity test that cookies can be set and read from extensions",
"background_page": "background.html",
- "permissions": ["tabs"]
+ "permissions": [
+ "tabs",
+ "experimental",
+ "http://*.chrome_extensions.cookies.com/",
+ "http://chromium.cookies.com/",
+ "https://*.cookies.com/",
+ "http://.strange%20stuff%21%21.com/"
+ ]
}
diff --git a/chrome/test/data/extensions/api_test/cookies/tab.html b/chrome/test/data/extensions/api_test/cookies/tab.html
index 6bd51be..1e01e59 100644
--- a/chrome/test/data/extensions/api_test/cookies/tab.html
+++ b/chrome/test/data/extensions/api_test/cookies/tab.html
@@ -1,6 +1,46 @@
<script>
+var TEST_DOMAIN = 'cookies.com';
+var TEST_PATH = '/auth';
+var TEST_HOST = 'www.chrome_extensions.' + TEST_DOMAIN;
+var TEST_URL = 'http://' + TEST_HOST + '/foobar.html?arg=toolbar&param=true';
+var TEST_URL2 = 'http://chromium.' + TEST_DOMAIN + '/index.html';
+var TEST_URL3 = 'https://' + TEST_HOST + '/content.html';
+var TEST_URL4 = 'https://' + TEST_HOST + TEST_PATH + '/content.html';
+var TEST_URL5 = 'http://' + TEST_HOST + TEST_PATH + '/content.html';
+var TEST_EXPIRATION_DATE = 12345678900;
+var TEST_ODD_DOMAIN = '.strange stuff!!.com';
+var TEST_ODD_PATH = '/hello = world';
+var TEST_ODD_URL = 'http://' + TEST_ODD_DOMAIN + TEST_ODD_PATH + '/index.html';
+var TEST_UNPERMITTED_URL = 'http://illegal.' + TEST_DOMAIN + '/';
+
+var TEST_BASIC_COOKIE = {
+ url: TEST_URL,
+ name: 'api_test_cookie',
+ value: 'helloworld'
+};
+var TEST_DOMAIN_COOKIE = {
+ url: TEST_URL,
+ name: 'TEST_domain',
+ value: '32849395FFDSAA**##@@@',
+ domain: TEST_DOMAIN,
+ expirationDate: TEST_EXPIRATION_DATE
+};
+var TEST_SECURE_COOKIE = {
+ url: TEST_URL5,
+ name: 'SECRETCOOKIE',
+ value: 'foobar_password',
+ secure: true,
+ httpOnly: true
+};
+var TEST_BASIC_EXPIRED_COOKIE = {
+ url: TEST_BASIC_COOKIE.url,
+ name: TEST_BASIC_COOKIE.name,
+ value: TEST_BASIC_COOKIE.value,
+ expirationDate: 0
+};
+
function readCookie(name) {
- var nameEQ = name + "=";
+ var nameEQ = name + '=';
var cookies = document.cookie.split(';');
for(var i=0; i < cookies.length; i++) {
var c = cookies[i];
@@ -12,11 +52,245 @@ function readCookie(name) {
return null;
}
-chrome.test.runTests([function readCookies() {
- chrome.test.assertEq(readCookie("a"), "1");
- chrome.test.assertEq(readCookie("b"), "2");
- chrome.test.assertEq(readCookie("c"), "3");
- chrome.test.assertEq(readCookie("nonexistant"), null);
- chrome.test.succeed();
-}]);
+function expectValidCookie(cookie) {
+ chrome.test.assertTrue(cookie != null, 'Expected cookie not set.');
+}
+
+function expectNullCookie(cookie) {
+ chrome.test.assertEq(null, cookie);
+}
+
+function removeTestCookies() {
+ chrome.experimental.cookies.remove(
+ {url: TEST_URL, name: TEST_BASIC_COOKIE.name});
+ chrome.experimental.cookies.remove(
+ {url: TEST_URL, name: TEST_DOMAIN_COOKIE.name});
+ chrome.experimental.cookies.remove(
+ {url: TEST_URL4, name: TEST_SECURE_COOKIE.name});
+ chrome.experimental.cookies.remove({url: TEST_URL, name: 'abcd'});
+ chrome.experimental.cookies.remove({url: TEST_ODD_URL, name: 'abcd'});
+}
+
+var pass = chrome.test.callbackPass;
+var fail = chrome.test.callbackFail;
+
+chrome.test.runTests([
+ function readCookies() {
+ chrome.test.assertEq('1', readCookie('a'));
+ chrome.test.assertEq('2', readCookie('b'));
+ chrome.test.assertEq('3', readCookie('c'));
+ chrome.test.assertEq(null, readCookie('nonexistent'));
+ // Invalid schemes don't work with the cookie API.
+ chrome.experimental.cookies.get(
+ {url: document.location.href, name: 'a'},
+ fail('No host permissions for cookies at url: "' +
+ document.location.href + '".'));
+ },
+ function getBasicCookie() {
+ removeTestCookies();
+ chrome.experimental.cookies.set(TEST_BASIC_COOKIE);
+ // Domain doesn't match.
+ chrome.experimental.cookies.get(
+ {url: TEST_URL2, name: TEST_BASIC_COOKIE.name},
+ pass(expectNullCookie));
+ // URL invalid.
+ chrome.experimental.cookies.get(
+ {url: 'invalid url', name: TEST_BASIC_COOKIE.name},
+ fail('Invalid url: "invalid url".'));
+ // URL lacking permissions.
+ chrome.experimental.cookies.get(
+ {url: TEST_UNPERMITTED_URL, name: TEST_BASIC_COOKIE.name},
+ fail('No host permissions for cookies at url: "' +
+ TEST_UNPERMITTED_URL + '".'));
+ // Store ID invalid.
+ chrome.experimental.cookies.get({
+ url: TEST_BASIC_COOKIE.url,
+ name: TEST_BASIC_COOKIE.name,
+ storeId: 'invalid'
+ }, fail('Invalid cookie store id: "invalid".'));
+ chrome.experimental.cookies.get(
+ {url: TEST_BASIC_COOKIE.url, name: TEST_BASIC_COOKIE.name},
+ pass(function(cookie) {
+ expectValidCookie(cookie);
+ chrome.test.assertEq(TEST_BASIC_COOKIE.name, cookie.name);
+ chrome.test.assertEq(TEST_BASIC_COOKIE.value, cookie.value);
+ chrome.test.assertEq(TEST_HOST, cookie.domain);
+ chrome.test.assertEq(true, cookie.hostOnly);
+ chrome.test.assertEq('/', cookie.path);
+ chrome.test.assertEq(false, cookie.secure);
+ chrome.test.assertEq(false, cookie.httpOnly);
+ chrome.test.assertEq(true, cookie.session);
+ chrome.test.assertTrue(typeof cookie.expirationDate === 'undefined',
+ 'Session cookie should not have expirationDate property.');
+ chrome.test.assertTrue(typeof cookie.storeId !== 'undefined',
+ 'Cookie store ID not provided.');
+ }));
+ },
+ function getDomainCookie() {
+ removeTestCookies();
+ chrome.experimental.cookies.set(TEST_DOMAIN_COOKIE);
+ chrome.experimental.cookies.get(
+ {url: TEST_URL2, name: TEST_DOMAIN_COOKIE.name},
+ pass(function(cookie) {
+ expectValidCookie(cookie);
+ chrome.test.assertEq(TEST_DOMAIN_COOKIE.name, cookie.name);
+ chrome.test.assertEq(TEST_DOMAIN_COOKIE.value, cookie.value);
+ chrome.test.assertEq('.' + TEST_DOMAIN, cookie.domain);
+ chrome.test.assertEq(false, cookie.hostOnly);
+ chrome.test.assertEq('/', cookie.path);
+ chrome.test.assertEq(false, cookie.secure);
+ chrome.test.assertEq(false, cookie.httpOnly);
+ chrome.test.assertEq(false, cookie.session);
+ chrome.test.assertEq(TEST_EXPIRATION_DATE, cookie.expirationDate);
+ }));
+ },
+ function getSecureCookie() {
+ removeTestCookies();
+ chrome.experimental.cookies.set(TEST_SECURE_COOKIE);
+ // Original URL doesn't work because scheme isn't secure.
+ chrome.experimental.cookies.get(
+ {url: TEST_SECURE_COOKIE.url, name: TEST_SECURE_COOKIE.name},
+ pass(expectNullCookie));
+ // Path doesn't match.
+ chrome.experimental.cookies.get(
+ {url: TEST_URL3, name: TEST_SECURE_COOKIE.name},
+ pass(expectNullCookie));
+ chrome.experimental.cookies.get(
+ {url: TEST_URL4, name: TEST_SECURE_COOKIE.name},
+ pass(function(cookie) {
+ expectValidCookie(cookie);
+ chrome.test.assertEq(TEST_SECURE_COOKIE.name, cookie.name);
+ chrome.test.assertEq(TEST_SECURE_COOKIE.value, cookie.value);
+ chrome.test.assertEq(TEST_HOST, cookie.domain);
+ chrome.test.assertEq(true, cookie.hostOnly);
+ chrome.test.assertEq(TEST_PATH, cookie.path);
+ chrome.test.assertEq(true, cookie.secure);
+ chrome.test.assertEq(true, cookie.httpOnly);
+ chrome.test.assertEq(true, cookie.session);
+ }));
+ },
+ function setOddCookies() {
+ removeTestCookies();
+ // URL lacking permissions.
+ chrome.experimental.cookies.set(
+ {url: TEST_UNPERMITTED_URL, name: 'abcd', domain: TEST_DOMAIN});
+ chrome.experimental.cookies.get({url: TEST_URL, name: 'abcd'},
+ pass(expectNullCookie));
+ // Attribute values containing invalid characters are disallowed.
+ chrome.experimental.cookies.set({url: TEST_URL, name: 'abcd=efg'});
+ chrome.experimental.cookies.get({url: TEST_URL, name: 'abcd'},
+ pass(expectNullCookie));
+ chrome.experimental.cookies.set(
+ {url: TEST_URL, name: 'abcd', value: 'HI;LO'});
+ chrome.experimental.cookies.get({url: TEST_URL, name: 'abcd'},
+ pass(expectNullCookie));
+ chrome.experimental.cookies.set(
+ {url: TEST_URL, name: 'abcd', domain: 'cookies.com\r'});
+ chrome.experimental.cookies.get({url: TEST_URL, name: 'abcd'},
+ pass(expectNullCookie));
+ chrome.experimental.cookies.set(
+ {url: TEST_URL, name: 'abcd', domain: 'somedomain.com'});
+ chrome.experimental.cookies.get({url: TEST_URL, name: 'abcd'},
+ pass(expectNullCookie));
+ chrome.experimental.cookies.set({
+ url: TEST_ODD_URL,
+ name: 'abcd',
+ domain: TEST_ODD_DOMAIN,
+ path: TEST_ODD_PATH
+ });
+ chrome.experimental.cookies.get({url: TEST_ODD_URL, name: 'abcd'},
+ pass(function(cookie) {
+ expectValidCookie(cookie);
+ chrome.test.assertEq(TEST_ODD_DOMAIN, unescape(cookie.domain));
+ chrome.test.assertEq(TEST_ODD_PATH, unescape(cookie.path));
+ }));
+ },
+ function removeCookie() {
+ removeTestCookies();
+ chrome.experimental.cookies.set(TEST_BASIC_COOKIE);
+ chrome.experimental.cookies.get(
+ {url: TEST_URL, name: TEST_BASIC_COOKIE.name},
+ pass(expectValidCookie));
+ // Removal with any domain-matching URL will do.
+ chrome.experimental.cookies.remove(
+ {url: TEST_URL4, name: TEST_BASIC_COOKIE.name});
+ chrome.experimental.cookies.get(
+ {url: TEST_URL, name: TEST_BASIC_COOKIE.name},
+ pass(expectNullCookie));
+ // Set with an expired date should also remove the cookie.
+ chrome.experimental.cookies.set(TEST_BASIC_COOKIE);
+ chrome.experimental.cookies.get(
+ {url: TEST_URL, name: TEST_BASIC_COOKIE.name},
+ pass(expectValidCookie));
+ chrome.experimental.cookies.set(TEST_BASIC_EXPIRED_COOKIE);
+ chrome.experimental.cookies.get(
+ {url: TEST_URL, name: TEST_BASIC_COOKIE.name},
+ pass(expectNullCookie));
+ // Removal with a disallowed URL shouldn't do anything.
+ chrome.experimental.cookies.set(TEST_DOMAIN_COOKIE);
+ chrome.experimental.cookies.get(
+ {url: TEST_URL2, name: TEST_DOMAIN_COOKIE.name},
+ pass(expectValidCookie));
+ chrome.experimental.cookies.remove(
+ {url: TEST_UNPERMITTED_URL, name: TEST_DOMAIN_COOKIE.name});
+ chrome.experimental.cookies.get(
+ {url: TEST_URL2, name: TEST_DOMAIN_COOKIE.name},
+ pass(expectValidCookie));
+ },
+ function getAllCookies() {
+ removeTestCookies();
+ chrome.experimental.cookies.getAll({}, pass(function(cookies) {
+ chrome.test.assertEq(0, cookies.length);
+ }));
+ chrome.experimental.cookies.set(TEST_BASIC_COOKIE);
+ chrome.experimental.cookies.set(TEST_SECURE_COOKIE);
+ chrome.experimental.cookies.getAll(
+ {domain: TEST_DOMAIN}, pass(function(cookies) {
+ chrome.test.assertEq(2, cookies.length);
+ chrome.test.assertEq(TEST_BASIC_COOKIE.name, cookies[0].name);
+ chrome.test.assertEq(TEST_SECURE_COOKIE.name, cookies[1].name);
+ }));
+ chrome.experimental.cookies.getAll({
+ name: TEST_BASIC_COOKIE.name
+ }, pass(function(cookies) {
+ chrome.test.assertEq(1, cookies.length);
+ chrome.test.assertEq(TEST_BASIC_COOKIE.name, cookies[0].name);
+ }));
+ chrome.experimental.cookies.getAll({
+ secure: true
+ }, pass(function(cookies) {
+ chrome.test.assertEq(1, cookies.length);
+ chrome.test.assertEq(TEST_SECURE_COOKIE.name, cookies[0].name);
+ }));
+ chrome.experimental.cookies.getAll({
+ url: 'invalid url'
+ }, fail('Invalid url: "invalid url".'));
+ chrome.experimental.cookies.getAll({
+ url: TEST_URL,
+ }, pass(function(cookies) {
+ chrome.test.assertEq(1, cookies.length);
+ chrome.test.assertEq(TEST_BASIC_COOKIE.name, cookies[0].name);
+ }));
+ },
+ function getAllCookieStores() {
+ removeTestCookies();
+ chrome.experimental.cookies.getAllCookieStores(
+ pass(function(cookieStores) {
+ chrome.test.assertEq(1, cookieStores.length);
+ chrome.experimental.cookies.set(TEST_BASIC_COOKIE);
+ chrome.experimental.cookies.get(
+ {url: TEST_URL, name: TEST_BASIC_COOKIE.name},
+ pass(function(cookie) {
+ chrome.test.assertEq(cookieStores[0].id, cookie.storeId);
+ }));
+ chrome.experimental.cookies.getAll(
+ {storeId: cookieStores[0].id},
+ pass(function(cookies) {
+ chrome.test.assertEq(1, cookies.length);
+ chrome.test.assertEq(TEST_BASIC_COOKIE.name, cookies[0].name);
+ }));
+ }));
+ }
+]);
</script>
+