diff options
25 files changed, 97 insertions, 70 deletions
diff --git a/app/app.gyp b/app/app.gyp index 09231358..de566ee 100644 --- a/app/app.gyp +++ b/app/app.gyp @@ -47,6 +47,7 @@ '../ui/base/dragdrop/os_exchange_data_win_unittest.cc', '../ui/base/models/tree_node_iterator_unittest.cc', '../ui/base/models/tree_node_model_unittest.cc', + '../ui/base/system_monitor/system_monitor_unittest.cc', 'data_pack_unittest.cc', 'l10n_util_mac_unittest.mm', 'l10n_util_unittest.cc', @@ -54,7 +55,6 @@ 'sql/connection_unittest.cc', 'sql/statement_unittest.cc', 'sql/transaction_unittest.cc', - 'system_monitor_unittest.cc', 'test_suite.h', 'test/data/resource.h', 'text_elider_unittest.cc', diff --git a/app/app_base.gypi b/app/app_base.gypi index 126d04d..c35847f 100644 --- a/app/app_base.gypi +++ b/app/app_base.gypi @@ -22,14 +22,11 @@ 'app_paths.cc', 'app_switches.h', 'app_switches.cc', - 'hi_res_timer_manager_posix.cc', - 'hi_res_timer_manager_win.cc', - 'hi_res_timer_manager.h', - 'system_monitor.cc', - 'system_monitor.h', - 'system_monitor_mac.mm', - 'system_monitor_posix.cc', - 'system_monitor_win.cc', + '../ui/base/system_monitor/system_monitor.cc', + '../ui/base/system_monitor/system_monitor.h', + '../ui/base/system_monitor/system_monitor_mac.mm', + '../ui/base/system_monitor/system_monitor_posix.cc', + '../ui/base/system_monitor/system_monitor_win.cc', ], 'conditions': [ ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', { diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 961f783..64f0dd3 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -8,10 +8,8 @@ #include <string> #include <vector> -#include "app/hi_res_timer_manager.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/system_monitor.h" #include "base/at_exit.h" #include "base/command_line.h" #include "base/debug/trace_event.h" @@ -78,6 +76,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.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/jstemplate_builder.h" #include "chrome/common/logging_chrome.h" @@ -101,6 +100,7 @@ #include "net/spdy/spdy_session_pool.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_throttler_manager.h" +#include "ui/base/system_monitor/system_monitor.h" #if defined(USE_LINUX_BREAKPAD) #include "base/linux_util.h" @@ -469,7 +469,7 @@ void BrowserMainParts::MainMessageLoopStart() { main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); // 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); network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); diff --git a/chrome/browser/browser_main.h b/chrome/browser/browser_main.h index 9154a4c..7fd7142 100644 --- a/chrome/browser/browser_main.h +++ b/chrome/browser/browser_main.h @@ -17,12 +17,15 @@ class HighResolutionTimerManager; struct MainFunctionParams; class MessageLoop; class MetricsService; -class SystemMonitor; namespace net { class NetworkChangeNotifier; } +namespace ui { +class SystemMonitor; +} + // BrowserMainParts: // This class contains different "stages" to be executed in |BrowserMain()|, // mostly initialization. This is made into a class rather than just functions @@ -144,7 +147,7 @@ class BrowserMainParts { // Members initialized in |MainMessageLoopStart()| --------------------------- 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<net::NetworkChangeNotifier> network_change_notifier_; scoped_ptr<BrowserThread> main_thread_; diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index 87a03ea..2bae317 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -51,7 +51,7 @@ Profile* ProfileManager::GetDefaultProfile() { } ProfileManager::ProfileManager() : logged_in_(false) { - SystemMonitor::Get()->AddObserver(this); + ui::SystemMonitor::Get()->AddObserver(this); #if defined(OS_CHROMEOS) registrar_.Add( this, @@ -61,7 +61,7 @@ ProfileManager::ProfileManager() : logged_in_(false) { } ProfileManager::~ProfileManager() { - SystemMonitor* system_monitor = SystemMonitor::Get(); + ui::SystemMonitor* system_monitor = ui::SystemMonitor::Get(); if (system_monitor) system_monitor->RemoveObserver(this); diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h index 1d6483d..d2f9281 100644 --- a/chrome/browser/profiles/profile_manager.h +++ b/chrome/browser/profiles/profile_manager.h @@ -10,18 +10,18 @@ #include <vector> -#include "app/system_monitor.h" #include "base/basictypes.h" #include "base/message_loop.h" #include "base/threading/non_thread_safe.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" +#include "ui/base/system_monitor/system_monitor.h" class FilePath; class ProfileManager : public base::NonThreadSafe, - public SystemMonitor::PowerObserver, + public ui::SystemMonitor::PowerObserver, public NotificationObserver { public: ProfileManager(); diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc index 42f6d91..6f3ef1a 100644 --- a/chrome/browser/profiles/profile_manager_unittest.cc +++ b/chrome/browser/profiles/profile_manager_unittest.cc @@ -4,7 +4,6 @@ #include <string> -#include "app/system_monitor.h" #include "base/command_line.h" #include "base/file_util.h" #include "base/message_loop.h" @@ -18,6 +17,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/notification_service.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/system_monitor/system_monitor.h" class ProfileManagerTest : public testing::Test { protected: @@ -75,7 +75,7 @@ TEST_F(ProfileManagerTest, CreateProfile) { TEST_F(ProfileManagerTest, DefaultProfileDir) { CommandLine *cl = CommandLine::ForCurrentProcess(); - SystemMonitor dummy; + ui::SystemMonitor dummy; ProfileManager profile_manager; std::string profile_dir("my_user"); @@ -91,7 +91,7 @@ TEST_F(ProfileManagerTest, DefaultProfileDir) { // This functionality only exists on Chrome OS. TEST_F(ProfileManagerTest, LoggedInProfileDir) { CommandLine *cl = CommandLine::ForCurrentProcess(); - SystemMonitor dummy; + ui::SystemMonitor dummy; ProfileManager profile_manager; std::string profile_dir("my_user"); diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc index a21ef74..21ed2a5 100644 --- a/chrome/browser/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/tabs/tab_strip_model_unittest.cc @@ -5,7 +5,6 @@ #include <map> #include <string> -#include "app/system_monitor.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/path_service.h" @@ -36,6 +35,7 @@ #include "chrome/common/url_constants.h" #include "chrome/test/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/system_monitor/system_monitor.h" using testing::_; @@ -230,8 +230,8 @@ class TabStripModelTest : public RenderViewHostTestHarness { std::wstring profile_path_; std::map<TabContents*, int> foo_; - // ProfileManager requires a SystemMonitor. - SystemMonitor system_monitor; + // ProfileManager requires a ui::SystemMonitor. + ui::SystemMonitor system_monitor; ProfileManager pm_; }; diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index a7cd981..869653f 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -93,6 +93,9 @@ 'common/guid.h', 'common/guid_posix.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.h', 'common/indexed_db_messages.cc', diff --git a/app/hi_res_timer_manager.h b/chrome/common/hi_res_timer_manager.h index 7f3b87b..5610a61 100644 --- a/app/hi_res_timer_manager.h +++ b/chrome/common/hi_res_timer_manager.h @@ -1,21 +1,21 @@ -// 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 // found in the LICENSE file. -#ifndef APP_HI_RES_TIMER_MANAGER_H_ -#define APP_HI_RES_TIMER_MANAGER_H_ +#ifndef CHROME_COMMON_HI_RES_TIMER_MANAGER_H_ +#define CHROME_COMMON_HI_RES_TIMER_MANAGER_H_ #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 // when not running on battery power. -class HighResolutionTimerManager : public SystemMonitor::PowerObserver { +class HighResolutionTimerManager : public ui::SystemMonitor::PowerObserver { public: HighResolutionTimerManager(); virtual ~HighResolutionTimerManager(); - // SystemMonitor::PowerObserver: + // ui::SystemMonitor::PowerObserver: virtual void OnPowerStateChange(bool on_battery_power); private: @@ -27,4 +27,4 @@ class HighResolutionTimerManager : public SystemMonitor::PowerObserver { 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 diff --git a/app/hi_res_timer_manager_posix.cc b/chrome/common/hi_res_timer_manager_posix.cc index 1398449..fc9c1ba 100644 --- a/app/hi_res_timer_manager_posix.cc +++ b/chrome/common/hi_res_timer_manager_posix.cc @@ -1,8 +1,8 @@ -// 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 // 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. diff --git a/app/hi_res_timer_manager_win.cc b/chrome/common/hi_res_timer_manager_win.cc index 6fbffca..c165222 100644 --- a/app/hi_res_timer_manager_win.cc +++ b/chrome/common/hi_res_timer_manager_win.cc @@ -1,20 +1,20 @@ -// 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 // found in the LICENSE file. -#include "app/hi_res_timer_manager.h" +#include "chrome/common/hi_res_timer_manager.h" #include "base/time.h" HighResolutionTimerManager::HighResolutionTimerManager() : hi_res_clock_used_(false) { - SystemMonitor* system_monitor = SystemMonitor::Get(); + ui::SystemMonitor* system_monitor = ui::SystemMonitor::Get(); system_monitor->AddObserver(this); UseHiResClock(!system_monitor->BatteryPower()); } HighResolutionTimerManager::~HighResolutionTimerManager() { - SystemMonitor::Get()->RemoveObserver(this); + ui::SystemMonitor::Get()->RemoveObserver(this); UseHiResClock(false); } diff --git a/chrome/nacl/nacl_main.cc b/chrome/nacl/nacl_main.cc index 0e63273..cb7fe26 100644 --- a/chrome/nacl/nacl_main.cc +++ b/chrome/nacl/nacl_main.cc @@ -8,8 +8,6 @@ #include <windows.h> #endif -#include "app/hi_res_timer_manager.h" -#include "app/system_monitor.h" #include "base/command_line.h" #include "base/message_loop.h" #include "base/string_util.h" @@ -21,12 +19,14 @@ #include "chrome/common/child_process.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/hi_res_timer_manager.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/main_function_params.h" #include "chrome/common/result_codes.h" #include "chrome/common/sandbox_policy.h" #include "chrome/nacl/nacl_main_platform_delegate.h" #include "chrome/nacl/nacl_thread.h" +#include "ui/base/system_monitor/system_monitor.h" #if defined(OS_WIN) #include "chrome/nacl/broker_thread.h" @@ -43,7 +43,7 @@ int NaClBrokerMain(const MainFunctionParams& parameters) { MessageLoopForIO main_message_loop; base::PlatformThread::SetName("CrNaClBrokerMain"); - SystemMonitor system_monitor; + ui::SystemMonitor system_monitor; HighResolutionTimerManager hi_res_timer_manager; const CommandLine& parsed_command_line = parameters.command_line_; @@ -111,7 +111,7 @@ int NaClMain(const MainFunctionParams& parameters) { MessageLoopForIO main_message_loop; base::PlatformThread::SetName("CrNaClMain"); - SystemMonitor system_monitor; + ui::SystemMonitor system_monitor; HighResolutionTimerManager hi_res_timer_manager; #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc index dee171c..8417e92 100644 --- a/chrome/plugin/plugin_main.cc +++ b/chrome/plugin/plugin_main.cc @@ -9,8 +9,6 @@ #include <windows.h> #endif -#include "app/hi_res_timer_manager.h" -#include "app/system_monitor.h" #include "base/command_line.h" #include "base/message_loop.h" #include "base/string_util.h" @@ -20,9 +18,11 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/default_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/main_function_params.h" #include "chrome/plugin/plugin_thread.h" +#include "ui/base/system_monitor/system_monitor.h" #if defined(OS_WIN) #include "chrome/test/injection_test_dll.h" @@ -94,7 +94,7 @@ int PluginMain(const MainFunctionParams& parameters) { MessageLoop main_message_loop(MessageLoop::TYPE_UI); base::PlatformThread::SetName("CrPluginMain"); - SystemMonitor system_monitor; + ui::SystemMonitor system_monitor; HighResolutionTimerManager high_resolution_timer_manager; const CommandLine& parsed_command_line = parameters.command_line_; diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc index a380902..8a08d4c 100644 --- a/chrome/renderer/renderer_main.cc +++ b/chrome/renderer/renderer_main.cc @@ -7,8 +7,6 @@ #include <unistd.h> #endif // OS_MACOSX -#include "app/hi_res_timer_manager.h" -#include "app/system_monitor.h" #include "base/command_line.h" #include "base/debug/trace_event.h" #include "base/mac/scoped_nsautorelease_pool.h" @@ -23,6 +21,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_counters.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/hi_res_timer_manager.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/main_function_params.h" #include "chrome/common/net/net_resource_provider.h" @@ -32,6 +31,7 @@ #include "chrome/renderer/render_thread.h" #include "grit/generated_resources.h" #include "net/base/net_module.h" +#include "ui/base/system_monitor/system_monitor.h" #if defined(OS_MACOSX) #include "base/eintr_wrapper.h" @@ -240,7 +240,7 @@ int RendererMain(const MainFunctionParams& parameters) { base::PlatformThread::SetName("CrRendererMain"); - SystemMonitor system_monitor; + ui::SystemMonitor system_monitor; HighResolutionTimerManager hi_res_timer_manager; platform.PlatformInitialize(); diff --git a/chrome/utility/utility_main.cc b/chrome/utility/utility_main.cc index 74360c8..d0159dd 100644 --- a/chrome/utility/utility_main.cc +++ b/chrome/utility/utility_main.cc @@ -3,8 +3,6 @@ // found in the LICENSE file. #include "app/app_switches.h" -#include "app/hi_res_timer_manager.h" -#include "app/system_monitor.h" #include "base/command_line.h" #include "base/file_util.h" #include "base/message_loop.h" @@ -15,9 +13,11 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.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/main_function_params.h" #include "chrome/utility/utility_thread.h" +#include "ui/base/system_monitor/system_monitor.h" #if defined(OS_WIN) #include "chrome/common/chrome_switches.h" @@ -31,7 +31,7 @@ int UtilityMain(const MainFunctionParams& parameters) { MessageLoop main_message_loop; base::PlatformThread::SetName("CrUtilityMain"); - SystemMonitor system_monitor; + ui::SystemMonitor system_monitor; HighResolutionTimerManager hi_res_timer_manager; ChildProcess utility_process; diff --git a/chrome/worker/worker_main.cc b/chrome/worker/worker_main.cc index 0ba0e87..c39a4b8 100644 --- a/chrome/worker/worker_main.cc +++ b/chrome/worker/worker_main.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/hi_res_timer_manager.h" -#include "app/system_monitor.h" #include "base/command_line.h" #include "base/message_loop.h" #include "base/string_util.h" @@ -11,9 +9,11 @@ #include "chrome/common/child_process.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/hi_res_timer_manager.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/main_function_params.h" #include "chrome/worker/worker_thread.h" +#include "ui/base/system_monitor/system_monitor.h" #if defined(OS_WIN) #include "chrome/common/sandbox_init_wrapper.h" @@ -26,7 +26,7 @@ int WorkerMain(const MainFunctionParams& parameters) { MessageLoop main_message_loop; base::PlatformThread::SetName("CrWorkerMain"); - SystemMonitor system_monitor; + ui::SystemMonitor system_monitor; HighResolutionTimerManager hi_res_timer_manager; ChildProcess worker_process; diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index 118496c..c48af62 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -183,7 +183,7 @@ FakeExternalTab::~FakeExternalTab() { void FakeExternalTab::Initialize() { DCHECK(g_browser_process == NULL); - SystemMonitor system_monitor; + ui::SystemMonitor system_monitor; // The gears plugin causes the PluginRequestInterceptor to kick in and it // will cause problems when it tries to intercept URL requests. diff --git a/app/system_monitor.cc b/ui/base/system_monitor/system_monitor.cc index a30dac1..80110cb 100644 --- a/app/system_monitor.cc +++ b/ui/base/system_monitor/system_monitor.cc @@ -1,13 +1,15 @@ -// 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 // found in the LICENSE file. -#include "app/system_monitor.h" +#include "ui/base/system_monitor/system_monitor.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/time.h" +namespace ui { + static SystemMonitor* g_system_monitor = NULL; #if defined(ENABLE_BATTERY_MONITORING) @@ -102,3 +104,5 @@ void SystemMonitor::NotifyResume() { void SystemMonitor::BatteryCheck() { ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT); } + +} // namespace ui diff --git a/app/system_monitor.h b/ui/base/system_monitor/system_monitor.h index 39711a7..392c3b0 100644 --- a/app/system_monitor.h +++ b/ui/base/system_monitor/system_monitor.h @@ -1,9 +1,9 @@ -// 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 // found in the LICENSE file. -#ifndef APP_SYSTEM_MONITOR_H_ -#define APP_SYSTEM_MONITOR_H_ +#ifndef UI_BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ +#define UI_BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ #pragma once #include "build/build_config.h" @@ -21,6 +21,8 @@ #include "base/timer.h" #endif // defined(ENABLE_BATTERY_MONITORING) +namespace ui { + #if defined(OS_MACOSX) #ifdef __OBJC__ @class SystemMonitorBridge; @@ -136,4 +138,6 @@ class SystemMonitor { DISALLOW_COPY_AND_ASSIGN(SystemMonitor); }; -#endif // APP_SYSTEM_MONITOR_H_ +} // namespace ui + +#endif // UI_BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ diff --git a/app/system_monitor_mac.mm b/ui/base/system_monitor/system_monitor_mac.mm index d40970b..5fba6c3 100644 --- a/app/system_monitor_mac.mm +++ b/ui/base/system_monitor/system_monitor_mac.mm @@ -1,11 +1,13 @@ -// 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 // found in the LICENSE file. -#include "app/system_monitor.h" +#include "ui/base/system_monitor/system_monitor.h" #import <AppKit/AppKit.h> +namespace ui { + @interface SystemMonitorBridge : NSObject { @private SystemMonitor* systemMonitor_; // weak @@ -65,3 +67,5 @@ void SystemMonitor::PlatformInit() { void SystemMonitor::PlatformDestroy() { [system_monitor_bridge_ release]; } + +} // namespace ui diff --git a/app/system_monitor_posix.cc b/ui/base/system_monitor/system_monitor_posix.cc index 5ac7a12..ddd0fe0 100644 --- a/app/system_monitor_posix.cc +++ b/ui/base/system_monitor/system_monitor_posix.cc @@ -1,10 +1,14 @@ -// 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 // found in the LICENSE file. -#include "app/system_monitor.h" +#include "ui/base/system_monitor/system_monitor.h" + +namespace ui { bool SystemMonitor::IsBatteryPower() { NOTIMPLEMENTED(); return false; } + +} // namespace ui diff --git a/app/system_monitor_unittest.cc b/ui/base/system_monitor/system_monitor_unittest.cc index 5b107aa..28b2cbf 100644 --- a/app/system_monitor_unittest.cc +++ b/ui/base/system_monitor/system_monitor_unittest.cc @@ -1,10 +1,12 @@ -// 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 // 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" +namespace ui { + class PowerTest : public SystemMonitor::PowerObserver { public: PowerTest() @@ -85,3 +87,5 @@ TEST(SystemMonitor, PowerNotifications) { loop.RunAllPending(); EXPECT_EQ(test[0].resumes(), 1); } + +} // namespace ui diff --git a/app/system_monitor_win.cc b/ui/base/system_monitor/system_monitor_win.cc index c9347dc..df8aabf 100644 --- a/app/system_monitor_win.cc +++ b/ui/base/system_monitor/system_monitor_win.cc @@ -1,8 +1,10 @@ -// 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 // 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) { PowerEvent power_event; @@ -44,3 +46,5 @@ bool SystemMonitor::IsBatteryPower() { } return (status.ACLineStatus == 0); } + +} // namespace ui diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 8fab0ae..587d871 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -5,7 +5,6 @@ #include "views/widget/widget_win.h" #include "app/l10n_util_win.h" -#include "app/system_monitor.h" #include "app/view_prop.h" #include "app/win/hwnd_util.h" #include "app/win/win_util.h" @@ -14,6 +13,7 @@ #include "gfx/native_theme_win.h" #include "gfx/path.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/controls/native_control_win.h" #include "views/focus/focus_util_win.h" @@ -867,7 +867,7 @@ void WidgetWin::OnPaint(HDC dc) { } LRESULT WidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) { - SystemMonitor* monitor = SystemMonitor::Get(); + ui::SystemMonitor* monitor = ui::SystemMonitor::Get(); if (monitor) monitor->ProcessWmPowerBroadcastMessage(power_event); SetMsgHandled(FALSE); |