blob: c680e456a790c0c2f898d89286c84d8a6a971ab0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/test/test_metro_viewer_process_host.h"
#include <windef.h>
#include "base/logging.h"
#include "base/process/process.h"
#include "ui/aura/remote_window_tree_host_win.h"
#include "ui/gfx/win/dpi.h"
namespace ash {
namespace test {
TestMetroViewerProcessHost::TestMetroViewerProcessHost(
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner)
: MetroViewerProcessHost(ipc_task_runner), closed_unexpectedly_(false) {
}
TestMetroViewerProcessHost::~TestMetroViewerProcessHost() {
}
void TestMetroViewerProcessHost::TerminateViewer() {
base::ProcessId viewer_process_id = GetViewerProcessId();
if (viewer_process_id != base::kNullProcessId) {
base::Process viewer_process = base::Process::OpenWithAccess(
viewer_process_id,
PROCESS_QUERY_INFORMATION | SYNCHRONIZE | PROCESS_TERMINATE);
if (viewer_process.IsValid()) {
viewer_process.Terminate(0, false);
int exit_code;
viewer_process.WaitForExit(&exit_code);
}
}
}
void TestMetroViewerProcessHost::OnChannelError() {
closed_unexpectedly_ = true;
aura::RemoteWindowTreeHostWin::Instance()->Disconnected();
}
void TestMetroViewerProcessHost::OnSetTargetSurface(
gfx::NativeViewId target_surface,
float device_scale) {
DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface;
HWND hwnd = reinterpret_cast<HWND>(target_surface);
gfx::InitDeviceScaleFactor(device_scale);
aura::RemoteWindowTreeHostWin::Instance()->SetRemoteWindowHandle(hwnd);
aura::RemoteWindowTreeHostWin::Instance()->Connected(this);
}
void TestMetroViewerProcessHost::OnOpenURL(const base::string16& url) {
}
void TestMetroViewerProcessHost::OnHandleSearchRequest(
const base::string16& search_string) {
}
void TestMetroViewerProcessHost::OnWindowSizeChanged(uint32 width,
uint32 height) {
}
} // namespace test
} // namespace ash
|