Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 10959020: SystemMonitor refactoring: move power state monitor into a separate class called PowerMonitor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: make HWNDMessageHandler as a friend class of PowerMonitor Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/system_monitor/system_monitor.h" 11 #include "base/power_monitor/power_monitor.h"
12 #include "base/win/windows_version.h" 12 #include "base/win/windows_version.h"
13 #include "ui/base/events/event.h" 13 #include "ui/base/events/event.h"
14 #include "ui/base/keycodes/keyboard_code_conversion_win.h" 14 #include "ui/base/keycodes/keyboard_code_conversion_win.h"
15 #include "ui/base/native_theme/native_theme_win.h" 15 #include "ui/base/native_theme/native_theme_win.h"
16 #include "ui/base/win/hwnd_util.h" 16 #include "ui/base/win/hwnd_util.h"
17 #include "ui/base/win/mouse_wheel_util.h" 17 #include "ui/base/win/mouse_wheel_util.h"
18 #include "ui/base/win/shell.h" 18 #include "ui/base/win/shell.h"
19 #include "ui/gfx/canvas.h" 19 #include "ui/gfx/canvas.h"
20 #include "ui/gfx/canvas_paint.h" 20 #include "ui/gfx/canvas_paint.h"
21 #include "ui/gfx/canvas_skia_paint.h" 21 #include "ui/gfx/canvas_skia_paint.h"
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 #endif 1844 #endif
1845 } 1845 }
1846 } else { 1846 } else {
1847 // TODO(msw): Find a better solution for this crbug.com/93530 workaround. 1847 // TODO(msw): Find a better solution for this crbug.com/93530 workaround.
1848 // Some scenarios otherwise fail to validate minimized app/popup windows. 1848 // Some scenarios otherwise fail to validate minimized app/popup windows.
1849 ValidateRect(hwnd(), NULL); 1849 ValidateRect(hwnd(), NULL);
1850 } 1850 }
1851 } 1851 }
1852 1852
1853 LRESULT HWNDMessageHandler::OnPowerBroadcast(DWORD power_event, DWORD data) { 1853 LRESULT HWNDMessageHandler::OnPowerBroadcast(DWORD power_event, DWORD data) {
1854 base::SystemMonitor* monitor = base::SystemMonitor::Get(); 1854 base::PowerMonitor* monitor = base::PowerMonitor::Get();
1855 if (monitor) 1855 if (monitor) {
1856 monitor->ProcessWmPowerBroadcastMessage(power_event); 1856 base::PowerMonitor::PowerEvent power_event;
vandebo (ex-Chrome) 2012/10/11 00:58:43 this variable shadows the function argument.
Hongbo Min 2012/10/11 07:57:53 Keep the original way by using ProcessWmPowerBroad
1857 switch (event_id) {
1858 case PBT_APMPOWERSTATUSCHANGE: // The power status changed.
1859 power_event = POWER_STATE_EVENT;
1860 break;
1861 case PBT_APMRESUMEAUTOMATIC: // Resume from suspend.
1862 //case PBT_APMRESUMESUSPEND: // User-initiated resume from suspend.
1863 // We don't notify for this latter event
1864 // because if it occurs it is always sent
1865 // as a second event after
1866 // PBT_APMRESUMEAUTOMATIC.
1867 power_event = RESUME_EVENT;
1868 break;
1869 case PBT_APMSUSPEND: // System has been suspended.
1870 power_event = SUSPEND_EVENT;
1871 break;
1872 default:
1873 return;
1874
1875 // Other Power Events:
1876 // PBT_APMBATTERYLOW - removed in Vista.
1877 // PBT_APMOEMEVENT - removed in Vista.
1878 // PBT_APMQUERYSUSPEND - removed in Vista.
1879 // PBT_APMQUERYSUSPENDFAILED - removed in Vista.
1880 // PBT_APMRESUMECRITICAL - removed in Vista.
1881 // PBT_POWERSETTINGCHANGE - user changed the power settings.
1882 }
1883 monitor->HandlePowerEvent(power_event);
1884 }
1857 SetMsgHandled(FALSE); 1885 SetMsgHandled(FALSE);
1858 return 0; 1886 return 0;
1859 } 1887 }
1860 1888
1861 LRESULT HWNDMessageHandler::OnReflectedMessage(UINT message, 1889 LRESULT HWNDMessageHandler::OnReflectedMessage(UINT message,
1862 WPARAM w_param, 1890 WPARAM w_param,
1863 LPARAM l_param) { 1891 LPARAM l_param) {
1864 SetMsgHandled(FALSE); 1892 SetMsgHandled(FALSE);
1865 return 0; 1893 return 0;
1866 } 1894 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 DwmExtendFrameIntoClientArea(hwnd(), &m); 2119 DwmExtendFrameIntoClientArea(hwnd(), &m);
2092 } 2120 }
2093 if (window_pos->flags & SWP_SHOWWINDOW) 2121 if (window_pos->flags & SWP_SHOWWINDOW)
2094 delegate_->HandleVisibilityChanged(true); 2122 delegate_->HandleVisibilityChanged(true);
2095 else if (window_pos->flags & SWP_HIDEWINDOW) 2123 else if (window_pos->flags & SWP_HIDEWINDOW)
2096 delegate_->HandleVisibilityChanged(false); 2124 delegate_->HandleVisibilityChanged(false);
2097 SetMsgHandled(FALSE); 2125 SetMsgHandled(FALSE);
2098 } 2126 }
2099 2127
2100 } // namespace views 2128 } // namespace views
OLDNEW
« chrome/browser/profiles/profile_manager_unittest.cc ('K') | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698