Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / ash / test / test_metro_viewer_process_host.cc
blob00c00d257c18bb4af126c45ec7618befe7143228
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
3 // found in the LICENSE file.
5 #include "ash/test/test_metro_viewer_process_host.h"
7 #include <windef.h>
9 #include "base/logging.h"
10 #include "ui/aura/remote_window_tree_host_win.h"
11 #include "ui/gfx/win/dpi.h"
13 namespace ash {
14 namespace test {
16 TestMetroViewerProcessHost::TestMetroViewerProcessHost(
17 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner)
18 : MetroViewerProcessHost(ipc_task_runner), closed_unexpectedly_(false) {
21 TestMetroViewerProcessHost::~TestMetroViewerProcessHost() {
24 void TestMetroViewerProcessHost::TerminateViewer() {
25 base::ProcessId viewer_process_id = GetViewerProcessId();
26 if (viewer_process_id != base::kNullProcessId) {
27 base::ProcessHandle viewer_process = NULL;
28 base::OpenProcessHandleWithAccess(
29 viewer_process_id,
30 PROCESS_QUERY_INFORMATION | SYNCHRONIZE | PROCESS_TERMINATE,
31 &viewer_process);
32 if (viewer_process) {
33 ::TerminateProcess(viewer_process, 0);
34 ::WaitForSingleObject(viewer_process, INFINITE);
35 ::CloseHandle(viewer_process);
40 void TestMetroViewerProcessHost::OnChannelError() {
41 closed_unexpectedly_ = true;
42 aura::RemoteWindowTreeHostWin::Instance()->Disconnected();
45 void TestMetroViewerProcessHost::OnSetTargetSurface(
46 gfx::NativeViewId target_surface,
47 float device_scale) {
48 DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface;
49 HWND hwnd = reinterpret_cast<HWND>(target_surface);
50 gfx::InitDeviceScaleFactor(device_scale);
51 aura::RemoteWindowTreeHostWin::Instance()->SetRemoteWindowHandle(hwnd);
52 aura::RemoteWindowTreeHostWin::Instance()->Connected(this);
55 void TestMetroViewerProcessHost::OnOpenURL(const base::string16& url) {
58 void TestMetroViewerProcessHost::OnHandleSearchRequest(
59 const base::string16& search_string) {
62 void TestMetroViewerProcessHost::OnWindowSizeChanged(uint32 width,
63 uint32 height) {
66 } // namespace test
67 } // namespace ash