Move socket API from experimental to dev channel and remove some dead code.


BUG=130379
TEST=browser_tests --gtest_filter=SocketApiTest.*

Review URL: https://chromiumcodereview.appspot.com/10440097

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148819 0039d316-1c4b-4281-b951-d872f2087c98
parent 8c31bf56
......@@ -14,7 +14,6 @@
using content::BrowserThread;
namespace events {
const char kExperimentalSocketOnEvent[] = "experimental.socket.onEvent";
const char kExperimentalUsbOnEvent[] = "experimental.usb.onEvent";
};
......@@ -50,38 +49,6 @@ ApiResourceEventNotifier::ApiResourceEventNotifier(
src_url_(src_url) {
}
void ApiResourceEventNotifier::OnConnectComplete(int result_code) {
SendEventWithResultCode(events::kExperimentalSocketOnEvent,
API_RESOURCE_EVENT_CONNECT_COMPLETE, result_code);
}
void ApiResourceEventNotifier::OnDataRead(int result_code,
base::ListValue* data,
const std::string& address,
int port) {
// Do we have a destination for this event? There will be one if a source id
// was injected by the request handler for the resource's create method in
// schema_generated_bindings.js, which will in turn be the case if the caller
// of the create method provided an onEvent closure.
if (src_id_ < 0) {
delete data;
return;
}
DictionaryValue* event = CreateApiResourceEvent(
API_RESOURCE_EVENT_DATA_READ);
event->SetInteger(kResultCodeKey, result_code);
event->Set(kDataKey, data);
event->SetString(kAddressKey, address);
event->SetInteger(kPortKey, port);
DispatchEvent(events::kExperimentalSocketOnEvent, event);
}
void ApiResourceEventNotifier::OnWriteComplete(int result_code) {
SendEventWithResultCode(events::kExperimentalSocketOnEvent,
API_RESOURCE_EVENT_WRITE_COMPLETE, result_code);
}
void ApiResourceEventNotifier::OnTransferComplete(UsbTransferStatus status,
const std::string& error,
base::BinaryValue* data) {
......@@ -105,12 +72,6 @@ void ApiResourceEventNotifier::OnTransferComplete(UsbTransferStatus status,
std::string ApiResourceEventNotifier::ApiResourceEventTypeToString(
ApiResourceEventType event_type) {
switch (event_type) {
case API_RESOURCE_EVENT_CONNECT_COMPLETE:
return kEventTypeConnectComplete;
case API_RESOURCE_EVENT_DATA_READ:
return kEventTypeDataRead;
case API_RESOURCE_EVENT_WRITE_COMPLETE:
return kEventTypeWriteComplete;
case API_RESOURCE_EVENT_TRANSFER_COMPLETE:
return kEventTypeTransferComplete;
}
......
......@@ -23,9 +23,6 @@ namespace extensions {
class EventRouter;
enum ApiResourceEventType {
API_RESOURCE_EVENT_CONNECT_COMPLETE,
API_RESOURCE_EVENT_DATA_READ,
API_RESOURCE_EVENT_WRITE_COMPLETE,
API_RESOURCE_EVENT_TRANSFER_COMPLETE,
};
......@@ -41,16 +38,6 @@ class ApiResourceEventNotifier
const std::string& src_extension_id, int src_id,
const GURL& src_url);
virtual void OnConnectComplete(int result_code);
// Takes ownership of data.
virtual void OnDataRead(int result_code,
base::ListValue* data,
const std::string& address,
int port);
virtual void OnWriteComplete(int result_code);
virtual void OnTransferComplete(UsbTransferStatus status,
const std::string& error,
base::BinaryValue* data);
......
......@@ -100,7 +100,7 @@ SocketCreateFunction::SocketCreateFunction()
SocketCreateFunction::~SocketCreateFunction() {}
bool SocketCreateFunction::Prepare() {
params_ = api::experimental_socket::Create::Params::Create(*args_);
params_ = api::socket::Create::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
if (params_->type == kTCPOption) {
......@@ -227,7 +227,7 @@ SocketReadFunction::SocketReadFunction()
SocketReadFunction::~SocketReadFunction() {}
bool SocketReadFunction::Prepare() {
params_ = api::experimental_socket::Read::Params::Create(*args_);
params_ = api::socket::Read::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
return true;
}
......@@ -308,7 +308,7 @@ SocketRecvFromFunction::SocketRecvFromFunction()
SocketRecvFromFunction::~SocketRecvFromFunction() {}
bool SocketRecvFromFunction::Prepare() {
params_ = api::experimental_socket::RecvFrom::Params::Create(*args_);
params_ = api::socket::RecvFrom::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
return true;
}
......@@ -408,7 +408,7 @@ SocketSetKeepAliveFunction::SocketSetKeepAliveFunction()
SocketSetKeepAliveFunction::~SocketSetKeepAliveFunction() {}
bool SocketSetKeepAliveFunction::Prepare() {
params_ = api::experimental_socket::SetKeepAlive::Params::Create(*args_);
params_ = api::socket::SetKeepAlive::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
return true;
}
......@@ -434,7 +434,7 @@ SocketSetNoDelayFunction::SocketSetNoDelayFunction()
SocketSetNoDelayFunction::~SocketSetNoDelayFunction() {}
bool SocketSetNoDelayFunction::Prepare() {
params_ = api::experimental_socket::SetNoDelay::Params::Create(*args_);
params_ = api::socket::SetNoDelay::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
return true;
}
......
......@@ -8,7 +8,7 @@
#include "base/memory/ref_counted.h"
#include "chrome/browser/extensions/api/api_function.h"
#include "chrome/browser/extensions/api/api_resource_manager.h"
#include "chrome/common/extensions/api/experimental_socket.h"
#include "chrome/common/extensions/api/socket.h"
#include "net/base/address_list.h"
#include "net/base/host_resolver.h"
......@@ -63,7 +63,7 @@ class SocketExtensionWithDnsLookupFunction : public SocketAsyncApiFunction {
class SocketCreateFunction : public SocketAsyncApiFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.create")
DECLARE_EXTENSION_FUNCTION_NAME("socket.create")
SocketCreateFunction();
......@@ -81,7 +81,7 @@ class SocketCreateFunction : public SocketAsyncApiFunction {
kSocketTypeUDP
};
scoped_ptr<api::experimental_socket::Create::Params> params_;
scoped_ptr<api::socket::Create::Params> params_;
SocketType socket_type_;
int src_id_;
ApiResourceEventNotifier* event_notifier_;
......@@ -89,7 +89,7 @@ class SocketCreateFunction : public SocketAsyncApiFunction {
class SocketDestroyFunction : public SocketAsyncApiFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.destroy")
DECLARE_EXTENSION_FUNCTION_NAME("socket.destroy")
protected:
virtual ~SocketDestroyFunction() {}
......@@ -104,7 +104,7 @@ class SocketDestroyFunction : public SocketAsyncApiFunction {
class SocketConnectFunction : public SocketExtensionWithDnsLookupFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.connect")
DECLARE_EXTENSION_FUNCTION_NAME("socket.connect")
SocketConnectFunction();
......@@ -129,7 +129,7 @@ class SocketConnectFunction : public SocketExtensionWithDnsLookupFunction {
class SocketDisconnectFunction : public SocketAsyncApiFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.disconnect")
DECLARE_EXTENSION_FUNCTION_NAME("socket.disconnect")
protected:
virtual ~SocketDisconnectFunction() {}
......@@ -144,7 +144,7 @@ class SocketDisconnectFunction : public SocketAsyncApiFunction {
class SocketBindFunction : public SocketAsyncApiFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.bind")
DECLARE_EXTENSION_FUNCTION_NAME("socket.bind")
protected:
virtual ~SocketBindFunction() {}
......@@ -161,7 +161,7 @@ class SocketBindFunction : public SocketAsyncApiFunction {
class SocketReadFunction : public SocketAsyncApiFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.read")
DECLARE_EXTENSION_FUNCTION_NAME("socket.read")
SocketReadFunction();
......@@ -174,12 +174,12 @@ class SocketReadFunction : public SocketAsyncApiFunction {
void OnCompleted(int result, scoped_refptr<net::IOBuffer> io_buffer);
private:
scoped_ptr<api::experimental_socket::Read::Params> params_;
scoped_ptr<api::socket::Read::Params> params_;
};
class SocketWriteFunction : public SocketAsyncApiFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.write")
DECLARE_EXTENSION_FUNCTION_NAME("socket.write")
SocketWriteFunction();
......@@ -199,7 +199,7 @@ class SocketWriteFunction : public SocketAsyncApiFunction {
class SocketRecvFromFunction : public SocketAsyncApiFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.recvFrom")
DECLARE_EXTENSION_FUNCTION_NAME("socket.recvFrom")
SocketRecvFromFunction();
......@@ -215,12 +215,12 @@ class SocketRecvFromFunction : public SocketAsyncApiFunction {
int port);
private:
scoped_ptr<api::experimental_socket::RecvFrom::Params> params_;
scoped_ptr<api::socket::RecvFrom::Params> params_;
};
class SocketSendToFunction : public SocketExtensionWithDnsLookupFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.sendTo")
DECLARE_EXTENSION_FUNCTION_NAME("socket.sendTo")
SocketSendToFunction();
......@@ -247,7 +247,7 @@ class SocketSendToFunction : public SocketExtensionWithDnsLookupFunction {
class SocketSetKeepAliveFunction : public SocketAsyncApiFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.setKeepAlive")
DECLARE_EXTENSION_FUNCTION_NAME("socket.setKeepAlive")
SocketSetKeepAliveFunction();
......@@ -259,12 +259,12 @@ class SocketSetKeepAliveFunction : public SocketAsyncApiFunction {
virtual void Work() OVERRIDE;
private:
scoped_ptr<api::experimental_socket::SetKeepAlive::Params> params_;
scoped_ptr<api::socket::SetKeepAlive::Params> params_;
};
class SocketSetNoDelayFunction : public SocketAsyncApiFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.setNoDelay")
DECLARE_EXTENSION_FUNCTION_NAME("socket.setNoDelay")
SocketSetNoDelayFunction();
......@@ -276,7 +276,7 @@ class SocketSetNoDelayFunction : public SocketAsyncApiFunction {
virtual void Work() OVERRIDE;
private:
scoped_ptr<api::experimental_socket::SetNoDelay::Params> params_;
scoped_ptr<api::socket::SetNoDelay::Params> params_;
};
} // namespace extensions
......
......@@ -240,7 +240,7 @@
"extension_types": ["platform_app"]
},
"socket": {
"channel": "stable",
"channel": "dev",
"extension_types": ["platform_app"]
},
"storage": {
......
......@@ -43,10 +43,10 @@
'experimental_idltest.idl',
'experimental_media_galleries.idl',
'experimental_serial.idl',
'experimental_socket.idl',
'experimental_usb.idl',
'file_system.idl',
'media_galleries.idl',
'socket.idl',
],
'cc_dir': 'chrome/common/extensions/api',
'root_namespace': 'extensions::api',
......
......@@ -4,7 +4,7 @@
// File-level comment to appease parser. Eventually this will not be necessary.
namespace experimental.socket {
namespace socket {
enum SocketType {
tcp,
udp
......@@ -12,9 +12,6 @@ namespace experimental.socket {
// The socket options.
dictionary CreateOptions {
// The schema generator does not support dictionaries without any fields.
// Ignore this field.
[nodoc] long? dummyValue;
};
dictionary CreateInfo {
......
......@@ -208,6 +208,7 @@ Here are the supported chrome.* APIs:
</li><li><a href="mediaGalleries.html" js="">mediaGalleries</a>
</li><li><a href="permissions.html" js="">permissions</a>
</li><li><a href="runtime.html" js="">runtime</a>
</li><li><a href="socket.html" js="">socket</a>
</li><li><a href="storage.html" js="">storage</a>
</li><li><a href="tts.html" js="">tts</a>
</li><li><a href="types.html" js="">types</a>
......
......@@ -216,7 +216,6 @@ on the following experimental APIs:
<a href="experimental.identity.html">experimental.identity</a></li><li>
<a href="experimental.mediaGalleries.html">experimental.mediaGalleries</a></li><li>
<a href="experimental.serial.html">experimental.serial</a></li><li>
<a href="experimental.socket.html">experimental.socket</a></li><li>
<a href="experimental.usb.html">experimental.usb</a></li>
</ul>
<p class="doc-family extensions">
......
......@@ -252,7 +252,6 @@ on the following experimental APIs:
<a href="experimental.offscreenTabs.html">experimental.offscreenTabs</a></li><li>
<a href="experimental.processes.html">experimental.processes</a></li><li>
<a href="experimental.serial.html">experimental.serial</a></li><li>
<a href="experimental.socket.html">experimental.socket</a></li><li>
<a href="experimental.speechInput.html">experimental.speechInput</a></li><li>
<a href="experimental.usb.html">experimental.usb</a></li>
</ul>
......
......@@ -252,6 +252,7 @@
"beff6ecd9677dea0a7c648c5042165b48bb66f09": "PROCESS MONITOR ADDS A BROWSER ACTION THAT MONITORS RESOURCE USAGE OF ALL BROWSER PROCESSES. BROWSER_ACTION EXPERIMENTAL TABS CHROME.EXPERIMENTAL.PROCESSES.ONUPDATED CHROME.EXPERIMENTAL.PROCESSES.ONUPDATEDWITHMEMORY CHROME.EXPERIMENTAL.PROCESSES.TERMINATE",
"3e8e226d87e431296bb110b4f6eb7eec2ca7a826": "PROXY EXTENSION API SAMPLE SET CHROME-SPECIFIC PROXIES; A DEMONSTRATION OF CHROMES PROXY API BACKGROUND_PAGE BROWSER_ACTION PROXY CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.BROWSERACTION.SETTITLE CHROME.EXTENSION.ISALLOWEDINCOGNITOACCESS CHROME.I18N.GETMESSAGE CHROME.PROXY.ONPROXYERROR",
"56a8d2ac24ca7bba78fd88ad57f43fc13c784497": "SAMPLE - OAUTH CONTACTS USES OAUTH TO CONNECT TO GOOGLES CONTACTS SERVICE AND DISPLAY A LIST OF YOUR CONTACTS. BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETICON CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.ONUPDATED CHROME.TABS.REMOVE",
"3c6dfba67f6a7480d931b5a4a646c151ad1a049b": "SANDBOXED FRAME BACKGROUND_PAGE BROWSER_ACTION NOTIFICATIONS CHROME.BROWSERACTION.ONCLICKED",
"38f6e1e17756ede38b1364c7114a738ca717dcbb": "SANDWICHBAR SHOWS AN INFOBAR ON PAGES WHICH CONTAIN THE WORD SANDWICH BACKGROUND_PAGE EXPERIMENTAL CHROME.EXPERIMENTAL.INFOBARS.SHOW",
"fc89b35755483af30b66cd72cefa34a43a3e8312": "SHOW TABS IN PROCESS ADDS A BROWSER ACTION SHOWING WHICH TABS SHARE THE CURRENT TABS PROCESS. BROWSER_ACTION EXPERIMENTAL TABS CHROME.EXPERIMENTAL.PROCESSES.GETPROCESSIDFORTAB CHROME.TABS.GET CHROME.TABS.UPDATE CHROME.WINDOWS.GET CHROME.WINDOWS.GETALL CHROME.WINDOWS.GETCURRENT CHROME.WINDOWS.UPDATE",
"a491a2faa1fe79cb49b2fe9ed2720f4723c14184": "SPEAK SELECTION SPEAKS THE CURRENT SELECTION OUT LOUD. <ALL_URLS> BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE TABS TTS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETICON CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.EXECUTESCRIPT CHROME.TTS.GETVOICES CHROME.TTS.SPEAK CHROME.TTS.STOP CHROME.WINDOWS.GET CHROME.WINDOWS.GETALL",
......@@ -339,6 +340,8 @@
<a href="javascript:void(0);" onclick="setFilter('chrome.runtime', this)">chrome.runtime</a><span>, </span>
</span><span>
<a href="javascript:void(0);" onclick="setFilter('chrome.scriptBadge', this)">chrome.scriptBadge</a><span>, </span>
</span><span>
<a href="javascript:void(0);" onclick="setFilter('chrome.socket', this)">chrome.socket</a><span>, </span>
</span><span>
<a href="javascript:void(0);" onclick="setFilter('chrome.storage', this)">chrome.storage</a><span>, </span>
</span><span>
......@@ -3245,6 +3248,48 @@
<a href="../examples/extensions/oauth_contacts.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
</div>
</div><div class="sample" id="3c6dfba67f6a7480d931b5a4a646c151ad1a049b">
<img class="icon" src="../images/sample-default-icon.png">
<h2 class="name">
<a href="#3c6dfba67f6a7480d931b5a4a646c151ad1a049b">Sandboxed Frame</a>
</h2>
<p class="metadata features">Uses
<span>
<strong>background_page</strong><span>, </span>
</span><span>
<strong>browser_action</strong>
<span> and</span>
</span><span>
<strong>notifications</strong>
</span>
</p>
<p></p>
<div class="apicalls"><strong>Calls:</strong>
<ul>
<li>
<code><a href="browserAction.html#event-onClicked">chrome.browserAction.onClicked</a></code>
</li>
</ul>
</div>
<div class="sourcefiles"><strong>Source files:</strong>
<ul>
<li>
<code><a target="_blank" href="../examples/howto/sandbox/eventpage.html">eventpage.html</a></code>
</li><li>
<code><a target="_blank" href="../examples/howto/sandbox/eventpage.js">eventpage.js</a></code>
</li><li>
<code><a target="_blank" href="../examples/howto/sandbox/handlebars-1.0.0.beta.6.js">handlebars-1.0.0.beta.6.js</a></code>
</li><li>
<code><a target="_blank" href="../examples/howto/sandbox/manifest.json">manifest.json</a></code>
</li><li>
<code><a target="_blank" href="../examples/howto/sandbox/sandbox.html">sandbox.html</a></code>
</li>
</ul>
</div>
<div>
<a href="../examples/howto/sandbox.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
</div>
</div><div class="sample" id="38f6e1e17756ede38b1364c7114a738ca717dcbb">
<img class="icon" src="../examples/api/infobars/sandwichbar/sandwich-128.png">
<h2 class="name">
......
......@@ -51,7 +51,6 @@ var MODULE_SCHEMAS = [
'../../api/experimental_rlz.json',
'../../api/experimental_serial.json', // autogenerated
'../../api/experimental_speech_input.json',
'../../api/experimental_socket.json', // autogenerated
'../../api/experimental_usb.json', // autogenerated
'../../api/extension.json',
'../../api/file_browser_handler.json',
......@@ -77,6 +76,7 @@ var MODULE_SCHEMAS = [
'../../api/proxy.json',
'../../api/runtime.json',
'../../api/script_badge.json',
'../../api/socket.json', // autogenerated
'../../api/storage.json',
'../../api/system_private.json',
'../../api/tabs.json',
......
......@@ -184,17 +184,6 @@
"chrome.experimental.serial.read": "experimental.serial.html#method-read",
"chrome.experimental.serial.setControlSignals": "experimental.serial.html#method-setControlSignals",
"chrome.experimental.serial.write": "experimental.serial.html#method-write",
"chrome.experimental.socket.bind": "experimental.socket.html#method-bind",
"chrome.experimental.socket.connect": "experimental.socket.html#method-connect",
"chrome.experimental.socket.create": "experimental.socket.html#method-create",
"chrome.experimental.socket.destroy": "experimental.socket.html#method-destroy",
"chrome.experimental.socket.disconnect": "experimental.socket.html#method-disconnect",
"chrome.experimental.socket.read": "experimental.socket.html#method-read",
"chrome.experimental.socket.recvFrom": "experimental.socket.html#method-recvFrom",
"chrome.experimental.socket.sendTo": "experimental.socket.html#method-sendTo",
"chrome.experimental.socket.setKeepAlive": "experimental.socket.html#method-setKeepAlive",
"chrome.experimental.socket.setNoDelay": "experimental.socket.html#method-setNoDelay",
"chrome.experimental.socket.write": "experimental.socket.html#method-write",
"chrome.experimental.speechInput.isRecording": "experimental.speechInput.html#method-isRecording",
"chrome.experimental.speechInput.onError": "experimental.speechInput.html#event-onError",
"chrome.experimental.speechInput.onResult": "experimental.speechInput.html#event-onResult",
......@@ -315,6 +304,17 @@
"chrome.scriptBadge.getPopup": "scriptBadge.html#method-getPopup",
"chrome.scriptBadge.onClicked": "scriptBadge.html#event-onClicked",
"chrome.scriptBadge.setPopup": "scriptBadge.html#method-setPopup",
"chrome.socket.bind": "socket.html#method-bind",
"chrome.socket.connect": "socket.html#method-connect",
"chrome.socket.create": "socket.html#method-create",
"chrome.socket.destroy": "socket.html#method-destroy",
"chrome.socket.disconnect": "socket.html#method-disconnect",
"chrome.socket.read": "socket.html#method-read",
"chrome.socket.recvFrom": "socket.html#method-recvFrom",
"chrome.socket.sendTo": "socket.html#method-sendTo",
"chrome.socket.setKeepAlive": "socket.html#method-setKeepAlive",
"chrome.socket.setNoDelay": "socket.html#method-setNoDelay",
"chrome.socket.write": "socket.html#method-write",
"chrome.storage.StorageArea.clear": "storage.html#method-StorageArea-clear",
"chrome.storage.StorageArea.get": "storage.html#method-StorageArea-get",
"chrome.storage.StorageArea.getBytesInUse": "storage.html#method-StorageArea-getBytesInUse",
......
......@@ -10,7 +10,7 @@
const request = "0100000005320000005hello";
var expectedResponsePattern = /0100000005320000005.{11}/;
const socket = chrome.experimental.socket;
const socket = chrome.socket;
var address;
var bytesWritten = 0;
var dataAsString;
......
......@@ -2,14 +2,13 @@
"name": "chrome.socket",
"version": "0.1",
"manifest_version": 2,
"description": "end-to-end browser test for chrome.experimental.socket API",
"description": "end-to-end browser test for chrome.socket API",
"app": {
"background": {
"scripts": ["background.js"]
}
},
"permissions": [
"experimental",
"socket"
]
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment