| 
									
										
										
										
											2013-08-03 15:58:59 +08:00
										 |  |  | // Copyright (c) 2013 GitHub, Inc. All rights reserved.
 | 
					
						
							|  |  |  | // Use of this source code is governed by a BSD-style license that can be
 | 
					
						
							|  |  |  | // found in the LICENSE file.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef ATOM_BROWSER_API_ATOM_API_POWER_MONITOR_H_
 | 
					
						
							|  |  |  | #define ATOM_BROWSER_API_ATOM_API_POWER_MONITOR_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "base/compiler_specific.h"
 | 
					
						
							|  |  |  | #include "base/power_monitor/power_observer.h"
 | 
					
						
							| 
									
										
										
										
											2014-03-16 08:30:26 +08:00
										 |  |  | #include "atom/common/api/atom_api_event_emitter.h"
 | 
					
						
							| 
									
										
										
										
											2013-08-03 15:58:59 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace atom { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace api { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class PowerMonitor : public EventEmitter, | 
					
						
							|  |  |  |                      public base::PowerObserver { | 
					
						
							|  |  |  |  public: | 
					
						
							|  |  |  |   virtual ~PowerMonitor(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   static void Initialize(v8::Handle<v8::Object> target); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  protected: | 
					
						
							|  |  |  |   explicit PowerMonitor(v8::Handle<v8::Object> wrapper); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   virtual void OnPowerStateChange(bool on_battery_power) OVERRIDE; | 
					
						
							|  |  |  |   virtual void OnSuspend() OVERRIDE; | 
					
						
							|  |  |  |   virtual void OnResume() OVERRIDE; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  private: | 
					
						
							| 
									
										
										
										
											2013-12-11 15:48:19 +08:00
										 |  |  |   static void New(const v8::FunctionCallbackInfo<v8::Value>& args); | 
					
						
							| 
									
										
										
										
											2013-08-03 15:58:59 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   DISALLOW_COPY_AND_ASSIGN(PowerMonitor); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }  // namespace api
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }  // namespace atom
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif  // ATOM_BROWSER_API_ATOM_API_POWER_MONITOR_H_
 |