| 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 #ifndef UI_BASE_WIN_FOREGROUND_HELPER_H_ | 5 #ifndef UI_BASE_WIN_FOREGROUND_HELPER_H_ |
| 6 #define UI_BASE_WIN_FOREGROUND_HELPER_H_ | 6 #define UI_BASE_WIN_FOREGROUND_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/base/win/window_impl.h" | 9 #include "ui/gfx/win/window_impl.h" |
| 10 | 10 |
| 11 namespace ui { | 11 namespace ui { |
| 12 | 12 |
| 13 // Helper class for moving a window to the foreground. | 13 // Helper class for moving a window to the foreground. |
| 14 // Windows XP and later will not allow a window which is in the background to | 14 // Windows XP and later will not allow a window which is in the background to |
| 15 // move to the foreground, unless requested by the current window in the | 15 // move to the foreground, unless requested by the current window in the |
| 16 // foreground. For automated testing, we really want some of our windows | 16 // foreground. For automated testing, we really want some of our windows |
| 17 // to be capable of moving to the foreground. | 17 // to be capable of moving to the foreground. |
| 18 // | 18 // |
| 19 // This is probably leveraging a windows bug. | 19 // This is probably leveraging a windows bug. |
| 20 class UI_EXPORT ForegroundHelper : public WindowImpl { | 20 class UI_EXPORT ForegroundHelper : public gfx::WindowImpl { |
| 21 public: | 21 public: |
| 22 ForegroundHelper() : window_(NULL) { } | 22 ForegroundHelper() : window_(NULL) { } |
| 23 | 23 |
| 24 BEGIN_MSG_MAP_EX(ForegroundHelper) | 24 BEGIN_MSG_MAP_EX(ForegroundHelper) |
| 25 MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) | 25 MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) |
| 26 END_MSG_MAP() | 26 END_MSG_MAP() |
| 27 | 27 |
| 28 // Brings a window into the foreground. | 28 // Brings a window into the foreground. |
| 29 // Can be called from any window, even if the caller is not the | 29 // Can be called from any window, even if the caller is not the |
| 30 // foreground window. | 30 // foreground window. |
| 31 static HRESULT SetForeground(HWND window); | 31 static HRESULT SetForeground(HWND window); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 HRESULT ForegroundHotKey(HWND window); | 34 HRESULT ForegroundHotKey(HWND window); |
| 35 | 35 |
| 36 // Handle the registered Hotkey being pressed. | 36 // Handle the registered Hotkey being pressed. |
| 37 LRESULT OnHotKey(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled); | 37 LRESULT OnHotKey(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled); |
| 38 | 38 |
| 39 HWND window_; | 39 HWND window_; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(ForegroundHelper); | 41 DISALLOW_COPY_AND_ASSIGN(ForegroundHelper); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 } // namespace ui | 44 } // namespace ui |
| 45 | 45 |
| 46 #endif // UI_BASE_WIN_FOREGROUND_HELPER_H_ | 46 #endif // UI_BASE_WIN_FOREGROUND_HELPER_H_ |
| OLD | NEW |