summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorweitaosu <weitaosu@chromium.org>2015-02-19 12:23:43 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-19 20:24:52 +0000
commitd0adb362e0154f905f8cd2db16e3b8fd97f97676 (patch)
tree7ff3698d9ffd85169b63100310980a1f78c65b7b
parent813326fdc8dff24091cd7b8def4f65142e1af07f (diff)
downloadchromium_src-d0adb362e0154f905f8cd2db16e3b8fd97f97676.zip
chromium_src-d0adb362e0154f905f8cd2db16e3b8fd97f97676.tar.gz
chromium_src-d0adb362e0154f905f8cd2db16e3b8fd97f97676.tar.bz2
Remove obsolete daemon controller states.
I didn't intend to remove all the remnants of NPAPI from the webapp. I only made the minimum change needed to removed the inapplicable daemon states. BUG=453172 Review URL: https://codereview.chromium.org/897313005 Cr-Commit-Position: refs/heads/master@{#317124}
-rw-r--r--remoting/host/setup/daemon_controller.h19
-rw-r--r--remoting/host/setup/daemon_controller_delegate_linux.cc20
-rw-r--r--remoting/host/setup/daemon_controller_delegate_mac.mm2
-rw-r--r--remoting/host/setup/daemon_controller_delegate_win.cc4
-rw-r--r--remoting/host/setup/me2me_native_messaging_host.cc6
-rw-r--r--remoting/webapp/crd/js/host_controller.js9
-rw-r--r--remoting/webapp/crd/js/host_setup_dialog.js4
7 files changed, 19 insertions, 45 deletions
diff --git a/remoting/host/setup/daemon_controller.h b/remoting/host/setup/daemon_controller.h
index 02dd02a..9bc3b33 100644
--- a/remoting/host/setup/daemon_controller.h
+++ b/remoting/host/setup/daemon_controller.h
@@ -24,20 +24,15 @@ class AutoThreadTaskRunner;
class DaemonController : public base::RefCountedThreadSafe<DaemonController> {
public:
- // Note that these enumeration values are duplicated in host_controller.js and
- // must be kept in sync.
+ // These enumeration values are duplicated in host_controller.js except that
+ // NOT_INSTALLED is missing here. DaemonController runs in either the remoting
+ // host or the native messaging host which are only installed as part of the
+ // host package so the host must have already been installed.
enum State {
// Placeholder state for platforms on which the daemon process is not
// implemented. The web-app will not show the corresponding UI. This value
// will eventually be deprecated or removed.
- STATE_NOT_IMPLEMENTED = -1,
- // The daemon is not installed. This is functionally equivalent to
- // STATE_STOPPED, but the start method is expected to be significantly
- // slower, and might involve user interaction. It might be appropriate to
- // indicate this in the UI.
- STATE_NOT_INSTALLED = 0,
- // The daemon is being installed.
- STATE_INSTALLING = 1,
+ STATE_NOT_IMPLEMENTED = 0,
// The daemon is installed but not running. Call Start to start it.
STATE_STOPPED = 2,
// The daemon process is starting.
@@ -47,9 +42,7 @@ class DaemonController : public base::RefCountedThreadSafe<DaemonController> {
STATE_STARTED = 4,
// The daemon process is stopping.
STATE_STOPPING = 5,
- // The state cannot be determined. This could indicate that the plugin
- // has not been provided with sufficient information, for example, the
- // user for which to query state on a multi-user system.
+ // The state cannot be determined.
STATE_UNKNOWN = 6
};
diff --git a/remoting/host/setup/daemon_controller_delegate_linux.cc b/remoting/host/setup/daemon_controller_delegate_linux.cc
index 60a91ee..b015eda 100644
--- a/remoting/host/setup/daemon_controller_delegate_linux.cc
+++ b/remoting/host/setup/daemon_controller_delegate_linux.cc
@@ -138,23 +138,16 @@ DaemonControllerDelegateLinux::~DaemonControllerDelegateLinux() {
DaemonController::State DaemonControllerDelegateLinux::GetState() {
base::FilePath script_path;
if (!GetScriptPath(&script_path)) {
- return DaemonController::STATE_NOT_IMPLEMENTED;
+ LOG(ERROR) << "GetScriptPath() failed.";
+ return DaemonController::STATE_UNKNOWN;
}
base::CommandLine command_line(script_path);
command_line.AppendArg("--get-status");
std::string status;
int exit_code = 0;
- bool result =
- base::GetAppOutputWithExitCode(command_line, &status, &exit_code);
- if (!result) {
- // TODO(jamiewalch): When we have a good story for installing, return
- // NOT_INSTALLED rather than NOT_IMPLEMENTED (the former suppresses
- // the relevant UI in the web-app).
- return DaemonController::STATE_NOT_IMPLEMENTED;
- }
-
- if (exit_code != 0) {
+ if (!base::GetAppOutputWithExitCode(command_line, &status, &exit_code) ||
+ exit_code != 0) {
LOG(ERROR) << "Failed to run \"" << command_line.GetCommandLineString()
<< "\". Exit code: " << exit_code;
return DaemonController::STATE_UNKNOWN;
@@ -167,6 +160,8 @@ DaemonController::State DaemonControllerDelegateLinux::GetState() {
} else if (status == "STOPPED") {
return DaemonController::STATE_STOPPED;
} else if (status == "NOT_IMPLEMENTED") {
+ // Chrome Remote Desktop is not currently supported on the underlying Linux
+ // Distro.
return DaemonController::STATE_NOT_IMPLEMENTED;
} else {
LOG(ERROR) << "Unknown status string returned from \""
@@ -177,9 +172,6 @@ DaemonController::State DaemonControllerDelegateLinux::GetState() {
}
scoped_ptr<base::DictionaryValue> DaemonControllerDelegateLinux::GetConfig() {
- if (GetState() == DaemonController::STATE_NOT_IMPLEMENTED)
- return nullptr;
-
scoped_ptr<base::DictionaryValue> config(
HostConfigFromJsonFile(GetConfigPath()));
if (!config)
diff --git a/remoting/host/setup/daemon_controller_delegate_mac.mm b/remoting/host/setup/daemon_controller_delegate_mac.mm
index 1c6e9a1..2fd7daa 100644
--- a/remoting/host/setup/daemon_controller_delegate_mac.mm
+++ b/remoting/host/setup/daemon_controller_delegate_mac.mm
@@ -39,7 +39,7 @@ DaemonControllerDelegateMac::~DaemonControllerDelegateMac() {
DaemonController::State DaemonControllerDelegateMac::GetState() {
pid_t job_pid = base::mac::PIDForJob(kServiceName);
if (job_pid < 0) {
- return DaemonController::STATE_NOT_INSTALLED;
+ return DaemonController::STATE_UNKNOWN;
} else if (job_pid == 0) {
// Service is stopped, or a start attempt failed.
return DaemonController::STATE_STOPPED;
diff --git a/remoting/host/setup/daemon_controller_delegate_win.cc b/remoting/host/setup/daemon_controller_delegate_win.cc
index fb8f432..0dcae69 100644
--- a/remoting/host/setup/daemon_controller_delegate_win.cc
+++ b/remoting/host/setup/daemon_controller_delegate_win.cc
@@ -361,10 +361,6 @@ DaemonControllerDelegateWin::~DaemonControllerDelegateWin() {
}
DaemonController::State DaemonControllerDelegateWin::GetState() {
- if (base::win::GetVersion() < base::win::VERSION_XP) {
- return DaemonController::STATE_NOT_IMPLEMENTED;
- }
-
// TODO(alexeypa): Make the thread alertable, so we can switch to APC
// notifications rather than polling.
ScopedScHandle service = OpenService(SERVICE_QUERY_STATUS);
diff --git a/remoting/host/setup/me2me_native_messaging_host.cc b/remoting/host/setup/me2me_native_messaging_host.cc
index 7472c24..12e688b 100644
--- a/remoting/host/setup/me2me_native_messaging_host.cc
+++ b/remoting/host/setup/me2me_native_messaging_host.cc
@@ -391,12 +391,6 @@ void Me2MeNativeMessagingHost::ProcessGetDaemonState(
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;
diff --git a/remoting/webapp/crd/js/host_controller.js b/remoting/webapp/crd/js/host_controller.js
index e4c7a78..b5f8516 100644
--- a/remoting/webapp/crd/js/host_controller.js
+++ b/remoting/webapp/crd/js/host_controller.js
@@ -12,13 +12,12 @@ remoting.HostController = function() {
this.hostDaemonFacade_ = this.createDaemonFacade_();
};
-// Note that the values in the enums below are copied from
-// daemon_controller.h and must be kept in sync.
+// The values in the enums below are duplicated in daemon_controller.h except
+// for NOT_INSTALLED.
/** @enum {number} */
remoting.HostController.State = {
- NOT_IMPLEMENTED: -1,
- NOT_INSTALLED: 0,
- INSTALLING: 1,
+ NOT_IMPLEMENTED: 0,
+ NOT_INSTALLED: 1,
STOPPED: 2,
STARTING: 3,
STARTED: 4,
diff --git a/remoting/webapp/crd/js/host_setup_dialog.js b/remoting/webapp/crd/js/host_setup_dialog.js
index fc258d8..a97d708 100644
--- a/remoting/webapp/crd/js/host_setup_dialog.js
+++ b/remoting/webapp/crd/js/host_setup_dialog.js
@@ -229,7 +229,7 @@ remoting.HostSetupDialog.prototype.showForStartWithToken_ =
var installed =
state != remoting.HostController.State.NOT_INSTALLED &&
- state != remoting.HostController.State.INSTALLING;
+ state != remoting.HostController.State.UNKNOWN;
// Skip the installation step when the host is already installed.
if (installed) {
@@ -373,7 +373,7 @@ remoting.HostSetupDialog.prototype.installHost_ = function() {
var onHostState = function(state) {
var installed =
state != remoting.HostController.State.NOT_INSTALLED &&
- state != remoting.HostController.State.INSTALLING;
+ state != remoting.HostController.State.UNKNOWN;
if (installed) {
that.flow_.switchToNextStep();