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

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

Issue 1159033008: Refactor ViewsDelegate singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Destroy ash ViewsDelegate Created 5 years, 6 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
« no previous file with comments | « ui/views/win/hwnd_message_handler.cc ('k') | ui/views/window/custom_frame_view.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 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
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
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
OLDNEW
« no previous file with comments | « ui/views/win/hwnd_message_handler.cc ('k') | ui/views/window/custom_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698