Managed bookmarks for supervised users.
[chromium-blink-merge.git] / ash / test / test_metro_viewer_process_host.cc
blob04fbaa5dd7e1b7147d3d2fa5cac7eb4064cc7ae6
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 "base/process/process.h"
11 #include "ui/aura/remote_window_tree_host_win.h"
12 #include "ui/gfx/win/dpi.h"
14 namespace ash {
15 namespace test {
17 TestMetroViewerProcessHost::TestMetroViewerProcessHost(
18 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner)
19 : MetroViewerProcessHost(ipc_task_runner), closed_unexpectedly_(false) {
22 TestMetroViewerProcessHost::~TestMetroViewerProcessHost() {
25 void TestMetroViewerProcessHost::TerminateViewer() {
26 base::ProcessId viewer_process_id = GetViewerProcessId();
27 if (viewer_process_id != base::kNullProcessId) {
28 base::Process viewer_process = base::Process::OpenWithAccess(
29 viewer_process_id,
30 PROCESS_QUERY_INFORMATION | SYNCHRONIZE | PROCESS_TERMINATE);
31 if (viewer_process.IsValid()) {
32 viewer_process.Terminate(0);
33 int exit_code;
34 viewer_process.WaitForExit(&exit_code);
39 void TestMetroViewerProcessHost::OnChannelError() {
40 closed_unexpectedly_ = true;
41 aura::RemoteWindowTreeHostWin::Instance()->Disconnected();
44 void TestMetroViewerProcessHost::OnSetTargetSurface(
45 gfx::NativeViewId target_surface,
46 float device_scale) {
47 DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface;
48 HWND hwnd = reinterpret_cast<HWND>(target_surface);
49 gfx::InitDeviceScaleFactor(device_scale);
50 aura::RemoteWindowTreeHostWin::Instance()->SetRemoteWindowHandle(hwnd);
51 aura::RemoteWindowTreeHostWin::Instance()->Connected(this);
54 void TestMetroViewerProcessHost::OnOpenURL(const base::string16& url) {
57 void TestMetroViewerProcessHost::OnHandleSearchRequest(
58 const base::string16& search_string) {
61 void TestMetroViewerProcessHost::OnWindowSizeChanged(uint32 width,
62 uint32 height) {
65 } // namespace test
66 } // namespace ash