[go: up one dir, main page]

Remove CheckForUpdate and Update which are no longer used.

I'll submit this once chromeos-chrome's ebuild file gets new enough.

BUG=chromium-os:16563
TEST=gmerge libcros, and conform chrome boots

Change-Id: I856d21020b47b6d66ccd49c0f2216a55448729f3
Reviewed-on: http://gerrit.chromium.org/gerrit/3956
Reviewed-by: Satoru Takabayashi <satorux@chromium.org>
Tested-by: Satoru Takabayashi <satorux@chromium.org>
diff --git a/SConstruct.chromiumos b/SConstruct.chromiumos
index f2aa2d4..d45d8b6 100644
--- a/SConstruct.chromiumos
+++ b/SConstruct.chromiumos
@@ -89,7 +89,6 @@
   chromeos_screen_lock.cc
   chromeos_speech_synthesis.cc
   chromeos_touchpad.cc
-  chromeos_update.cc
   chromeos_update_engine.cc
   libcros_service.cc
   libcros_servicer.cc
diff --git a/chromeos_cros_api.h b/chromeos_cros_api.h
index 1d6895e..50eaf7b 100644
--- a/chromeos_cros_api.h
+++ b/chromeos_cros_api.h
@@ -265,12 +265,13 @@
 // 159: Removed SetSynapticsParameter.
 // 160: Deprecated CheckForUpdate and Update.
 // 161: Deprecated SetTouchpadSensitivity and SetTouchpadTapToClick.
+// 162: Removed CheckForUpdate and Update.
 
 namespace chromeos {  // NOLINT
 
 enum CrosAPIVersion {
-  kCrosAPIMinVersion = 158,
-  kCrosAPIVersion = 161
+  kCrosAPIMinVersion = 160,
+  kCrosAPIVersion = 162
 };
 
 // Default path to pass to LoadCros: "/opt/google/chrome/chromeos/libcros.so"
diff --git a/chromeos_update.cc b/chromeos_update.cc
deleted file mode 100644
index e73298c..0000000
--- a/chromeos_update.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chromeos_update.h"
-
-#include "chromeos/string.h"
-
-#include <unistd.h>
-
-#include <cstdlib>
-#include <string>
-#include <base/memory/scoped_ptr.h>
-
-#include <glib.h>
-
-using std::string;
-
-namespace chromeos {
-
-namespace {
-
-// This is the "virtualized" destructor for UpdateInformation.
-void Destruct(const UpdateInformation& x) {
-  delete x.version_;
-}
-
-// Searches for a line "key=some value" for a given key 'key'
-// and returns the value part of the line
-string ValueForKey(const char* const haystack, const string& key) {
-  string use_key = key + "=";
-
-  const char* needle = NULL;
-
-  // See if haystack starts with key
-  if (!strncmp(haystack, use_key.data(), use_key.size())) {
-    needle = haystack;
-  } else {
-    use_key = string("\n") + use_key;
-    needle = strstr(haystack, use_key.c_str());
-  }
-  if (!needle)
-    return "";
-  needle += use_key.size();
-  const char* end = needle + 1;
-  while (*end != '\0' && *end != '\n') {
-    end++;
-  }
-  return string(needle, end - needle);
-}
-
-}  // namespace
-
-extern "C"
-bool ChromeOSUpdate(UpdateInformation* information) {
-  scoped_array<char*> envp(new char*[2]);
-  envp[0] = strdup("PATH=/bin:/sbin:/usr/bin:/usr/sbin");
-  envp[1] = NULL;
-  
-  scoped_array<char*> argv(new char*[3]);
-  argv[0] = strdup("/opt/google/memento_updater/suid_exec");
-  argv[1] = strdup("/opt/google/memento_updater/memento_updater.sh");
-  argv[2] = NULL;
-
-  gint exit_status = 0;
-  gchar* child_stdout = NULL;
-  GError* err = NULL;
-
-  gboolean success = g_spawn_sync(NULL,  // Use parent's working dir
-                                  argv.get(),
-                                  envp.get(),
-                                  G_SPAWN_STDERR_TO_DEV_NULL,  // no flags
-                                  NULL,  // no setup function
-                                  NULL,  // no setup function data
-                                  &child_stdout,
-                                  NULL,  // stderr pointer
-                                  &exit_status,
-                                  &err);
-
-  if (!success || exit_status != 0) {
-    information->status_ = UPDATE_ERROR;
-    if (!success) {
-      information->version_ = NewStringCopy(err->message);
-    } else {
-      information->version_ = NewStringCopy("Nonzero return code");
-    }
-    return false;
-  }
-
-  if (child_stdout && !strcmp(child_stdout, "UPDATED")) {
-    information->status_ = UPDATE_SUCCESSFUL;
-    information->version_ = NewStringCopy("Updated to new version");
-    return true;
-  } else {
-    information->status_ = UPDATE_ERROR;
-    information->version_ = NewStringCopy("didn't update");
-    return false;
-  }
-  // TODO(adlr): handle up to date
-  //information->status_ = UPDATE_ALREADY_UP_TO_DATE;
-  //information->version_ = NewStringCopy("Didn't update");
-}
-
-extern "C"
-bool ChromeOSCheckForUpdate(UpdateInformation* information) {
-  scoped_array<char*> envp(new char*[2]);
-  envp[0] = strdup("PATH=/bin:/sbin:/usr/bin:/usr/sbin");
-  envp[1] = NULL;
-  
-  scoped_array<char*> argv(new char*[3]);
-  argv[0] = strdup("/opt/google/memento_updater/suid_exec");
-  argv[1] = strdup("/opt/google/memento_updater/ping_omaha.sh");
-  argv[2] = NULL;
-
-  gchar* child_stdout = NULL;
-  gint exit_status = 0;
-  GError* err = NULL;
-
-  gboolean success = g_spawn_sync(NULL,  // Use parent's working dir
-                                  argv.get(),
-                                  envp.get(),
-                                  G_SPAWN_STDERR_TO_DEV_NULL,  // flags
-                                  NULL,  // no setup function
-                                  NULL,  // no setup function data
-                                  &child_stdout,
-                                  NULL,  // stderr pointer
-                                  &exit_status,
-                                  &err);
-
-  if (!success || exit_status != 0) {
-    information->status_ = UPDATE_ERROR;
-    if (!success) {
-      information->version_ = NewStringCopy(err->message);
-    } else {
-      information->version_ = NewStringCopy("Nonzero return code");
-    }
-    return false;
-  }
-
-  if (strlen(child_stdout) > 0) {
-    string new_version = ValueForKey(child_stdout, "NEW_VERSION");
-
-    information->status_ = UPDATE_IS_AVAILABLE;
-    information->version_ = NewStringCopy(new_version.c_str());
-  } else {
-    information->status_ = UPDATE_ALREADY_UP_TO_DATE;
-    information->version_ = NewStringCopy("No new version");
-  }
-  return true;
-}
-
-}  // namespace chromeos
diff --git a/chromeos_update.h b/chromeos_update.h
deleted file mode 100644
index 92f5792..0000000
--- a/chromeos_update.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_UPDATE_H_
-#define CHROMEOS_UPDATE_H_
-
-#include <cstddef>
-
-#include <base/basictypes.h>
-
-namespace chromeos {
-
-// NOTE: All functions in the file will be invoked on a thread other than the
-// main thread in Chrome. The code must be thread safe and reentrant.
-
-enum UpdateStatus {
-  // An error occurred.
-  UPDATE_ERROR,
-  // An update is available.
-  UPDATE_IS_AVAILABLE,
-  // The upgrade happened successfully.
-  UPDATE_SUCCESSFUL,
-  // No need to upgrade, we are up to date.
-  UPDATE_ALREADY_UP_TO_DATE,
-};
-
-// This simple class is DLL safe. We "virtualize" the destructor with
-// a proc-pointer to avoid cross DLL dependencies on allocators (and vtables).
-
-struct UpdateInformation {
-  UpdateInformation() : status_(UPDATE_ERROR), version_(NULL), destruct_(NULL) {
-  }
-  ~UpdateInformation() {
-    if (destruct_) destruct_(*this);
-  }
-  UpdateStatus status_;
-  const char* version_;
-
-// private:
-  void (*destruct_)(const UpdateInformation&);
-};
-
-}  // namespace chromeos
-
-#endif  // CHROMEOS_UPDATE_H_
diff --git a/load.cc b/load.cc
index 0390486..dd289e0 100644
--- a/load.cc
+++ b/load.cc
@@ -22,7 +22,6 @@
 #include "chromeos_resume.h"  // NOLINT
 #include "chromeos_screen_lock.h"  // NOLINT
 #include "chromeos_speech_synthesis.h"  // NOLINT
-#include "chromeos_update.h"  // NOLINT
 #include "chromeos_update_engine.h"  // NOLINT
 
 namespace chromeos {  // NOLINT //