OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/win/singleton_hwnd.h" | 5 #include "ui/base/win/singleton_hwnd.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 // static | 12 // static |
13 SingletonHwnd* SingletonHwnd::GetInstance() { | 13 SingletonHwnd* SingletonHwnd::GetInstance() { |
14 return Singleton<SingletonHwnd>::get(); | 14 return Singleton<SingletonHwnd>::get(); |
15 } | 15 } |
16 | 16 |
17 void SingletonHwnd::AddObserver(Observer* observer) { | 17 void SingletonHwnd::AddObserver(Observer* observer) { |
18 | 18 |
19 if (!hwnd()) { | 19 if (!hwnd()) { |
20 if (!MessageLoop::current() || | 20 if (!base::MessageLoop::current() || |
21 MessageLoop::current()->type() != MessageLoop::TYPE_UI) { | 21 base::MessageLoop::current()->type() != base::MessageLoop::TYPE_UI) { |
22 // Creating this window in (e.g.) a renderer inhibits shutdown on | 22 // Creating this window in (e.g.) a renderer inhibits shutdown on |
23 // Windows. See http://crbug.com/230122 and http://crbug.com/236039. | 23 // Windows. See http://crbug.com/230122 and http://crbug.com/236039. |
24 DLOG(ERROR) << "Cannot create windows on non-UI thread!"; | 24 DLOG(ERROR) << "Cannot create windows on non-UI thread!"; |
25 return; | 25 return; |
26 } | 26 } |
27 WindowImpl::Init(NULL, gfx::Rect()); | 27 WindowImpl::Init(NULL, gfx::Rect()); |
28 } | 28 } |
29 observer_list_.AddObserver(observer); | 29 observer_list_.AddObserver(observer); |
30 } | 30 } |
31 | 31 |
(...skipping 15 matching lines...) Expand all Loading... |
47 return false; | 47 return false; |
48 } | 48 } |
49 | 49 |
50 SingletonHwnd::SingletonHwnd() { | 50 SingletonHwnd::SingletonHwnd() { |
51 } | 51 } |
52 | 52 |
53 SingletonHwnd::~SingletonHwnd() { | 53 SingletonHwnd::~SingletonHwnd() { |
54 } | 54 } |
55 | 55 |
56 } // namespace ui | 56 } // namespace ui |
OLD | NEW |