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

Unified Diff: remoting/host/setup/native_messaging_host.cc

Issue 16236008: Send enums as strings between Chromoting Native Messaging host and web-app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 7 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
« no previous file with comments | « remoting/host/setup/daemon_controller.h ('k') | remoting/host/setup/native_messaging_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/setup/native_messaging_host.cc
diff --git a/remoting/host/setup/native_messaging_host.cc b/remoting/host/setup/native_messaging_host.cc
index 2d2bd9ed89820ed0a62e27c5f1f2f36b62c38afc..6e342696e6b9be1eedc6a6eae955e98c88b85c2c 100644
--- a/remoting/host/setup/native_messaging_host.cc
+++ b/remoting/host/setup/native_messaging_host.cc
@@ -241,10 +241,33 @@ bool NativeMessagingHost::ProcessStopDaemon(
bool NativeMessagingHost::ProcessGetDaemonState(
const base::DictionaryValue& message,
scoped_ptr<base::DictionaryValue> response) {
- // TODO(lambroslambrou): Send the state as a string instead of an integer,
- // and update the web-app accordingly.
DaemonController::State state = daemon_controller_->GetState();
- response->SetInteger("state", state);
+ switch (state) {
+ case DaemonController::STATE_NOT_IMPLEMENTED:
+ response->SetString("state", "NOT_IMPLEMENTED");
+ break;
+ case DaemonController::STATE_NOT_INSTALLED:
+ response->SetString("state", "NOT_INSTALLED");
+ break;
+ case DaemonController::STATE_INSTALLING:
+ response->SetString("state", "INSTALLING");
+ break;
+ case DaemonController::STATE_STOPPED:
+ response->SetString("state", "STOPPED");
+ break;
+ case DaemonController::STATE_STARTING:
+ response->SetString("state", "STARTING");
+ break;
+ case DaemonController::STATE_STARTED:
+ response->SetString("state", "STARTED");
+ break;
+ case DaemonController::STATE_STOPPING:
+ response->SetString("state", "STOPPING");
+ break;
+ case DaemonController::STATE_UNKNOWN:
+ response->SetString("state", "UNKNOWN");
+ break;
+ }
SendResponse(response.Pass());
return true;
}
@@ -283,9 +306,20 @@ void NativeMessagingHost::SendUsageStatsConsentResponse(
void NativeMessagingHost::SendAsyncResult(
scoped_ptr<base::DictionaryValue> response,
DaemonController::AsyncResult result) {
- // TODO(lambroslambrou): Send the result as a string instead of an integer,
- // and update the web-app accordingly. See http://crbug.com/232135.
- response->SetInteger("result", result);
+ switch (result) {
+ case DaemonController::RESULT_OK:
+ response->SetString("result", "OK");
+ break;
+ case DaemonController::RESULT_FAILED:
+ response->SetString("result", "FAILED");
+ break;
+ case DaemonController::RESULT_CANCELLED:
+ response->SetString("result", "CANCELLED");
+ break;
+ case DaemonController::RESULT_FAILED_DIRECTORY:
+ response->SetString("result", "FAILED_DIRECTORY");
+ break;
+ }
SendResponse(response.Pass());
}
« no previous file with comments | « remoting/host/setup/daemon_controller.h ('k') | remoting/host/setup/native_messaging_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698