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

Side by Side Diff: chrome/test/base/interactive_test_utils_win.cc

Issue 184903003: Window ownership -> WindowTreeHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
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 "chrome/test/base/interactive_test_utils.h" 5 #include "chrome/test/base/interactive_test_utils.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace ui_test_utils { 22 namespace ui_test_utils {
23 23
24 void HideNativeWindow(gfx::NativeWindow window) { 24 void HideNativeWindow(gfx::NativeWindow window) {
25 #if defined(USE_AURA) 25 #if defined(USE_AURA)
26 if (chrome::GetHostDesktopTypeForNativeWindow(window) == 26 if (chrome::GetHostDesktopTypeForNativeWindow(window) ==
27 chrome::HOST_DESKTOP_TYPE_ASH) { 27 chrome::HOST_DESKTOP_TYPE_ASH) {
28 HideNativeWindowAura(window); 28 HideNativeWindowAura(window);
29 return; 29 return;
30 } 30 }
31 HWND hwnd = window->GetDispatcher()->host()->GetAcceleratedWidget(); 31 HWND hwnd = window->GetHost()->GetAcceleratedWidget();
32 #else 32 #else
33 HWND hwnd = window; 33 HWND hwnd = window;
34 #endif 34 #endif
35 ::ShowWindow(hwnd, SW_HIDE); 35 ::ShowWindow(hwnd, SW_HIDE);
36 } 36 }
37 37
38 bool ShowAndFocusNativeWindow(gfx::NativeWindow window) { 38 bool ShowAndFocusNativeWindow(gfx::NativeWindow window) {
39 #if defined(USE_AURA) 39 #if defined(USE_AURA)
40 if (chrome::GetHostDesktopTypeForNativeWindow(window) == 40 if (chrome::GetHostDesktopTypeForNativeWindow(window) ==
41 chrome::HOST_DESKTOP_TYPE_ASH) 41 chrome::HOST_DESKTOP_TYPE_ASH)
42 ShowAndFocusNativeWindowAura(window); 42 ShowAndFocusNativeWindowAura(window);
43 window->Show(); 43 window->Show();
44 // Always make sure the window hosting ash is visible and focused. 44 // Always make sure the window hosting ash is visible and focused.
45 HWND hwnd = window->GetDispatcher()->host()->GetAcceleratedWidget(); 45 HWND hwnd = window->GetHost()->GetAcceleratedWidget();
46 #else 46 #else
47 HWND hwnd = window; 47 HWND hwnd = window;
48 #endif 48 #endif
49 49
50 ::ShowWindow(hwnd, SW_SHOW); 50 ::ShowWindow(hwnd, SW_SHOW);
51 51
52 if (GetForegroundWindow() != hwnd) { 52 if (GetForegroundWindow() != hwnd) {
53 VLOG(1) << "Forcefully refocusing front window"; 53 VLOG(1) << "Forcefully refocusing front window";
54 ui::ForegroundHelper::SetForeground(hwnd); 54 ui::ForegroundHelper::SetForeground(hwnd);
55 } 55 }
56 56
57 // ShowWindow does not necessarily activate the window. In particular if a 57 // ShowWindow does not necessarily activate the window. In particular if a
58 // window from another app is the foreground window then the request to 58 // window from another app is the foreground window then the request to
59 // activate the window fails. See SetForegroundWindow for details. 59 // activate the window fails. See SetForegroundWindow for details.
60 return GetForegroundWindow() == hwnd; 60 return GetForegroundWindow() == hwnd;
61 } 61 }
62 62
63 } // namespace ui_test_utils 63 } // namespace ui_test_utils
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc ('k') | chrome/test/base/view_event_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698