OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/windows_session_change_observer.h" | 5 #include "ui/views/win/windows_session_change_observer.h" |
6 | 6 |
7 #include <wtsapi32.h> | 7 #include <wtsapi32.h> |
8 #pragma comment(lib, "wtsapi32.lib") | 8 #pragma comment(lib, "wtsapi32.lib") |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 break; | 60 break; |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 void AddSingletonHwndObserver() { | 64 void AddSingletonHwndObserver() { |
65 DCHECK(!singleton_hwnd_observer_); | 65 DCHECK(!singleton_hwnd_observer_); |
66 singleton_hwnd_observer_.reset(new gfx::SingletonHwndObserver( | 66 singleton_hwnd_observer_.reset(new gfx::SingletonHwndObserver( |
67 base::Bind(&WtsRegistrationNotificationManager::OnWndProc, | 67 base::Bind(&WtsRegistrationNotificationManager::OnWndProc, |
68 base::Unretained(this)))); | 68 base::Unretained(this)))); |
69 scoped_refptr<base::TaskRunner> task_runner; | 69 scoped_refptr<base::TaskRunner> task_runner; |
70 if (ViewsDelegate::views_delegate) { | 70 if (ViewsDelegate::GetInstance()) { |
71 task_runner = ViewsDelegate::views_delegate->GetBlockingPoolTaskRunner(); | 71 task_runner = ViewsDelegate::GetInstance()->GetBlockingPoolTaskRunner(); |
72 } | 72 } |
73 | 73 |
74 base::Closure wts_register = | 74 base::Closure wts_register = |
75 base::Bind(base::IgnoreResult(&WTSRegisterSessionNotification), | 75 base::Bind(base::IgnoreResult(&WTSRegisterSessionNotification), |
76 gfx::SingletonHwnd::GetInstance()->hwnd(), | 76 gfx::SingletonHwnd::GetInstance()->hwnd(), |
77 NOTIFY_FOR_THIS_SESSION); | 77 NOTIFY_FOR_THIS_SESSION); |
78 if (task_runner) { | 78 if (task_runner) { |
79 task_runner->PostTask(FROM_HERE, wts_register); | 79 task_runner->PostTask(FROM_HERE, wts_register); |
80 } else { | 80 } else { |
81 wts_register.Run(); | 81 wts_register.Run(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 121 } |
122 | 122 |
123 void WindowsSessionChangeObserver::ClearCallback() { | 123 void WindowsSessionChangeObserver::ClearCallback() { |
124 if (!callback_.is_null()) { | 124 if (!callback_.is_null()) { |
125 callback_.Reset(); | 125 callback_.Reset(); |
126 WtsRegistrationNotificationManager::GetInstance()->RemoveObserver(this); | 126 WtsRegistrationNotificationManager::GetInstance()->RemoveObserver(this); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 } // namespace views | 130 } // namespace views |
OLD | NEW |