Commit 4b10ffbe authored by Elliot Glaysher's avatar Elliot Glaysher

Revert "Make protobuf enums canonical for ReadState/WriteState/ConnectState."

This reverts commit f1624ddc.

Broke Google Chrome ChromeOS compile:

http://build.chromium.org/p/chromium.chrome/builders/Google%20Chrome%20ChromeOS/builds/72048/steps/compile/logs/stdio

In file included from gen/extensions/browser/api/generated_api_registration.cc:20:
In file included from ../../extensions/browser/api/cast_channel/cast_channel_api.h:16:
../../extensions/browser/api/cast_channel/cast_socket.h:19:10: fatal error: 'extensions/browser/api/cast_channel/logging.pb.h' file not found
         ^

(Manually reverted because of file add.)

TBR=kmarshall@chromium.org
BUG=

Review URL: https://codereview.chromium.org/588433002

Cr-Commit-Position: refs/heads/master@{#295611}
parent 048cedfb
...@@ -427,7 +427,7 @@ source_set("browser") { ...@@ -427,7 +427,7 @@ source_set("browser") {
"//device/hid", "//device/hid",
"//device/serial", "//device/serial",
"//device/usb", "//device/usb",
"//extensions/common/api/cast_channel:cast_channel_proto", "//extensions/browser/api/cast_channel:cast_channel_proto",
] ]
if (use_openssl) { if (use_openssl) {
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
['enable_extensions==1', { ['enable_extensions==1', {
'dependencies': [ 'dependencies': [
'<(DEPTH)/device/serial/serial.gyp:device_serial_mojo', '<(DEPTH)/device/serial/serial.gyp:device_serial_mojo',
'<(DEPTH)/extensions/common/api/api.gyp:cast_channel_proto',
'<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/skia/skia.gyp:skia',
], ],
}], }],
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import("//third_party/protobuf/proto_library.gni") import("//third_party/protobuf/proto_library.gni")
# GYP version: extensions/common/api/api.gyp:cast_channel_proto # GYP version: extensions/extensions.gyp:cast_channel_proto
proto_library("cast_channel_proto") { proto_library("cast_channel_proto") {
sources = [ sources = [
"cast_channel.proto", "cast_channel.proto",
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "extensions/browser/api/api_resource.h" #include "extensions/browser/api/api_resource.h"
#include "extensions/browser/api/api_resource_manager.h" #include "extensions/browser/api/api_resource_manager.h"
#include "extensions/browser/api/cast_channel/logging.pb.h"
#include "extensions/common/api/cast_channel.h" #include "extensions/common/api/cast_channel.h"
#include "net/base/completion_callback.h" #include "net/base/completion_callback.h"
#include "net/base/io_buffer.h" #include "net/base/io_buffer.h"
...@@ -127,6 +126,36 @@ class CastSocket : public ApiResource { ...@@ -127,6 +126,36 @@ class CastSocket : public ApiResource {
// It is fine to delete the CastSocket object in |callback|. // It is fine to delete the CastSocket object in |callback|.
virtual void Close(const net::CompletionCallback& callback); virtual void Close(const net::CompletionCallback& callback);
// Internal connection states.
enum ConnectionState {
CONN_STATE_NONE,
CONN_STATE_TCP_CONNECT,
CONN_STATE_TCP_CONNECT_COMPLETE,
CONN_STATE_SSL_CONNECT,
CONN_STATE_SSL_CONNECT_COMPLETE,
CONN_STATE_AUTH_CHALLENGE_SEND,
CONN_STATE_AUTH_CHALLENGE_SEND_COMPLETE,
CONN_STATE_AUTH_CHALLENGE_REPLY_COMPLETE,
};
// Internal write states.
enum WriteState {
WRITE_STATE_NONE,
WRITE_STATE_WRITE,
WRITE_STATE_WRITE_COMPLETE,
WRITE_STATE_DO_CALLBACK,
WRITE_STATE_ERROR,
};
// Internal read states.
enum ReadState {
READ_STATE_NONE,
READ_STATE_READ,
READ_STATE_READ_COMPLETE,
READ_STATE_DO_CALLBACK,
READ_STATE_ERROR,
};
private: private:
friend class ApiResourceManager<CastSocket>; friend class ApiResourceManager<CastSocket>;
friend class CastSocketTest; friend class CastSocketTest;
...@@ -231,11 +260,11 @@ class CastSocket : public ApiResource { ...@@ -231,11 +260,11 @@ class CastSocket : public ApiResource {
virtual base::Timer* GetTimer(); virtual base::Timer* GetTimer();
void SetConnectState(proto::ConnectionState connect_state); void SetConnectState(ConnectionState connect_state);
void SetReadyState(ReadyState ready_state); void SetReadyState(ReadyState ready_state);
void SetErrorState(ChannelError error_state); void SetErrorState(ChannelError error_state);
void SetReadState(proto::ReadState read_state); void SetReadState(ReadState read_state);
void SetWriteState(proto::WriteState write_state); void SetWriteState(WriteState write_state);
base::ThreadChecker thread_checker_; base::ThreadChecker thread_checker_;
...@@ -293,11 +322,11 @@ class CastSocket : public ApiResource { ...@@ -293,11 +322,11 @@ class CastSocket : public ApiResource {
scoped_ptr<CastMessage> current_message_; scoped_ptr<CastMessage> current_message_;
// Connection flow state machine state. // Connection flow state machine state.
proto::ConnectionState connect_state_; ConnectionState connect_state_;
// Write flow state machine state. // Write flow state machine state.
proto::WriteState write_state_; WriteState write_state_;
// Read flow state machine state. // Read flow state machine state.
proto::ReadState read_state_; ReadState read_state_;
// The last error encountered by the channel. // The last error encountered by the channel.
ChannelError error_state_; ChannelError error_state_;
// The current status of the channel. // The current status of the channel.
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "extensions/browser/api/cast_channel/logger_util.h" #include "extensions/browser/api/cast_channel/logger_util.h"
#include "extensions/browser/api/cast_channel/logging.pb.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
namespace extensions { namespace extensions {
namespace core_api { namespace core_api {
namespace cast_channel { namespace cast_channel {
LastErrors::LastErrors() LastErrors::LastErrors()
: event_type(proto::EVENT_TYPE_UNKNOWN), : event_type(proto::EVENT_TYPE_UNKNOWN),
challenge_reply_error_type(proto::CHALLENGE_REPLY_ERROR_NONE), challenge_reply_error_type(proto::CHALLENGE_REPLY_ERROR_NONE),
...@@ -19,51 +19,6 @@ LastErrors::LastErrors() ...@@ -19,51 +19,6 @@ LastErrors::LastErrors()
LastErrors::~LastErrors() { LastErrors::~LastErrors() {
} }
proto::ErrorState ErrorStateToProto(ChannelError state) {
switch (state) {
case CHANNEL_ERROR_NONE:
return proto::CHANNEL_ERROR_NONE;
case CHANNEL_ERROR_CHANNEL_NOT_OPEN:
return proto::CHANNEL_ERROR_CHANNEL_NOT_OPEN;
case CHANNEL_ERROR_AUTHENTICATION_ERROR:
return proto::CHANNEL_ERROR_AUTHENTICATION_ERROR;
case CHANNEL_ERROR_CONNECT_ERROR:
return proto::CHANNEL_ERROR_CONNECT_ERROR;
case CHANNEL_ERROR_SOCKET_ERROR:
return proto::CHANNEL_ERROR_SOCKET_ERROR;
case CHANNEL_ERROR_TRANSPORT_ERROR:
return proto::CHANNEL_ERROR_TRANSPORT_ERROR;
case CHANNEL_ERROR_INVALID_MESSAGE:
return proto::CHANNEL_ERROR_INVALID_MESSAGE;
case CHANNEL_ERROR_INVALID_CHANNEL_ID:
return proto::CHANNEL_ERROR_INVALID_CHANNEL_ID;
case CHANNEL_ERROR_CONNECT_TIMEOUT:
return proto::CHANNEL_ERROR_CONNECT_TIMEOUT;
case CHANNEL_ERROR_UNKNOWN:
return proto::CHANNEL_ERROR_UNKNOWN;
default:
NOTREACHED();
return proto::CHANNEL_ERROR_NONE;
}
}
proto::ReadyState ReadyStateToProto(ReadyState state) {
switch (state) {
case READY_STATE_NONE:
return proto::READY_STATE_NONE;
case READY_STATE_CONNECTING:
return proto::READY_STATE_CONNECTING;
case READY_STATE_OPEN:
return proto::READY_STATE_OPEN;
case READY_STATE_CLOSING:
return proto::READY_STATE_CLOSING;
case READY_STATE_CLOSED:
return proto::READY_STATE_CLOSED;
default:
NOTREACHED();
return proto::READY_STATE_NONE;
}
}
} // namespace cast_channel } // namespace cast_channel
} // namespace api } // namespace api
} // namespace extensions } // namespace extensions
...@@ -6,16 +6,13 @@ ...@@ -6,16 +6,13 @@
#define EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_UTIL_H_ #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_UTIL_H_
#include "extensions/browser/api/cast_channel/logging.pb.h" #include "extensions/browser/api/cast_channel/logging.pb.h"
#include "extensions/common/api/cast_channel.h"
namespace extensions { namespace extensions {
namespace core_api { namespace core_api {
namespace cast_channel { namespace cast_channel {
// Converts an IDL "ChannelError" to a proto enum "ErrorState".
proto::ErrorState ErrorStateToProto(ChannelError state);
// Converts an IDL "ReadyState" to a proto enum "ReadyState". // TODO(mfoltz): Move the *ToProto functions from cast_socket.cc here.
proto::ReadyState ReadyStateToProto(ReadyState state); // CastSocket should not need to know details of the logging protocol message.
// Holds the most recent errors encountered by a CastSocket. // Holds the most recent errors encountered by a CastSocket.
struct LastErrors { struct LastErrors {
......
...@@ -20,7 +20,6 @@ generated_extensions_api("api_registration") { ...@@ -20,7 +20,6 @@ generated_extensions_api("api_registration") {
if (!is_android) { if (!is_android) {
deps += [ deps += [
"//device/serial", "//device/serial",
"//extensions/common/api/cast_channel:cast_channel_proto",
"//skia", "//skia",
] ]
} }
......
...@@ -16,20 +16,5 @@ ...@@ -16,20 +16,5 @@
'schemas.gypi', 'schemas.gypi',
], ],
}, },
{
# Protobuf compiler / generator for chrome.cast.channel-related protocol buffers.
# GN version: //extensions/browser/api/cast_channel:cast_channel_proto
'target_name': 'cast_channel_proto',
'type': 'static_library',
'sources': [
'cast_channel/cast_channel.proto',
'cast_channel/logging.proto'
],
'variables': {
'proto_in_dir': 'cast_channel',
'proto_out_dir': 'extensions/common/api/cast_channel',
},
'includes': [ '../../../build/protoc.gypi' ]
},
], ],
} }
...@@ -284,7 +284,7 @@ ...@@ -284,7 +284,7 @@
'../skia/skia.gyp:skia', '../skia/skia.gyp:skia',
'../third_party/leveldatabase/leveldatabase.gyp:leveldatabase', '../third_party/leveldatabase/leveldatabase.gyp:leveldatabase',
'browser/api/api_registration.gyp:extensions_api_registration', 'browser/api/api_registration.gyp:extensions_api_registration',
'common/api/api.gyp:cast_channel_proto', 'cast_channel_proto',
'common/api/api.gyp:extensions_api', 'common/api/api.gyp:extensions_api',
'extensions_common', 'extensions_common',
'extensions_strings.gyp:extensions_strings', 'extensions_strings.gyp:extensions_strings',
...@@ -1021,7 +1021,7 @@ ...@@ -1021,7 +1021,7 @@
'../testing/gmock.gyp:gmock', '../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest', '../testing/gtest.gyp:gtest',
'../third_party/leveldatabase/leveldatabase.gyp:leveldatabase', '../third_party/leveldatabase/leveldatabase.gyp:leveldatabase',
'common/api/api.gyp:cast_channel_proto', 'cast_channel_proto',
'extensions_common', 'extensions_common',
'extensions_renderer', 'extensions_renderer',
'extensions_resources.gyp:extensions_resources', 'extensions_resources.gyp:extensions_resources',
...@@ -1131,5 +1131,20 @@ ...@@ -1131,5 +1131,20 @@
}], }],
], ],
}, },
{
# Protobuf compiler / generator for chrome.cast.channel-related protocol buffers.
# GN version: //extensions/browser/api/cast_channel:cast_channel_proto
'target_name': 'cast_channel_proto',
'type': 'static_library',
'sources': [
'browser/api/cast_channel/cast_channel.proto',
'browser/api/cast_channel/logging.proto'
],
'variables': {
'proto_in_dir': 'browser/api/cast_channel',
'proto_out_dir': 'extensions/browser/api/cast_channel',
},
'includes': [ '../build/protoc.gypi' ]
},
] ]
} }
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