OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ash/test/test_metro_viewer_process_host.h" | 5 #include "ash/test/test_metro_viewer_process_host.h" |
6 | 6 |
7 #include <windef.h> | 7 #include <windef.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/aura/remote_window_tree_host_win.h" | 10 #include "ui/aura/remote_window_tree_host_win.h" |
11 #include "ui/gfx/win/dpi.h" | 11 #include "ui/gfx/win/dpi.h" |
12 | 12 |
13 namespace ash { | 13 namespace ash { |
14 namespace test { | 14 namespace test { |
15 | 15 |
16 TestMetroViewerProcessHost::TestMetroViewerProcessHost( | 16 TestMetroViewerProcessHost::TestMetroViewerProcessHost( |
17 base::SingleThreadTaskRunner* ipc_task_runner) | 17 base::SingleThreadTaskRunner* ipc_task_runner) |
18 : MetroViewerProcessHost(ipc_task_runner), | 18 : MetroViewerProcessHost(ipc_task_runner), |
19 closed_unexpectedly_(false) { | 19 closed_unexpectedly_(false) { |
20 } | 20 } |
21 | 21 |
22 TestMetroViewerProcessHost::~TestMetroViewerProcessHost() { | 22 TestMetroViewerProcessHost::~TestMetroViewerProcessHost() { |
23 } | 23 } |
24 | 24 |
25 void TestMetroViewerProcessHost::TerminateViewer() { | |
26 base::ProcessId viewer_process_id = GetViewerProcessId(); | |
27 if (viewer_process_id != base::kNullProcessId) { | |
28 base::ProcessHandle viewer_process = NULL; | |
29 base::OpenProcessHandleWithAccess( | |
30 viewer_process_id, | |
31 PROCESS_QUERY_INFORMATION | SYNCHRONIZE | PROCESS_TERMINATE, | |
32 &viewer_process); | |
33 if (viewer_process) { | |
34 ::TerminateProcess(viewer_process, 0); | |
35 ::CloseHandle(viewer_process); | |
ananta
2014/09/20 00:32:54
Please add a WaitForSingleObject here to ensure th
scottmg
2014/09/20 02:12:50
Thanks, done.
| |
36 } | |
37 } | |
38 } | |
39 | |
25 void TestMetroViewerProcessHost::OnChannelError() { | 40 void TestMetroViewerProcessHost::OnChannelError() { |
26 closed_unexpectedly_ = true; | 41 closed_unexpectedly_ = true; |
27 aura::RemoteWindowTreeHostWin::Instance()->Disconnected(); | 42 aura::RemoteWindowTreeHostWin::Instance()->Disconnected(); |
28 } | 43 } |
29 | 44 |
30 void TestMetroViewerProcessHost::OnSetTargetSurface( | 45 void TestMetroViewerProcessHost::OnSetTargetSurface( |
31 gfx::NativeViewId target_surface, | 46 gfx::NativeViewId target_surface, |
32 float device_scale) { | 47 float device_scale) { |
33 DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface; | 48 DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface; |
34 HWND hwnd = reinterpret_cast<HWND>(target_surface); | 49 HWND hwnd = reinterpret_cast<HWND>(target_surface); |
35 gfx::InitDeviceScaleFactor(device_scale); | 50 gfx::InitDeviceScaleFactor(device_scale); |
36 aura::RemoteWindowTreeHostWin::Instance()->SetRemoteWindowHandle(hwnd); | 51 aura::RemoteWindowTreeHostWin::Instance()->SetRemoteWindowHandle(hwnd); |
37 aura::RemoteWindowTreeHostWin::Instance()->Connected(this); | 52 aura::RemoteWindowTreeHostWin::Instance()->Connected(this); |
38 } | 53 } |
39 | 54 |
40 void TestMetroViewerProcessHost::OnOpenURL(const base::string16& url) { | 55 void TestMetroViewerProcessHost::OnOpenURL(const base::string16& url) { |
41 } | 56 } |
42 | 57 |
43 void TestMetroViewerProcessHost::OnHandleSearchRequest( | 58 void TestMetroViewerProcessHost::OnHandleSearchRequest( |
44 const base::string16& search_string) { | 59 const base::string16& search_string) { |
45 } | 60 } |
46 | 61 |
47 void TestMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, | 62 void TestMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, |
48 uint32 height) { | 63 uint32 height) { |
49 } | 64 } |
50 | 65 |
51 } // namespace test | 66 } // namespace test |
52 } // namespace ash | 67 } // namespace ash |
OLD | NEW |