forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmojo_test_interface_factory.cc
76 lines (63 loc) · 2.78 KB
/
mojo_test_interface_factory.cc
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
67
68
69
70
71
72
73
74
75
76
// Copyright 2017 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/mojo_test_interface_factory.h"
#include <utility>
#include "ash/metrics/time_to_first_present_recorder_test_api.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/interfaces/shelf_test_api.mojom.h"
#include "ash/public/interfaces/shell_test_api.mojom.h"
#include "ash/public/interfaces/status_area_widget_test_api.mojom.h"
#include "ash/public/interfaces/system_tray_test_api.mojom.h"
#include "ash/public/interfaces/time_to_first_present_recorder_test_api.mojom.h"
#include "ash/shelf/shelf_test_api.h"
#include "ash/shell_test_api.h"
#include "ash/system/status_area_widget_test_api.h"
#include "ash/system/tray/system_tray_test_api.h"
#include "ash/system/unified/unified_system_tray_test_api.h"
#include "base/bind.h"
#include "base/single_thread_task_runner.h"
namespace ash {
namespace mojo_test_interface_factory {
namespace {
// These functions aren't strictly necessary, but exist to make threading and
// arguments clearer.
void BindShelfTestApiOnMainThread(mojom::ShelfTestApiRequest request) {
ShelfTestApi::BindRequest(std::move(request));
}
void BindShellTestApiOnMainThread(mojom::ShellTestApiRequest request) {
ShellTestApi::BindRequest(std::move(request));
}
void BindStatusAreaWidgetTestApiOnMainThread(
mojom::StatusAreaWidgetTestApiRequest request) {
StatusAreaWidgetTestApi::BindRequest(std::move(request));
}
void BindSystemTrayTestApiOnMainThread(
mojom::SystemTrayTestApiRequest request) {
if (features::IsSystemTrayUnifiedEnabled())
UnifiedSystemTrayTestApi::BindRequest(std::move(request));
else
SystemTrayTestApi::BindRequest(std::move(request));
}
void BindTimeToFirstPresentRecorderTestApiOnMainThread(
mojom::TimeToFirstPresentRecorderTestApiRequest request) {
TimeToFirstPresentRecorderTestApi::BindRequest(std::move(request));
}
} // namespace
void RegisterInterfaces(
service_manager::BinderRegistry* registry,
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) {
registry->AddInterface(base::Bind(&BindShelfTestApiOnMainThread),
main_thread_task_runner);
registry->AddInterface(base::Bind(&BindShellTestApiOnMainThread),
main_thread_task_runner);
registry->AddInterface(base::Bind(&BindStatusAreaWidgetTestApiOnMainThread),
main_thread_task_runner);
registry->AddInterface(base::Bind(&BindSystemTrayTestApiOnMainThread),
main_thread_task_runner);
registry->AddInterface(
base::Bind(&BindTimeToFirstPresentRecorderTestApiOnMainThread),
main_thread_task_runner);
}
} // namespace mojo_test_interface_factory
} // namespace ash