Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: extensions/browser/api/cast_channel/logger_util.cc

Issue 576483003: Make proto enums canonical for ReadState/WriteState/ConnectState. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update all path references to generated protobufs. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/cast_channel/logger_util.cc
diff --git a/extensions/browser/api/cast_channel/logger_util.cc b/extensions/browser/api/cast_channel/logger_util.cc
index 08e0857232074a363b91677cef5dd41326b6b585..d18faffdfac80bbec65eaed13645068af46212e2 100644
--- a/extensions/browser/api/cast_channel/logger_util.cc
+++ b/extensions/browser/api/cast_channel/logger_util.cc
@@ -3,12 +3,12 @@
// found in the LICENSE file.
#include "extensions/browser/api/cast_channel/logger_util.h"
+#include "extensions/common/api/cast_channel/logging.pb.h"
#include "net/base/net_errors.h"
namespace extensions {
namespace core_api {
namespace cast_channel {
-
LastErrors::LastErrors()
: event_type(proto::EVENT_TYPE_UNKNOWN),
challenge_reply_error_type(proto::CHALLENGE_REPLY_ERROR_NONE),
@@ -19,6 +19,51 @@ 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 api
} // namespace extensions
« no previous file with comments | « extensions/browser/api/cast_channel/logger_util.h ('k') | extensions/browser/api/cast_channel/logging.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698