blob: f7a0ccf09568dd3e526eb384b843f78ea933f87a [file] [log] [blame]
[email protected]0c68e892012-12-08 16:54:531// Copyright (c) 2012 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.
4
James Cook346c8c62017-07-18 19:38:375#include "ash/shell_test_api.h"
sky5ad143a2017-03-22 04:31:236
xiyuan317fdbe2017-05-31 15:02:027#include <utility>
8
[email protected]0c68e892012-12-08 16:54:539#include "ash/root_window_controller.h"
10#include "ash/shell.h"
Toni Barzic9d0c82f42017-12-06 00:53:5211#include "ash/system/power/backlights_forced_off_setter.h"
Qiang Xu0a86020f2017-10-12 08:34:5412#include "ash/system/power/power_button_controller.h"
Evan Staded689b332018-08-02 01:17:2213#include "ash/wm/tablet_mode/tablet_mode_controller.h"
James Cookbbe5cb12017-08-08 18:32:2114#include "components/prefs/testing_pref_service.h"
James Cook00848f02018-01-05 18:02:5715#include "mojo/public/cpp/bindings/strong_binding.h"
[email protected]0c68e892012-12-08 16:54:5316
17namespace ash {
[email protected]0c68e892012-12-08 16:54:5318
skycb4be5b2017-04-06 17:52:4519ShellTestApi::ShellTestApi() : ShellTestApi(Shell::Get()) {}
sky07a24d42017-03-09 23:57:3020
[email protected]0c68e892012-12-08 16:54:5321ShellTestApi::ShellTestApi(Shell* shell) : shell_(shell) {}
22
James Cook00848f02018-01-05 18:02:5723// static
24void ShellTestApi::BindRequest(mojom::ShellTestApiRequest request) {
25 mojo::MakeStrongBinding(std::make_unique<ShellTestApi>(), std::move(request));
26}
27
James Cook459354b32017-09-27 23:18:0128MessageCenterController* ShellTestApi::message_center_controller() {
29 return shell_->message_center_controller_.get();
30}
31
[email protected]093b8d642014-04-03 20:59:2832SystemGestureEventFilter* ShellTestApi::system_gesture_event_filter() {
[email protected]0c68e892012-12-08 16:54:5333 return shell_->system_gesture_filter_.get();
34}
35
[email protected]093b8d642014-04-03 20:59:2836WorkspaceController* ShellTestApi::workspace_controller() {
[email protected]0c68e892012-12-08 16:54:5337 return shell_->GetPrimaryRootWindowController()->workspace_controller();
38}
39
[email protected]093b8d642014-04-03 20:59:2840ScreenPositionController* ShellTestApi::screen_position_controller() {
[email protected]0c68e892012-12-08 16:54:5341 return shell_->screen_position_controller_.get();
42}
43
erg36cfb952017-06-21 19:41:4544NativeCursorManagerAsh* ShellTestApi::native_cursor_manager_ash() {
[email protected]c0ff0342013-02-27 00:41:2945 return shell_->native_cursor_manager_;
46}
47
[email protected]093b8d642014-04-03 20:59:2848DragDropController* ShellTestApi::drag_drop_controller() {
[email protected]c086bab2013-06-06 21:46:4449 return shell_->drag_drop_controller_.get();
50}
51
Qiang Xu36234e532018-04-11 04:54:0252PowerPrefs* ShellTestApi::power_prefs() {
53 return shell_->power_prefs_.get();
54}
55
James Cookbbe5cb12017-08-08 18:32:2156void ShellTestApi::OnLocalStatePrefServiceInitialized(
57 std::unique_ptr<PrefService> pref_service) {
58 shell_->OnLocalStatePrefServiceInitialized(std::move(pref_service));
59}
60
Qiang Xu50c6f8c2017-08-31 20:55:2461void ShellTestApi::ResetPowerButtonControllerForTest() {
Toni Barzic9d0c82f42017-12-06 00:53:5262 shell_->backlights_forced_off_setter_->ResetForTest();
63 shell_->power_button_controller_ = std::make_unique<PowerButtonController>(
64 shell_->backlights_forced_off_setter_.get());
Qiang Xu50c6f8c2017-08-31 20:55:2465}
66
James Cook7b7c6a52018-01-04 23:40:0367void ShellTestApi::SimulateModalWindowOpenForTest(bool modal_window_open) {
68 shell_->simulate_modal_window_open_for_test_ = modal_window_open;
69}
70
James Cook00848f02018-01-05 18:02:5771void ShellTestApi::IsSystemModalWindowOpen(IsSystemModalWindowOpenCallback cb) {
72 std::move(cb).Run(Shell::IsSystemModalWindowOpen());
73}
74
Evan Staded689b332018-08-02 01:17:2275void ShellTestApi::EnableTabletModeWindowManager(bool enable) {
76 shell_->tablet_mode_controller()->EnableTabletModeWindowManager(enable);
77}
78
[email protected]0c68e892012-12-08 16:54:5379} // namespace ash