OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/cros/screen_lock_library.h" | 5 #include "chrome/browser/chromeos/cros/screen_lock_library.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 virtual ~ScreenLockLibraryImpl() { | 22 virtual ~ScreenLockLibraryImpl() { |
23 if (screen_lock_connection_) { | 23 if (screen_lock_connection_) { |
24 chromeos::DisconnectScreenLock(screen_lock_connection_); | 24 chromeos::DisconnectScreenLock(screen_lock_connection_); |
25 screen_lock_connection_ = NULL; | 25 screen_lock_connection_ = NULL; |
26 } | 26 } |
27 } | 27 } |
28 | 28 |
29 // Begin ScreenLockLibrary implementation. | 29 // Begin ScreenLockLibrary implementation. |
30 virtual void Init() OVERRIDE { | 30 virtual void Init() OVERRIDE { |
31 if (CrosLibrary::Get()->EnsureLoaded()) { | 31 DCHECK(CrosLibrary::Get()->libcros_loaded()); |
32 screen_lock_connection_ = | 32 screen_lock_connection_ = |
33 chromeos::MonitorScreenLock(&ScreenLockedHandler, this); | 33 chromeos::MonitorScreenLock(&ScreenLockedHandler, this); |
34 } | |
35 } | 34 } |
36 | 35 |
37 virtual void AddObserver(Observer* observer) OVERRIDE { | 36 virtual void AddObserver(Observer* observer) OVERRIDE { |
38 observers_.AddObserver(observer); | 37 observers_.AddObserver(observer); |
39 } | 38 } |
40 | 39 |
41 virtual void RemoveObserver(Observer* observer) OVERRIDE { | 40 virtual void RemoveObserver(Observer* observer) OVERRIDE { |
42 observers_.RemoveObserver(observer); | 41 observers_.RemoveObserver(observer); |
43 } | 42 } |
44 | 43 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 impl = new ScreenLockLibraryImpl(); | 139 impl = new ScreenLockLibraryImpl(); |
141 impl->Init(); | 140 impl->Init(); |
142 return impl; | 141 return impl; |
143 } | 142 } |
144 | 143 |
145 } // namespace chromeos | 144 } // namespace chromeos |
146 | 145 |
147 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 146 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
148 // won't be deleted until it's last InvokeLater is run. | 147 // won't be deleted until it's last InvokeLater is run. |
149 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::ScreenLockLibraryImpl); | 148 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::ScreenLockLibraryImpl); |
OLD | NEW |