Remove base/power_monitor and base/system_monitor

Change-Id: I15da4ea1066ebaae654345791ec01b6bf6199ac0
Reviewed-on: https://gn-review.googlesource.com/1522
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
diff --git a/base/power_monitor/power_monitor.cc b/base/power_monitor/power_monitor.cc
deleted file mode 100644
index 30e06a2..0000000
--- a/base/power_monitor/power_monitor.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2013 The Chromium 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 "base/power_monitor/power_monitor.h"
-
-#include <utility>
-
-#include "base/power_monitor/power_monitor_source.h"
-
-namespace base {
-
-static PowerMonitor* g_power_monitor = nullptr;
-
-PowerMonitor::PowerMonitor(std::unique_ptr<PowerMonitorSource> source)
-    : observers_(new ObserverListThreadSafe<PowerObserver>()),
-      source_(std::move(source)) {
-  DCHECK(!g_power_monitor);
-  g_power_monitor = this;
-}
-
-PowerMonitor::~PowerMonitor() {
-  DCHECK_EQ(this, g_power_monitor);
-  g_power_monitor = nullptr;
-}
-
-// static
-PowerMonitor* PowerMonitor::Get() {
-  return g_power_monitor;
-}
-
-void PowerMonitor::AddObserver(PowerObserver* obs) {
-  observers_->AddObserver(obs);
-}
-
-void PowerMonitor::RemoveObserver(PowerObserver* obs) {
-  observers_->RemoveObserver(obs);
-}
-
-PowerMonitorSource* PowerMonitor::Source() {
-  return source_.get();
-}
-
-bool PowerMonitor::IsOnBatteryPower() {
-  return source_->IsOnBatteryPower();
-}
-
-void PowerMonitor::NotifyPowerStateChange(bool battery_in_use) {
-  DVLOG(1) << "PowerStateChange: " << (battery_in_use ? "On" : "Off")
-           << " battery";
-  observers_->Notify(FROM_HERE, &PowerObserver::OnPowerStateChange,
-                     battery_in_use);
-}
-
-void PowerMonitor::NotifySuspend() {
-  DVLOG(1) << "Power Suspending";
-  observers_->Notify(FROM_HERE, &PowerObserver::OnSuspend);
-}
-
-void PowerMonitor::NotifyResume() {
-  DVLOG(1) << "Power Resuming";
-  observers_->Notify(FROM_HERE, &PowerObserver::OnResume);
-}
-
-}  // namespace base
diff --git a/base/power_monitor/power_monitor.h b/base/power_monitor/power_monitor.h
deleted file mode 100644
index e025b32..0000000
--- a/base/power_monitor/power_monitor.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2013 The Chromium 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 BASE_POWER_MONITOR_POWER_MONITOR_H_
-#define BASE_POWER_MONITOR_POWER_MONITOR_H_
-
-#include "base/base_export.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/observer_list_threadsafe.h"
-#include "base/power_monitor/power_observer.h"
-
-namespace base {
-
-class PowerMonitorSource;
-
-// A class used to monitor the power state change and notify the observers about
-// the change event.
-class BASE_EXPORT PowerMonitor {
- public:
-  // Takes ownership of |source|.
-  explicit PowerMonitor(std::unique_ptr<PowerMonitorSource> source);
-  ~PowerMonitor();
-
-  // Get the process-wide PowerMonitor (if not present, returns NULL).
-  static PowerMonitor* Get();
-
-  // Add and remove an observer.
-  // Can be called from any thread.
-  // Must not be called from within a notification callback.
-  void AddObserver(PowerObserver* observer);
-  void RemoveObserver(PowerObserver* observer);
-
-  // Is the computer currently on battery power.
-  bool IsOnBatteryPower();
-
- private:
-  friend class PowerMonitorSource;
-
-  PowerMonitorSource* Source();
-
-  void NotifyPowerStateChange(bool battery_in_use);
-  void NotifySuspend();
-  void NotifyResume();
-
-  scoped_refptr<ObserverListThreadSafe<PowerObserver> > observers_;
-  std::unique_ptr<PowerMonitorSource> source_;
-
-  DISALLOW_COPY_AND_ASSIGN(PowerMonitor);
-};
-
-}  // namespace base
-
-#endif  // BASE_POWER_MONITOR_POWER_MONITOR_H_
diff --git a/base/power_monitor/power_monitor_device_source.cc b/base/power_monitor/power_monitor_device_source.cc
deleted file mode 100644
index 5df5800..0000000
--- a/base/power_monitor/power_monitor_device_source.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2013 The Chromium 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 "base/power_monitor/power_monitor_device_source.h"
-
-namespace base {
-
-PowerMonitorDeviceSource::PowerMonitorDeviceSource() {
-#if defined(OS_MACOSX)
-  PlatformInit();
-#endif
-
-#if defined(OS_WIN) || defined(OS_MACOSX)
-  // Provide the correct battery status if possible. Others platforms, such as
-  // Android and ChromeOS, will update their status once their backends are
-  // actually initialized.
-  SetInitialOnBatteryPowerState(IsOnBatteryPowerImpl());
-#endif
-}
-
-PowerMonitorDeviceSource::~PowerMonitorDeviceSource() {
-#if defined(OS_MACOSX)
-  PlatformDestroy();
-#endif
-}
-
-}  // namespace base
diff --git a/base/power_monitor/power_monitor_device_source.h b/base/power_monitor/power_monitor_device_source.h
deleted file mode 100644
index 2996609..0000000
--- a/base/power_monitor/power_monitor_device_source.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2013 The Chromium 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 BASE_POWER_MONITOR_POWER_MONITOR_DEVICE_SOURCE_H_
-#define BASE_POWER_MONITOR_POWER_MONITOR_DEVICE_SOURCE_H_
-
-#include "base/base_export.h"
-#include "base/macros.h"
-#include "base/power_monitor/power_monitor_source.h"
-#include "base/power_monitor/power_observer.h"
-#include "build_config.h"
-
-#if defined(OS_WIN)
-#include <windows.h>
-#endif  // !OS_WIN
-
-#if defined(OS_IOS)
-#include <objc/runtime.h>
-#endif  // OS_IOS
-
-namespace base {
-
-// A class used to monitor the power state change and notify the observers about
-// the change event.
-class BASE_EXPORT PowerMonitorDeviceSource : public PowerMonitorSource {
- public:
-  PowerMonitorDeviceSource();
-  ~PowerMonitorDeviceSource() override;
-
-#if defined(OS_MACOSX)
-  // Allocate system resources needed by the PowerMonitor class.
-  //
-  // This function must be called before instantiating an instance of the class
-  // and before the Sandbox is initialized.
-#if !defined(OS_IOS)
-  static void AllocateSystemIOPorts();
-#else
-  static void AllocateSystemIOPorts() {}
-#endif  // OS_IOS
-#endif  // OS_MACOSX
-
-#if defined(OS_CHROMEOS)
-  // On Chrome OS, Chrome receives power-related events from powerd, the system
-  // power daemon, via D-Bus signals received on the UI thread. base can't
-  // directly depend on that code, so this class instead exposes static methods
-  // so that events can be passed in.
-  static void SetPowerSource(bool on_battery);
-  static void HandleSystemSuspending();
-  static void HandleSystemResumed();
-#endif
-
- private:
-#if defined(OS_WIN)
-  // Represents a message-only window for power message handling on Windows.
-  // Only allow PowerMonitor to create it.
-  class PowerMessageWindow {
-   public:
-    PowerMessageWindow();
-    ~PowerMessageWindow();
-
-   private:
-    static LRESULT CALLBACK WndProcThunk(HWND hwnd,
-                                         UINT message,
-                                         WPARAM wparam,
-                                         LPARAM lparam);
-    // Instance of the module containing the window procedure.
-    HMODULE instance_;
-    // A hidden message-only window.
-    HWND message_hwnd_;
-  };
-#endif  // OS_WIN
-
-#if defined(OS_MACOSX)
-  void PlatformInit();
-  void PlatformDestroy();
-#endif
-
-  // Platform-specific method to check whether the system is currently
-  // running on battery power.  Returns true if running on batteries,
-  // false otherwise.
-  bool IsOnBatteryPowerImpl() override;
-
-#if defined(OS_IOS)
-  // Holds pointers to system event notification observers.
-  std::vector<id> notification_observers_;
-#endif
-
-#if defined(OS_WIN)
-  PowerMessageWindow power_message_window_;
-#endif
-
-  DISALLOW_COPY_AND_ASSIGN(PowerMonitorDeviceSource);
-};
-
-}  // namespace base
-
-#endif  // BASE_POWER_MONITOR_POWER_MONITOR_DEVICE_SOURCE_H_
diff --git a/base/power_monitor/power_monitor_device_source_chromeos.cc b/base/power_monitor/power_monitor_device_source_chromeos.cc
deleted file mode 100644
index c3466ee..0000000
--- a/base/power_monitor/power_monitor_device_source_chromeos.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2014 The Chromium 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 "base/power_monitor/power_monitor.h"
-#include "base/power_monitor/power_monitor_device_source.h"
-#include "base/power_monitor/power_monitor_source.h"
-
-namespace base {
-
-namespace {
-
-// The most-recently-seen power source.
-bool g_on_battery = false;
-
-}  // namespace
-
-// static
-void PowerMonitorDeviceSource::SetPowerSource(bool on_battery) {
-  if (on_battery != g_on_battery) {
-    g_on_battery = on_battery;
-    ProcessPowerEvent(POWER_STATE_EVENT);
-  }
-}
-
-// static
-void PowerMonitorDeviceSource::HandleSystemSuspending() {
-  ProcessPowerEvent(SUSPEND_EVENT);
-}
-
-// static
-void PowerMonitorDeviceSource::HandleSystemResumed() {
-  ProcessPowerEvent(RESUME_EVENT);
-}
-
-bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() {
-  return g_on_battery;
-}
-
-}  // namespace base
diff --git a/base/power_monitor/power_monitor_device_source_mac.mm b/base/power_monitor/power_monitor_device_source_mac.mm
deleted file mode 100644
index be2b8b9..0000000
--- a/base/power_monitor/power_monitor_device_source_mac.mm
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Implementation based on sample code from
-// http://developer.apple.com/library/mac/#qa/qa1340/_index.html.
-
-#include "base/power_monitor/power_monitor_device_source.h"
-
-#include "base/mac/foundation_util.h"
-#include "base/mac/scoped_cftyperef.h"
-#include "base/power_monitor/power_monitor.h"
-#include "base/power_monitor/power_monitor_source.h"
-
-#include <IOKit/IOMessage.h>
-#include <IOKit/ps/IOPSKeys.h>
-#include <IOKit/ps/IOPowerSources.h>
-#include <IOKit/pwr_mgt/IOPMLib.h>
-
-namespace base {
-
-void ProcessPowerEventHelper(PowerMonitorSource::PowerEvent event) {
-  PowerMonitorSource::ProcessPowerEvent(event);
-}
-
-bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() {
-  base::ScopedCFTypeRef<CFTypeRef> info(IOPSCopyPowerSourcesInfo());
-  base::ScopedCFTypeRef<CFArrayRef> power_sources_list(
-      IOPSCopyPowerSourcesList(info));
-
-  const CFIndex count = CFArrayGetCount(power_sources_list);
-  for (CFIndex i = 0; i < count; ++i) {
-    const CFDictionaryRef description = IOPSGetPowerSourceDescription(
-        info, CFArrayGetValueAtIndex(power_sources_list, i));
-    if (!description)
-      continue;
-
-    CFStringRef current_state = base::mac::GetValueFromDictionary<CFStringRef>(
-        description, CFSTR(kIOPSPowerSourceStateKey));
-
-    if (!current_state)
-      continue;
-
-    // We only report "on battery power" if no source is on AC power.
-    if (CFStringCompare(current_state, CFSTR(kIOPSBatteryPowerValue), 0) !=
-        kCFCompareEqualTo) {
-      return false;
-    }
-  }
-
-  return true;
-}
-
-namespace {
-
-io_connect_t g_system_power_io_port = 0;
-IONotificationPortRef g_notification_port_ref = 0;
-io_object_t g_notifier_object = 0;
-CFRunLoopSourceRef g_battery_status_ref = 0;
-
-void BatteryEventCallback(void*) {
-  ProcessPowerEventHelper(PowerMonitorSource::POWER_STATE_EVENT);
-}
-
-void SystemPowerEventCallback(void*,
-                              io_service_t service,
-                              natural_t message_type,
-                              void* message_argument) {
-  switch (message_type) {
-    // If this message is not handled the system may delay sleep for 30 seconds.
-    case kIOMessageCanSystemSleep:
-      IOAllowPowerChange(g_system_power_io_port,
-          reinterpret_cast<intptr_t>(message_argument));
-      break;
-    case kIOMessageSystemWillSleep:
-      ProcessPowerEventHelper(base::PowerMonitorSource::SUSPEND_EVENT);
-      IOAllowPowerChange(g_system_power_io_port,
-          reinterpret_cast<intptr_t>(message_argument));
-      break;
-
-    case kIOMessageSystemWillPowerOn:
-      ProcessPowerEventHelper(PowerMonitorSource::RESUME_EVENT);
-      break;
-  }
-}
-
-}  // namespace
-
-// The reason we can't include this code in the constructor is because
-// PlatformInit() requires an active runloop and the IO port needs to be
-// allocated at sandbox initialization time, before there's a runloop.
-// See crbug.com/83783 .
-
-// static
-void PowerMonitorDeviceSource::AllocateSystemIOPorts() {
-  DCHECK_EQ(g_system_power_io_port, 0u);
-
-  // Notification port allocated by IORegisterForSystemPower.
-  g_system_power_io_port = IORegisterForSystemPower(
-      NULL, &g_notification_port_ref, SystemPowerEventCallback,
-      &g_notifier_object);
-
-  DCHECK_NE(g_system_power_io_port, 0u);
-}
-
-void PowerMonitorDeviceSource::PlatformInit() {
-  // Need to call AllocateSystemIOPorts() before creating a PowerMonitor
-  // object.
-  DCHECK_NE(g_system_power_io_port, 0u);
-  if (g_system_power_io_port == 0)
-    return;
-
-  // Add the notification port and battery monitor to the application runloop
-  CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(
-                                                g_notification_port_ref),
-                     kCFRunLoopCommonModes);
-
-  base::ScopedCFTypeRef<CFRunLoopSourceRef> battery_status_ref(
-      IOPSNotificationCreateRunLoopSource(BatteryEventCallback, nullptr));
-  CFRunLoopAddSource(CFRunLoopGetCurrent(), battery_status_ref,
-                     kCFRunLoopDefaultMode);
-  g_battery_status_ref = battery_status_ref.release();
-}
-
-void PowerMonitorDeviceSource::PlatformDestroy() {
-  DCHECK_NE(g_system_power_io_port, 0u);
-  if (g_system_power_io_port == 0)
-    return;
-
-  // Remove the sleep notification port from the application runloop
-  CFRunLoopRemoveSource(
-      CFRunLoopGetCurrent(),
-      IONotificationPortGetRunLoopSource(g_notification_port_ref),
-      kCFRunLoopCommonModes);
-
-  base::ScopedCFTypeRef<CFRunLoopSourceRef> battery_status_ref(
-      g_battery_status_ref);
-  CFRunLoopRemoveSource(CFRunLoopGetCurrent(), g_battery_status_ref,
-                        kCFRunLoopDefaultMode);
-  g_battery_status_ref = 0;
-
-  // Deregister for system sleep notifications
-  IODeregisterForSystemPower(&g_notifier_object);
-
-  // IORegisterForSystemPower implicitly opens the Root Power Domain IOService,
-  // so we close it here.
-  IOServiceClose(g_system_power_io_port);
-
-  g_system_power_io_port = 0;
-
-  // Destroy the notification port allocated by IORegisterForSystemPower.
-  IONotificationPortDestroy(g_notification_port_ref);
-}
-
-}  // namespace base
diff --git a/base/power_monitor/power_monitor_device_source_stub.cc b/base/power_monitor/power_monitor_device_source_stub.cc
deleted file mode 100644
index f24e5b2..0000000
--- a/base/power_monitor/power_monitor_device_source_stub.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2013 The Chromium 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 "base/power_monitor/power_monitor_device_source.h"
-
-namespace base {
-
-bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() {
-  NOTIMPLEMENTED();
-  return false;
-}
-
-}  // namespace base
diff --git a/base/power_monitor/power_monitor_device_source_win.cc b/base/power_monitor/power_monitor_device_source_win.cc
deleted file mode 100644
index e74be50..0000000
--- a/base/power_monitor/power_monitor_device_source_win.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2013 The Chromium 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 "base/power_monitor/power_monitor_device_source.h"
-
-#include "base/message_loop/message_loop.h"
-#include "base/power_monitor/power_monitor.h"
-#include "base/power_monitor/power_monitor_source.h"
-#include "base/win/wrapped_window_proc.h"
-
-namespace base {
-
-void ProcessPowerEventHelper(PowerMonitorSource::PowerEvent event) {
-  PowerMonitorSource::ProcessPowerEvent(event);
-}
-
-namespace {
-
-const wchar_t kWindowClassName[] = L"Base_PowerMessageWindow";
-
-void ProcessWmPowerBroadcastMessage(WPARAM event_id) {
-  PowerMonitorSource::PowerEvent power_event;
-  switch (event_id) {
-    case PBT_APMPOWERSTATUSCHANGE:  // The power status changed.
-      power_event = PowerMonitorSource::POWER_STATE_EVENT;
-      break;
-    case PBT_APMRESUMEAUTOMATIC:  // Resume from suspend.
-      //case PBT_APMRESUMESUSPEND:  // User-initiated resume from suspend.
-      // We don't notify for this latter event
-      // because if it occurs it is always sent as a
-      // second event after PBT_APMRESUMEAUTOMATIC.
-      power_event = PowerMonitorSource::RESUME_EVENT;
-      break;
-    case PBT_APMSUSPEND:  // System has been suspended.
-      power_event = PowerMonitorSource::SUSPEND_EVENT;
-      break;
-    default:
-      return;
-
-      // Other Power Events:
-      // PBT_APMBATTERYLOW - removed in Vista.
-      // PBT_APMOEMEVENT - removed in Vista.
-      // PBT_APMQUERYSUSPEND - removed in Vista.
-      // PBT_APMQUERYSUSPENDFAILED - removed in Vista.
-      // PBT_APMRESUMECRITICAL - removed in Vista.
-      // PBT_POWERSETTINGCHANGE - user changed the power settings.
-  }
-
-  ProcessPowerEventHelper(power_event);
-}
-
-}  // namespace
-
-// Function to query the system to see if it is currently running on
-// battery power.  Returns true if running on battery.
-bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() {
-  SYSTEM_POWER_STATUS status;
-  if (!GetSystemPowerStatus(&status)) {
-    DPLOG(ERROR) << "GetSystemPowerStatus failed";
-    return false;
-  }
-  return (status.ACLineStatus == 0);
-}
-
-PowerMonitorDeviceSource::PowerMessageWindow::PowerMessageWindow()
-    : instance_(NULL), message_hwnd_(NULL) {
-  if (!MessageLoopForUI::IsCurrent()) {
-    // Creating this window in (e.g.) a renderer inhibits shutdown on Windows.
-    // See http://crbug.com/230122. TODO(vandebo): http://crbug.com/236031
-    DLOG(ERROR)
-        << "Cannot create windows on non-UI thread, power monitor disabled!";
-    return;
-  }
-  WNDCLASSEX window_class;
-  base::win::InitializeWindowClass(
-      kWindowClassName,
-      &base::win::WrappedWindowProc<
-          PowerMonitorDeviceSource::PowerMessageWindow::WndProcThunk>,
-      0, 0, 0, NULL, NULL, NULL, NULL, NULL,
-      &window_class);
-  instance_ = window_class.hInstance;
-  ATOM clazz = RegisterClassEx(&window_class);
-  DCHECK(clazz);
-
-  message_hwnd_ = CreateWindowEx(WS_EX_NOACTIVATE, kWindowClassName,
-      NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, instance_, NULL);
-}
-
-PowerMonitorDeviceSource::PowerMessageWindow::~PowerMessageWindow() {
-  if (message_hwnd_) {
-    DestroyWindow(message_hwnd_);
-    UnregisterClass(kWindowClassName, instance_);
-  }
-}
-
-// static
-LRESULT CALLBACK PowerMonitorDeviceSource::PowerMessageWindow::WndProcThunk(
-    HWND hwnd,
-    UINT message,
-    WPARAM wparam,
-    LPARAM lparam) {
-  switch (message) {
-    case WM_POWERBROADCAST:
-      ProcessWmPowerBroadcastMessage(wparam);
-      return TRUE;
-    default:
-      return ::DefWindowProc(hwnd, message, wparam, lparam);
-  }
-}
-
-}  // namespace base
diff --git a/base/power_monitor/power_monitor_source.cc b/base/power_monitor/power_monitor_source.cc
deleted file mode 100644
index 8ec6e68..0000000
--- a/base/power_monitor/power_monitor_source.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2013 The Chromium 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 "base/power_monitor/power_monitor_source.h"
-
-#include "base/power_monitor/power_monitor.h"
-#include "build_config.h"
-
-namespace base {
-
-PowerMonitorSource::PowerMonitorSource() = default;
-PowerMonitorSource::~PowerMonitorSource() = default;
-
-bool PowerMonitorSource::IsOnBatteryPower() {
-  AutoLock auto_lock(battery_lock_);
-  return on_battery_power_;
-}
-
-void PowerMonitorSource::ProcessPowerEvent(PowerEvent event_id) {
-  PowerMonitor* monitor = PowerMonitor::Get();
-  if (!monitor)
-    return;
-
-  PowerMonitorSource* source = monitor->Source();
-
-  // Suppress duplicate notifications.  Some platforms may
-  // send multiple notifications of the same event.
-  switch (event_id) {
-    case POWER_STATE_EVENT:
-      {
-        bool new_on_battery_power = source->IsOnBatteryPowerImpl();
-        bool changed = false;
-
-        {
-          AutoLock auto_lock(source->battery_lock_);
-          if (source->on_battery_power_ != new_on_battery_power) {
-              changed = true;
-              source->on_battery_power_ = new_on_battery_power;
-          }
-        }
-
-        if (changed)
-          monitor->NotifyPowerStateChange(new_on_battery_power);
-      }
-      break;
-    case RESUME_EVENT:
-      if (source->suspended_) {
-        source->suspended_ = false;
-        monitor->NotifyResume();
-      }
-      break;
-    case SUSPEND_EVENT:
-      if (!source->suspended_) {
-        source->suspended_ = true;
-        monitor->NotifySuspend();
-      }
-      break;
-  }
-}
-
-void PowerMonitorSource::SetInitialOnBatteryPowerState(bool on_battery_power) {
-  // Must only be called before a monitor exists, otherwise the caller should
-  // have just used a normal ProcessPowerEvent(POWER_STATE_EVENT) call.
-  DCHECK(!PowerMonitor::Get());
-  on_battery_power_ = on_battery_power;
-}
-
-}  // namespace base
diff --git a/base/power_monitor/power_monitor_source.h b/base/power_monitor/power_monitor_source.h
deleted file mode 100644
index b69cbf8..0000000
--- a/base/power_monitor/power_monitor_source.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2013 The Chromium 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 BASE_POWER_MONITOR_POWER_MONITOR_SOURCE_H_
-#define BASE_POWER_MONITOR_POWER_MONITOR_SOURCE_H_
-
-#include "base/base_export.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/observer_list_threadsafe.h"
-#include "base/synchronization/lock.h"
-
-namespace base {
-
-class PowerMonitor;
-
-// Communicates power state changes to the power monitor.
-class BASE_EXPORT PowerMonitorSource {
- public:
-  PowerMonitorSource();
-  virtual ~PowerMonitorSource();
-
-  // Normalized list of power events.
-  enum PowerEvent {
-    POWER_STATE_EVENT,  // The Power status of the system has changed.
-    SUSPEND_EVENT,      // The system is being suspended.
-    RESUME_EVENT        // The system is being resumed.
-  };
-
-  // Is the computer currently on battery power. Can be called on any thread.
-  bool IsOnBatteryPower();
-
- protected:
-  friend class PowerMonitorTest;
-
-  // Friend function that is allowed to access the protected ProcessPowerEvent.
-  friend void ProcessPowerEventHelper(PowerEvent);
-
-  // Get the process-wide PowerMonitorSource (if not present, returns NULL).
-  static PowerMonitorSource* Get();
-
-  // ProcessPowerEvent should only be called from a single thread, most likely
-  // the UI thread or, in child processes, the IO thread.
-  static void ProcessPowerEvent(PowerEvent event_id);
-
-  // Platform-specific method to check whether the system is currently
-  // running on battery power.  Returns true if running on batteries,
-  // false otherwise.
-  virtual bool IsOnBatteryPowerImpl() = 0;
-
-  // Sets the initial state for |on_battery_power_|, which defaults to false
-  // since not all implementations can provide the value at construction. May
-  // only be called before a base::PowerMonitor has been created.
-  void SetInitialOnBatteryPowerState(bool on_battery_power);
-
- private:
-  bool on_battery_power_ = false;
-  bool suspended_ = false;
-
-  // This lock guards access to on_battery_power_, to ensure that
-  // IsOnBatteryPower can be called from any thread.
-  Lock battery_lock_;
-
-  DISALLOW_COPY_AND_ASSIGN(PowerMonitorSource);
-};
-
-}  // namespace base
-
-#endif  // BASE_POWER_MONITOR_POWER_MONITOR_SOURCE_H_
diff --git a/base/power_monitor/power_observer.h b/base/power_monitor/power_observer.h
deleted file mode 100644
index 0142b2a..0000000
--- a/base/power_monitor/power_observer.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2013 The Chromium 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 BASE_POWER_MONITOR_POWER_OBSERVER_H_
-#define BASE_POWER_MONITOR_POWER_OBSERVER_H_
-
-#include "base/base_export.h"
-#include "base/compiler_specific.h"
-
-namespace base {
-
-class BASE_EXPORT PowerObserver {
- public:
-  // Notification of a change in power status of the computer, such
-  // as from switching between battery and A/C power.
-  virtual void OnPowerStateChange(bool on_battery_power) {};
-
-  // Notification that the system is suspending.
-  virtual void OnSuspend() {}
-
-  // Notification that the system is resuming.
-  virtual void OnResume() {}
-
- protected:
-  virtual ~PowerObserver() = default;
-};
-
-}  // namespace base
-
-#endif  // BASE_POWER_MONITOR_POWER_OBSERVER_H_
diff --git a/base/system_monitor/system_monitor.cc b/base/system_monitor/system_monitor.cc
deleted file mode 100644
index 71e4f07..0000000
--- a/base/system_monitor/system_monitor.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2012 The Chromium 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 "base/system_monitor/system_monitor.h"
-
-#include <utility>
-
-#include "base/logging.h"
-#include "base/time/time.h"
-
-namespace base {
-
-static SystemMonitor* g_system_monitor = nullptr;
-
-SystemMonitor::SystemMonitor()
-    :  devices_changed_observer_list_(
-          new ObserverListThreadSafe<DevicesChangedObserver>()) {
-  DCHECK(!g_system_monitor);
-  g_system_monitor = this;
-}
-
-SystemMonitor::~SystemMonitor() {
-  DCHECK_EQ(this, g_system_monitor);
-  g_system_monitor = nullptr;
-}
-
-// static
-SystemMonitor* SystemMonitor::Get() {
-  return g_system_monitor;
-}
-
-void SystemMonitor::ProcessDevicesChanged(DeviceType device_type) {
-  NotifyDevicesChanged(device_type);
-}
-
-void SystemMonitor::AddDevicesChangedObserver(DevicesChangedObserver* obs) {
-  devices_changed_observer_list_->AddObserver(obs);
-}
-
-void SystemMonitor::RemoveDevicesChangedObserver(DevicesChangedObserver* obs) {
-  devices_changed_observer_list_->RemoveObserver(obs);
-}
-
-void SystemMonitor::NotifyDevicesChanged(DeviceType device_type) {
-  DVLOG(1) << "DevicesChanged with device type " << device_type;
-  devices_changed_observer_list_->Notify(
-      FROM_HERE, &DevicesChangedObserver::OnDevicesChanged, device_type);
-}
-
-}  // namespace base
diff --git a/base/system_monitor/system_monitor.h b/base/system_monitor/system_monitor.h
deleted file mode 100644
index f0828d1..0000000
--- a/base/system_monitor/system_monitor.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) 2012 The Chromium 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 BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_
-#define BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_
-
-#include "base/base_export.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/observer_list_threadsafe.h"
-#include "build_config.h"
-
-namespace base {
-
-// Class for monitoring various system-related subsystems
-// such as power management, network status, etc.
-// TODO(mbelshe):  Add support beyond just power management.
-class BASE_EXPORT SystemMonitor {
- public:
-  // Type of devices whose change need to be monitored, such as add/remove.
-  enum DeviceType {
-    DEVTYPE_AUDIO,          // Audio device, e.g., microphone.
-    DEVTYPE_VIDEO_CAPTURE,  // Video capture device, e.g., webcam.
-    DEVTYPE_UNKNOWN,        // Other devices.
-  };
-
-  // Create SystemMonitor. Only one SystemMonitor instance per application
-  // is allowed.
-  SystemMonitor();
-  ~SystemMonitor();
-
-  // Get the application-wide SystemMonitor (if not present, returns NULL).
-  static SystemMonitor* Get();
-
-  class BASE_EXPORT DevicesChangedObserver {
-   public:
-    // Notification that the devices connected to the system have changed.
-    // This is only implemented on Windows currently.
-    virtual void OnDevicesChanged(DeviceType device_type) {}
-
-   protected:
-    virtual ~DevicesChangedObserver() = default;
-  };
-
-  // Add a new observer.
-  // Can be called from any thread.
-  // Must not be called from within a notification callback.
-  void AddDevicesChangedObserver(DevicesChangedObserver* obs);
-
-  // Remove an existing observer.
-  // Can be called from any thread.
-  // Must not be called from within a notification callback.
-  void RemoveDevicesChangedObserver(DevicesChangedObserver* obs);
-
-  // The ProcessFoo() style methods are a broken pattern and should not
-  // be copied. Any significant addition to this class is blocked on
-  // refactoring to improve the state of affairs. See http://crbug.com/149059
-
-  // Cross-platform handling of a device change event.
-  void ProcessDevicesChanged(DeviceType device_type);
-
- private:
-  // Functions to trigger notifications.
-  void NotifyDevicesChanged(DeviceType device_type);
-
-  scoped_refptr<ObserverListThreadSafe<DevicesChangedObserver> >
-      devices_changed_observer_list_;
-
-  DISALLOW_COPY_AND_ASSIGN(SystemMonitor);
-};
-
-}  // namespace base
-
-#endif  // BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_
diff --git a/build/gen.py b/build/gen.py
index 2755480..8cc7bbd 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -665,7 +665,6 @@
         'base/logging_win.cc',
         'base/message_loop/message_pump_win.cc',
         'base/native_library_win.cc',
-        'base/power_monitor/power_monitor_device_source_win.cc',
         'base/process/kill_win.cc',
         'base/process/launch_win.cc',
         'base/process/memory_win.cc',