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

Side by Side Diff: base/power_monitor/power_monitor_device_source_win.cc

Issue 141683005: Removes MessageLoop::Type checks in favor of IsCurrent on MessageLoops. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: base:: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/message_loop/message_loop.h ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/power_monitor/power_monitor.h" 5 #include "base/power_monitor/power_monitor.h"
6 #include "base/power_monitor/power_monitor_device_source.h" 6 #include "base/power_monitor/power_monitor_device_source.h"
7 #include "base/power_monitor/power_monitor_source.h" 7 #include "base/power_monitor/power_monitor_source.h"
8 #include "base/win/wrapped_window_proc.h" 8 #include "base/win/wrapped_window_proc.h"
9 9
10 namespace base { 10 namespace base {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 SYSTEM_POWER_STATUS status; 56 SYSTEM_POWER_STATUS status;
57 if (!GetSystemPowerStatus(&status)) { 57 if (!GetSystemPowerStatus(&status)) {
58 DLOG_GETLASTERROR(ERROR) << "GetSystemPowerStatus failed"; 58 DLOG_GETLASTERROR(ERROR) << "GetSystemPowerStatus failed";
59 return false; 59 return false;
60 } 60 }
61 return (status.ACLineStatus == 0); 61 return (status.ACLineStatus == 0);
62 } 62 }
63 63
64 PowerMonitorDeviceSource::PowerMessageWindow::PowerMessageWindow() 64 PowerMonitorDeviceSource::PowerMessageWindow::PowerMessageWindow()
65 : instance_(NULL), message_hwnd_(NULL) { 65 : instance_(NULL), message_hwnd_(NULL) {
66 if (MessageLoop::current()->type() != MessageLoop::TYPE_UI) { 66 if (!MessageLoopForUI::IsCurrent()) {
67 // Creating this window in (e.g.) a renderer inhibits shutdown on Windows. 67 // Creating this window in (e.g.) a renderer inhibits shutdown on Windows.
68 // See http://crbug.com/230122. TODO(vandebo): http://crbug.com/236031 68 // See http://crbug.com/230122. TODO(vandebo): http://crbug.com/236031
69 DLOG(ERROR) 69 DLOG(ERROR)
70 << "Cannot create windows on non-UI thread, power monitor disabled!"; 70 << "Cannot create windows on non-UI thread, power monitor disabled!";
71 return; 71 return;
72 } 72 }
73 WNDCLASSEX window_class; 73 WNDCLASSEX window_class;
74 base::win::InitializeWindowClass( 74 base::win::InitializeWindowClass(
75 kWindowClassName, 75 kWindowClassName,
76 &base::win::WrappedWindowProc< 76 &base::win::WrappedWindowProc<
(...skipping 24 matching lines...) Expand all
101 switch (message) { 101 switch (message) {
102 case WM_POWERBROADCAST: 102 case WM_POWERBROADCAST:
103 ProcessWmPowerBroadcastMessage(wparam); 103 ProcessWmPowerBroadcastMessage(wparam);
104 return TRUE; 104 return TRUE;
105 default: 105 default:
106 return ::DefWindowProc(hwnd, message, wparam, lparam); 106 return ::DefWindowProc(hwnd, message, wparam, lparam);
107 } 107 }
108 } 108 }
109 109
110 } // namespace base 110 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_loop.h ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698