Commit 08110cea authored by ben@chromium.org's avatar ben@chromium.org

Move SystemMonitor to src/ui/base/system_monitor.

Move HiResTimerManager to src/chrome/common.

BUG=none
TEST=none
TBR=brettw

Review URL: http://codereview.chromium.org/6361002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71487 0039d316-1c4b-4281-b951-d872f2087c98
parent a61c5c9b
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
'../ui/base/dragdrop/os_exchange_data_win_unittest.cc', '../ui/base/dragdrop/os_exchange_data_win_unittest.cc',
'../ui/base/models/tree_node_iterator_unittest.cc', '../ui/base/models/tree_node_iterator_unittest.cc',
'../ui/base/models/tree_node_model_unittest.cc', '../ui/base/models/tree_node_model_unittest.cc',
'../ui/base/system_monitor/system_monitor_unittest.cc',
'data_pack_unittest.cc', 'data_pack_unittest.cc',
'l10n_util_mac_unittest.mm', 'l10n_util_mac_unittest.mm',
'l10n_util_unittest.cc', 'l10n_util_unittest.cc',
...@@ -54,7 +55,6 @@ ...@@ -54,7 +55,6 @@
'sql/connection_unittest.cc', 'sql/connection_unittest.cc',
'sql/statement_unittest.cc', 'sql/statement_unittest.cc',
'sql/transaction_unittest.cc', 'sql/transaction_unittest.cc',
'system_monitor_unittest.cc',
'test_suite.h', 'test_suite.h',
'test/data/resource.h', 'test/data/resource.h',
'text_elider_unittest.cc', 'text_elider_unittest.cc',
......
...@@ -22,14 +22,11 @@ ...@@ -22,14 +22,11 @@
'app_paths.cc', 'app_paths.cc',
'app_switches.h', 'app_switches.h',
'app_switches.cc', 'app_switches.cc',
'hi_res_timer_manager_posix.cc', '../ui/base/system_monitor/system_monitor.cc',
'hi_res_timer_manager_win.cc', '../ui/base/system_monitor/system_monitor.h',
'hi_res_timer_manager.h', '../ui/base/system_monitor/system_monitor_mac.mm',
'system_monitor.cc', '../ui/base/system_monitor/system_monitor_posix.cc',
'system_monitor.h', '../ui/base/system_monitor/system_monitor_win.cc',
'system_monitor_mac.mm',
'system_monitor_posix.cc',
'system_monitor_win.cc',
], ],
'conditions': [ 'conditions': [
['OS!="linux" and OS!="freebsd" and OS!="openbsd"', { ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', {
......
...@@ -8,10 +8,8 @@ ...@@ -8,10 +8,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "app/hi_res_timer_manager.h"
#include "app/l10n_util.h" #include "app/l10n_util.h"
#include "app/resource_bundle.h" #include "app/resource_bundle.h"
#include "app/system_monitor.h"
#include "base/at_exit.h" #include "base/at_exit.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/debug/trace_event.h" #include "base/debug/trace_event.h"
...@@ -78,6 +76,7 @@ ...@@ -78,6 +76,7 @@
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/env_vars.h" #include "chrome/common/env_vars.h"
#include "chrome/common/hi_res_timer_manager.h"
#include "chrome/common/json_pref_store.h" #include "chrome/common/json_pref_store.h"
#include "chrome/common/jstemplate_builder.h" #include "chrome/common/jstemplate_builder.h"
#include "chrome/common/logging_chrome.h" #include "chrome/common/logging_chrome.h"
...@@ -101,6 +100,7 @@ ...@@ -101,6 +100,7 @@
#include "net/spdy/spdy_session_pool.h" #include "net/spdy/spdy_session_pool.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
#include "net/url_request/url_request_throttler_manager.h" #include "net/url_request/url_request_throttler_manager.h"
#include "ui/base/system_monitor/system_monitor.h"
#if defined(USE_LINUX_BREAKPAD) #if defined(USE_LINUX_BREAKPAD)
#include "base/linux_util.h" #include "base/linux_util.h"
...@@ -469,7 +469,7 @@ void BrowserMainParts::MainMessageLoopStart() { ...@@ -469,7 +469,7 @@ void BrowserMainParts::MainMessageLoopStart() {
main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI));
// TODO(viettrungluu): should these really go before setting the thread name? // TODO(viettrungluu): should these really go before setting the thread name?
system_monitor_.reset(new SystemMonitor); system_monitor_.reset(new ui::SystemMonitor);
hi_res_timer_manager_.reset(new HighResolutionTimerManager); hi_res_timer_manager_.reset(new HighResolutionTimerManager);
network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
......
...@@ -17,12 +17,15 @@ class HighResolutionTimerManager; ...@@ -17,12 +17,15 @@ class HighResolutionTimerManager;
struct MainFunctionParams; struct MainFunctionParams;
class MessageLoop; class MessageLoop;
class MetricsService; class MetricsService;
class SystemMonitor;
namespace net { namespace net {
class NetworkChangeNotifier; class NetworkChangeNotifier;
} }
namespace ui {
class SystemMonitor;
}
// BrowserMainParts: // BrowserMainParts:
// This class contains different "stages" to be executed in |BrowserMain()|, // This class contains different "stages" to be executed in |BrowserMain()|,
// mostly initialization. This is made into a class rather than just functions // mostly initialization. This is made into a class rather than just functions
...@@ -144,7 +147,7 @@ class BrowserMainParts { ...@@ -144,7 +147,7 @@ class BrowserMainParts {
// Members initialized in |MainMessageLoopStart()| --------------------------- // Members initialized in |MainMessageLoopStart()| ---------------------------
scoped_ptr<MessageLoop> main_message_loop_; scoped_ptr<MessageLoop> main_message_loop_;
scoped_ptr<SystemMonitor> system_monitor_; scoped_ptr<ui::SystemMonitor> system_monitor_;
scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_;
scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
scoped_ptr<BrowserThread> main_thread_; scoped_ptr<BrowserThread> main_thread_;
......
...@@ -51,7 +51,7 @@ Profile* ProfileManager::GetDefaultProfile() { ...@@ -51,7 +51,7 @@ Profile* ProfileManager::GetDefaultProfile() {
} }
ProfileManager::ProfileManager() : logged_in_(false) { ProfileManager::ProfileManager() : logged_in_(false) {
SystemMonitor::Get()->AddObserver(this); ui::SystemMonitor::Get()->AddObserver(this);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
registrar_.Add( registrar_.Add(
this, this,
...@@ -61,7 +61,7 @@ ProfileManager::ProfileManager() : logged_in_(false) { ...@@ -61,7 +61,7 @@ ProfileManager::ProfileManager() : logged_in_(false) {
} }
ProfileManager::~ProfileManager() { ProfileManager::~ProfileManager() {
SystemMonitor* system_monitor = SystemMonitor::Get(); ui::SystemMonitor* system_monitor = ui::SystemMonitor::Get();
if (system_monitor) if (system_monitor)
system_monitor->RemoveObserver(this); system_monitor->RemoveObserver(this);
......
...@@ -10,18 +10,18 @@ ...@@ -10,18 +10,18 @@
#include <vector> #include <vector>
#include "app/system_monitor.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/threading/non_thread_safe.h" #include "base/threading/non_thread_safe.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/common/notification_observer.h" #include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h" #include "chrome/common/notification_registrar.h"
#include "ui/base/system_monitor/system_monitor.h"
class FilePath; class FilePath;
class ProfileManager : public base::NonThreadSafe, class ProfileManager : public base::NonThreadSafe,
public SystemMonitor::PowerObserver, public ui::SystemMonitor::PowerObserver,
public NotificationObserver { public NotificationObserver {
public: public:
ProfileManager(); ProfileManager();
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include <string> #include <string>
#include "app/system_monitor.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/file_util.h" #include "base/file_util.h"
#include "base/message_loop.h" #include "base/message_loop.h"
...@@ -18,6 +17,7 @@ ...@@ -18,6 +17,7 @@
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h" #include "chrome/common/notification_service.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/system_monitor/system_monitor.h"
class ProfileManagerTest : public testing::Test { class ProfileManagerTest : public testing::Test {
protected: protected:
...@@ -75,7 +75,7 @@ TEST_F(ProfileManagerTest, CreateProfile) { ...@@ -75,7 +75,7 @@ TEST_F(ProfileManagerTest, CreateProfile) {
TEST_F(ProfileManagerTest, DefaultProfileDir) { TEST_F(ProfileManagerTest, DefaultProfileDir) {
CommandLine *cl = CommandLine::ForCurrentProcess(); CommandLine *cl = CommandLine::ForCurrentProcess();
SystemMonitor dummy; ui::SystemMonitor dummy;
ProfileManager profile_manager; ProfileManager profile_manager;
std::string profile_dir("my_user"); std::string profile_dir("my_user");
...@@ -91,7 +91,7 @@ TEST_F(ProfileManagerTest, DefaultProfileDir) { ...@@ -91,7 +91,7 @@ TEST_F(ProfileManagerTest, DefaultProfileDir) {
// This functionality only exists on Chrome OS. // This functionality only exists on Chrome OS.
TEST_F(ProfileManagerTest, LoggedInProfileDir) { TEST_F(ProfileManagerTest, LoggedInProfileDir) {
CommandLine *cl = CommandLine::ForCurrentProcess(); CommandLine *cl = CommandLine::ForCurrentProcess();
SystemMonitor dummy; ui::SystemMonitor dummy;
ProfileManager profile_manager; ProfileManager profile_manager;
std::string profile_dir("my_user"); std::string profile_dir("my_user");
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include <map> #include <map>
#include <string> #include <string>
#include "app/system_monitor.h"
#include "base/file_path.h" #include "base/file_path.h"
#include "base/file_util.h" #include "base/file_util.h"
#include "base/path_service.h" #include "base/path_service.h"
...@@ -36,6 +35,7 @@ ...@@ -36,6 +35,7 @@
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/test/testing_profile.h" #include "chrome/test/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/system_monitor/system_monitor.h"
using testing::_; using testing::_;
...@@ -230,8 +230,8 @@ class TabStripModelTest : public RenderViewHostTestHarness { ...@@ -230,8 +230,8 @@ class TabStripModelTest : public RenderViewHostTestHarness {
std::wstring profile_path_; std::wstring profile_path_;
std::map<TabContents*, int> foo_; std::map<TabContents*, int> foo_;
// ProfileManager requires a SystemMonitor. // ProfileManager requires a ui::SystemMonitor.
SystemMonitor system_monitor; ui::SystemMonitor system_monitor;
ProfileManager pm_; ProfileManager pm_;
}; };
......
...@@ -93,6 +93,9 @@ ...@@ -93,6 +93,9 @@
'common/guid.h', 'common/guid.h',
'common/guid_posix.cc', 'common/guid_posix.cc',
'common/guid_win.cc', 'common/guid_win.cc',
'common/hi_res_timer_manager_posix.cc',
'common/hi_res_timer_manager_win.cc',
'common/hi_res_timer_manager.h',
'common/indexed_db_key.cc', 'common/indexed_db_key.cc',
'common/indexed_db_key.h', 'common/indexed_db_key.h',
'common/indexed_db_messages.cc', 'common/indexed_db_messages.cc',
......
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef APP_HI_RES_TIMER_MANAGER_H_ #ifndef CHROME_COMMON_HI_RES_TIMER_MANAGER_H_
#define APP_HI_RES_TIMER_MANAGER_H_ #define CHROME_COMMON_HI_RES_TIMER_MANAGER_H_
#pragma once #pragma once
#include "app/system_monitor.h" #include "ui/base/system_monitor/system_monitor.h"
// Ensures that the Windows high resolution timer is only used // Ensures that the Windows high resolution timer is only used
// when not running on battery power. // when not running on battery power.
class HighResolutionTimerManager : public SystemMonitor::PowerObserver { class HighResolutionTimerManager : public ui::SystemMonitor::PowerObserver {
public: public:
HighResolutionTimerManager(); HighResolutionTimerManager();
virtual ~HighResolutionTimerManager(); virtual ~HighResolutionTimerManager();
// SystemMonitor::PowerObserver: // ui::SystemMonitor::PowerObserver:
virtual void OnPowerStateChange(bool on_battery_power); virtual void OnPowerStateChange(bool on_battery_power);
private: private:
...@@ -27,4 +27,4 @@ class HighResolutionTimerManager : public SystemMonitor::PowerObserver { ...@@ -27,4 +27,4 @@ class HighResolutionTimerManager : public SystemMonitor::PowerObserver {
DISALLOW_COPY_AND_ASSIGN(HighResolutionTimerManager); DISALLOW_COPY_AND_ASSIGN(HighResolutionTimerManager);
}; };
#endif // APP_HI_RES_TIMER_MANAGER_H_ #endif // CHROME_COMMON_HI_RES_TIMER_MANAGER_H_
\ No newline at end of file
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "app/hi_res_timer_manager.h" #include "chrome/common/hi_res_timer_manager.h"
// On POSIX we don't need to do anything special with the system timer. // On POSIX we don't need to do anything special with the system timer.
......
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "app/hi_res_timer_manager.h" #include "chrome/common/hi_res_timer_manager.h"
#include "base/time.h" #include "base/time.h"
HighResolutionTimerManager::HighResolutionTimerManager() HighResolutionTimerManager::HighResolutionTimerManager()
: hi_res_clock_used_(false) { : hi_res_clock_used_(false) {
SystemMonitor* system_monitor = SystemMonitor::Get(); ui::SystemMonitor* system_monitor = ui::SystemMonitor::Get();
system_monitor->AddObserver(this); system_monitor->AddObserver(this);
UseHiResClock(!system_monitor->BatteryPower()); UseHiResClock(!system_monitor->BatteryPower());
} }
HighResolutionTimerManager::~HighResolutionTimerManager() { HighResolutionTimerManager::~HighResolutionTimerManager() {
SystemMonitor::Get()->RemoveObserver(this); ui::SystemMonitor::Get()->RemoveObserver(this);
UseHiResClock(false); UseHiResClock(false);
} }
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#include <windows.h> #include <windows.h>
#endif #endif
#include "app/hi_res_timer_manager.h"
#include "app/system_monitor.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/string_util.h" #include "base/string_util.h"
...@@ -21,12 +19,14 @@ ...@@ -21,12 +19,14 @@
#include "chrome/common/child_process.h" #include "chrome/common/child_process.h"
#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/hi_res_timer_manager.h"
#include "chrome/common/logging_chrome.h" #include "chrome/common/logging_chrome.h"
#include "chrome/common/main_function_params.h" #include "chrome/common/main_function_params.h"
#include "chrome/common/result_codes.h" #include "chrome/common/result_codes.h"
#include "chrome/common/sandbox_policy.h" #include "chrome/common/sandbox_policy.h"
#include "chrome/nacl/nacl_main_platform_delegate.h" #include "chrome/nacl/nacl_main_platform_delegate.h"
#include "chrome/nacl/nacl_thread.h" #include "chrome/nacl/nacl_thread.h"
#include "ui/base/system_monitor/system_monitor.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "chrome/nacl/broker_thread.h" #include "chrome/nacl/broker_thread.h"
...@@ -43,7 +43,7 @@ int NaClBrokerMain(const MainFunctionParams& parameters) { ...@@ -43,7 +43,7 @@ int NaClBrokerMain(const MainFunctionParams& parameters) {
MessageLoopForIO main_message_loop; MessageLoopForIO main_message_loop;
base::PlatformThread::SetName("CrNaClBrokerMain"); base::PlatformThread::SetName("CrNaClBrokerMain");
SystemMonitor system_monitor; ui::SystemMonitor system_monitor;
HighResolutionTimerManager hi_res_timer_manager; HighResolutionTimerManager hi_res_timer_manager;
const CommandLine& parsed_command_line = parameters.command_line_; const CommandLine& parsed_command_line = parameters.command_line_;
...@@ -111,7 +111,7 @@ int NaClMain(const MainFunctionParams& parameters) { ...@@ -111,7 +111,7 @@ int NaClMain(const MainFunctionParams& parameters) {
MessageLoopForIO main_message_loop; MessageLoopForIO main_message_loop;
base::PlatformThread::SetName("CrNaClMain"); base::PlatformThread::SetName("CrNaClMain");
SystemMonitor system_monitor; ui::SystemMonitor system_monitor;
HighResolutionTimerManager hi_res_timer_manager; HighResolutionTimerManager hi_res_timer_manager;
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include <windows.h> #include <windows.h>
#endif #endif
#include "app/hi_res_timer_manager.h"
#include "app/system_monitor.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/string_util.h" #include "base/string_util.h"
...@@ -20,9 +18,11 @@ ...@@ -20,9 +18,11 @@
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/default_plugin.h" #include "chrome/common/default_plugin.h"
#include "chrome/common/gpu_plugin.h" #include "chrome/common/gpu_plugin.h"
#include "chrome/common/hi_res_timer_manager.h"
#include "chrome/common/logging_chrome.h" #include "chrome/common/logging_chrome.h"
#include "chrome/common/main_function_params.h" #include "chrome/common/main_function_params.h"
#include "chrome/plugin/plugin_thread.h" #include "chrome/plugin/plugin_thread.h"
#include "ui/base/system_monitor/system_monitor.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "chrome/test/injection_test_dll.h" #include "chrome/test/injection_test_dll.h"
...@@ -94,7 +94,7 @@ int PluginMain(const MainFunctionParams& parameters) { ...@@ -94,7 +94,7 @@ int PluginMain(const MainFunctionParams& parameters) {
MessageLoop main_message_loop(MessageLoop::TYPE_UI); MessageLoop main_message_loop(MessageLoop::TYPE_UI);
base::PlatformThread::SetName("CrPluginMain"); base::PlatformThread::SetName("CrPluginMain");
SystemMonitor system_monitor; ui::SystemMonitor system_monitor;
HighResolutionTimerManager high_resolution_timer_manager; HighResolutionTimerManager high_resolution_timer_manager;
const CommandLine& parsed_command_line = parameters.command_line_; const CommandLine& parsed_command_line = parameters.command_line_;
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include <unistd.h> #include <unistd.h>
#endif // OS_MACOSX #endif // OS_MACOSX
#include "app/hi_res_timer_manager.h"
#include "app/system_monitor.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/debug/trace_event.h" #include "base/debug/trace_event.h"
#include "base/mac/scoped_nsautorelease_pool.h" #include "base/mac/scoped_nsautorelease_pool.h"
...@@ -23,6 +21,7 @@ ...@@ -23,6 +21,7 @@
#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_counters.h" #include "chrome/common/chrome_counters.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/hi_res_timer_manager.h"
#include "chrome/common/logging_chrome.h" #include "chrome/common/logging_chrome.h"
#include "chrome/common/main_function_params.h" #include "chrome/common/main_function_params.h"
#include "chrome/common/net/net_resource_provider.h" #include "chrome/common/net/net_resource_provider.h"
...@@ -32,6 +31,7 @@ ...@@ -32,6 +31,7 @@
#include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_thread.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "net/base/net_module.h" #include "net/base/net_module.h"
#include "ui/base/system_monitor/system_monitor.h"
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#include "base/eintr_wrapper.h" #include "base/eintr_wrapper.h"
...@@ -240,7 +240,7 @@ int RendererMain(const MainFunctionParams& parameters) { ...@@ -240,7 +240,7 @@ int RendererMain(const MainFunctionParams& parameters) {
base::PlatformThread::SetName("CrRendererMain"); base::PlatformThread::SetName("CrRendererMain");
SystemMonitor system_monitor; ui::SystemMonitor system_monitor;
HighResolutionTimerManager hi_res_timer_manager; HighResolutionTimerManager hi_res_timer_manager;
platform.PlatformInitialize(); platform.PlatformInitialize();
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "app/app_switches.h" #include "app/app_switches.h"
#include "app/hi_res_timer_manager.h"
#include "app/system_monitor.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/file_util.h" #include "base/file_util.h"
#include "base/message_loop.h" #include "base/message_loop.h"
...@@ -15,9 +13,11 @@ ...@@ -15,9 +13,11 @@
#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension_l10n_util.h" #include "chrome/common/extensions/extension_l10n_util.h"
#include "chrome/common/hi_res_timer_manager.h"
#include "chrome/common/logging_chrome.h" #include "chrome/common/logging_chrome.h"
#include "chrome/common/main_function_params.h" #include "chrome/common/main_function_params.h"
#include "chrome/utility/utility_thread.h" #include "chrome/utility/utility_thread.h"
#include "ui/base/system_monitor/system_monitor.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
...@@ -31,7 +31,7 @@ int UtilityMain(const MainFunctionParams& parameters) { ...@@ -31,7 +31,7 @@ int UtilityMain(const MainFunctionParams& parameters) {
MessageLoop main_message_loop; MessageLoop main_message_loop;
base::PlatformThread::SetName("CrUtilityMain"); base::PlatformThread::SetName("CrUtilityMain");
SystemMonitor system_monitor; ui::SystemMonitor system_monitor;
HighResolutionTimerManager hi_res_timer_manager; HighResolutionTimerManager hi_res_timer_manager;
ChildProcess utility_process; ChildProcess utility_process;
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "app/hi_res_timer_manager.h"
#include "app/system_monitor.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/string_util.h" #include "base/string_util.h"
...@@ -11,9 +9,11 @@ ...@@ -11,9 +9,11 @@
#include "chrome/common/child_process.h" #include "chrome/common/child_process.h"
#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/hi_res_timer_manager.h"
#include "chrome/common/logging_chrome.h" #include "chrome/common/logging_chrome.h"
#include "chrome/common/main_function_params.h" #include "chrome/common/main_function_params.h"
#include "chrome/worker/worker_thread.h" #include "chrome/worker/worker_thread.h"
#include "ui/base/system_monitor/system_monitor.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "chrome/common/sandbox_init_wrapper.h" #include "chrome/common/sandbox_init_wrapper.h"
...@@ -26,7 +26,7 @@ int WorkerMain(const MainFunctionParams& parameters) { ...@@ -26,7 +26,7 @@ int WorkerMain(const MainFunctionParams& parameters) {
MessageLoop main_message_loop; MessageLoop main_message_loop;
base::PlatformThread::SetName("CrWorkerMain"); base::PlatformThread::SetName("CrWorkerMain");
SystemMonitor system_monitor; ui::SystemMonitor system_monitor;
HighResolutionTimerManager hi_res_timer_manager; HighResolutionTimerManager hi_res_timer_manager;
ChildProcess worker_process; ChildProcess worker_process;
......
...@@ -183,7 +183,7 @@ FakeExternalTab::~FakeExternalTab() { ...@@ -183,7 +183,7 @@ FakeExternalTab::~FakeExternalTab() {
void FakeExternalTab::Initialize() { void FakeExternalTab::Initialize() {
DCHECK(g_browser_process == NULL); DCHECK(g_browser_process == NULL);
SystemMonitor system_monitor; ui::SystemMonitor system_monitor;
// The gears plugin causes the PluginRequestInterceptor to kick in and it // The gears plugin causes the PluginRequestInterceptor to kick in and it
// will cause problems when it tries to intercept URL requests. // will cause problems when it tries to intercept URL requests.
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "app/system_monitor.h" #include "ui/base/system_monitor/system_monitor.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/time.h" #include "base/time.h"
namespace ui {
static SystemMonitor* g_system_monitor = NULL; static SystemMonitor* g_system_monitor = NULL;
#if defined(ENABLE_BATTERY_MONITORING) #if defined(ENABLE_BATTERY_MONITORING)
...@@ -102,3 +104,5 @@ void SystemMonitor::NotifyResume() { ...@@ -102,3 +104,5 @@ void SystemMonitor::NotifyResume() {
void SystemMonitor::BatteryCheck() { void SystemMonitor::BatteryCheck() {
ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT); ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT);
} }
} // namespace ui
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef APP_SYSTEM_MONITOR_H_ #ifndef UI_BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_
#define APP_SYSTEM_MONITOR_H_ #define UI_BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_
#pragma once #pragma once
#include "build/build_config.h" #include "build/build_config.h"
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include "base/timer.h" #include "base/timer.h"
#endif // defined(ENABLE_BATTERY_MONITORING) #endif // defined(ENABLE_BATTERY_MONITORING)
namespace ui {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#ifdef __OBJC__ #ifdef __OBJC__
@class SystemMonitorBridge; @class SystemMonitorBridge;
...@@ -136,4 +138,6 @@ class SystemMonitor { ...@@ -136,4 +138,6 @@ class SystemMonitor {
DISALLOW_COPY_AND_ASSIGN(SystemMonitor); DISALLOW_COPY_AND_ASSIGN(SystemMonitor);
}; };
#endif // APP_SYSTEM_MONITOR_H_ } // namespace ui
#endif // UI_BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "app/system_monitor.h" #include "ui/base/system_monitor/system_monitor.h"
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
namespace ui {
@interface SystemMonitorBridge : NSObject { @interface SystemMonitorBridge : NSObject {
@private @private
SystemMonitor* systemMonitor_; // weak SystemMonitor* systemMonitor_; // weak
...@@ -65,3 +67,5 @@ void SystemMonitor::PlatformInit() { ...@@ -65,3 +67,5 @@ void SystemMonitor::PlatformInit() {
void SystemMonitor::PlatformDestroy() { void SystemMonitor::PlatformDestroy() {
[system_monitor_bridge_ release]; [system_monitor_bridge_ release];
} }
} // namespace ui
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "app/system_monitor.h" #include "ui/base/system_monitor/system_monitor.h"
namespace ui {
bool SystemMonitor::IsBatteryPower() { bool SystemMonitor::IsBatteryPower() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return false; return false;
} }
} // namespace ui
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "app/system_monitor.h" #include "ui/base/system_monitor/system_monitor.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace ui {
class PowerTest : public SystemMonitor::PowerObserver { class PowerTest : public SystemMonitor::PowerObserver {
public: public:
PowerTest() PowerTest()
...@@ -85,3 +87,5 @@ TEST(SystemMonitor, PowerNotifications) { ...@@ -85,3 +87,5 @@ TEST(SystemMonitor, PowerNotifications) {
loop.RunAllPending(); loop.RunAllPending();
EXPECT_EQ(test[0].resumes(), 1); EXPECT_EQ(test[0].resumes(), 1);
} }
} // namespace ui
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "app/system_monitor.h" #include "ui/base/system_monitor/system_monitor.h"
namespace ui {
void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) { void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) {
PowerEvent power_event; PowerEvent power_event;
...@@ -44,3 +46,5 @@ bool SystemMonitor::IsBatteryPower() { ...@@ -44,3 +46,5 @@ bool SystemMonitor::IsBatteryPower() {
} }
return (status.ACLineStatus == 0); return (status.ACLineStatus == 0);
} }
} // namespace ui
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "views/widget/widget_win.h" #include "views/widget/widget_win.h"
#include "app/l10n_util_win.h" #include "app/l10n_util_win.h"
#include "app/system_monitor.h"
#include "app/view_prop.h" #include "app/view_prop.h"
#include "app/win/hwnd_util.h" #include "app/win/hwnd_util.h"
#include "app/win/win_util.h" #include "app/win/win_util.h"
...@@ -14,6 +13,7 @@ ...@@ -14,6 +13,7 @@
#include "gfx/native_theme_win.h" #include "gfx/native_theme_win.h"
#include "gfx/path.h" #include "gfx/path.h"
#include "ui/base/keycodes/keyboard_code_conversion_win.h" #include "ui/base/keycodes/keyboard_code_conversion_win.h"
#include "ui/base/system_monitor/system_monitor.h"
#include "views/accessibility/view_accessibility.h" #include "views/accessibility/view_accessibility.h"
#include "views/controls/native_control_win.h" #include "views/controls/native_control_win.h"
#include "views/focus/focus_util_win.h" #include "views/focus/focus_util_win.h"
...@@ -867,7 +867,7 @@ void WidgetWin::OnPaint(HDC dc) { ...@@ -867,7 +867,7 @@ void WidgetWin::OnPaint(HDC dc) {
} }
LRESULT WidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) { LRESULT WidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) {
SystemMonitor* monitor = SystemMonitor::Get(); ui::SystemMonitor* monitor = ui::SystemMonitor::Get();
if (monitor) if (monitor)
monitor->ProcessWmPowerBroadcastMessage(power_event); monitor->ProcessWmPowerBroadcastMessage(power_event);
SetMsgHandled(FALSE); SetMsgHandled(FALSE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment