Removed unused icon resources from app_list.
[chromium-blink-merge.git] / ui / gfx / win / singleton_hwnd.cc
blobfc4d11f2d5e0d8146d9a3fa5c0f666e2e3c86676
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
3 // found in the LICENSE file.
5 #include "ui/gfx/win/singleton_hwnd.h"
7 #include "base/memory/singleton.h"
8 #include "base/message_loop/message_loop.h"
10 namespace gfx {
12 // static
13 SingletonHwnd* SingletonHwnd::GetInstance() {
14 return Singleton<SingletonHwnd>::get();
17 void SingletonHwnd::AddObserver(Observer* observer) {
18 observer_list_.AddObserver(observer);
21 void SingletonHwnd::RemoveObserver(Observer* observer) {
22 if (!hwnd())
23 return;
24 observer_list_.RemoveObserver(observer);
27 BOOL SingletonHwnd::ProcessWindowMessage(HWND window,
28 UINT message,
29 WPARAM wparam,
30 LPARAM lparam,
31 LRESULT& result,
32 DWORD msg_map_id) {
33 FOR_EACH_OBSERVER(Observer,
34 observer_list_,
35 OnWndProc(window, message, wparam, lparam));
36 return false;
39 SingletonHwnd::SingletonHwnd() {
40 if (!base::MessageLoopForUI::IsCurrent()) {
41 // Creating this window in (e.g.) a renderer inhibits shutdown on
42 // Windows. See http://crbug.com/230122 and http://crbug.com/236039.
43 DLOG(ERROR) << "Cannot create windows on non-UI thread!";
44 return;
46 WindowImpl::Init(NULL, Rect());
49 SingletonHwnd::~SingletonHwnd() {
52 } // namespace gfx