blob: f0bba9b5f8a08778fca067849ab1b98291da6a54 [file] [log] [blame]
jamescook33375732016-07-14 22:09:281// Copyright 2016 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
5#include "ash/mus/shell_delegate_mus.h"
6
Mitsuru Oshima04b54d02017-10-09 14:22:457#include <memory>
jamescook33375732016-07-14 22:09:288#include <utility>
9
James Cook37b7d102017-10-06 04:35:1910#include "ash/accessibility/default_accessibility_delegate.h"
James Cookb0bf8e82017-04-09 17:01:4411#include "ash/gpu_support_stub.h"
msw7d03b2062016-09-10 00:13:2112#include "ash/mus/wallpaper_delegate_mus.h"
James Cook5e9d3402017-11-01 00:20:1213#include "ash/screenshot_delegate.h"
jamescook33375732016-07-14 22:09:2814#include "base/strings/string16.h"
mswccb5d692016-08-17 20:37:4815#include "base/strings/string_util.h"
jamescook33375732016-07-14 22:09:2816#include "components/user_manager/user_info_impl.h"
James Cook5fbdccb2017-09-01 21:17:5517#include "services/ui/public/cpp/input_devices/input_device_controller_client.h"
jamescook33375732016-07-14 22:09:2818#include "ui/gfx/image/image.h"
yhanada8909a542017-07-11 10:06:1919#include "ui/keyboard/keyboard_ui.h"
Scott Violet17a61722017-06-19 17:54:3120
jamescook33375732016-07-14 22:09:2821namespace ash {
James Cook5e9d3402017-11-01 00:20:1222namespace {
23
24// TODO(jamescook): Replace with a mojo-compatible ScreenshotClient.
25class ScreenshotDelegateMash : public ScreenshotDelegate {
26 public:
27 ScreenshotDelegateMash() = default;
28 ~ScreenshotDelegateMash() override = default;
29
30 // ScreenshotDelegate:
31 void HandleTakeScreenshotForAllRootWindows() override { NOTIMPLEMENTED(); }
32 void HandleTakePartialScreenshot(aura::Window* window,
33 const gfx::Rect& rect) override {
34 NOTIMPLEMENTED();
35 }
36 void HandleTakeWindowScreenshot(aura::Window* window) override {
37 NOTIMPLEMENTED();
38 }
39 bool CanTakeScreenshot() override { return true; }
40
41 private:
42 DISALLOW_COPY_AND_ASSIGN(ScreenshotDelegateMash);
43};
44
45} // namespace
jamescook33375732016-07-14 22:09:2846
msw0bc6a072017-02-14 16:33:3847ShellDelegateMus::ShellDelegateMus(service_manager::Connector* connector)
48 : connector_(connector) {}
jamescook33375732016-07-14 22:09:2849
50ShellDelegateMus::~ShellDelegateMus() {}
51
rockot400ea35b2016-10-15 19:15:3252service_manager::Connector* ShellDelegateMus::GetShellConnector() const {
jamescook2a6b8692016-10-04 02:41:2953 return connector_;
54}
55
jamescook33375732016-07-14 22:09:2856bool ShellDelegateMus::IsRunningInForcedAppMode() const {
57 NOTIMPLEMENTED();
58 return false;
59}
60
varkhad43f55242017-05-26 20:55:5861bool ShellDelegateMus::CanShowWindowForUser(aura::Window* window) const {
jamescook33375732016-07-14 22:09:2862 NOTIMPLEMENTED();
63 return true;
64}
65
66bool ShellDelegateMus::IsForceMaximizeOnFirstRun() const {
67 NOTIMPLEMENTED();
68 return false;
69}
70
71void ShellDelegateMus::PreInit() {
72 NOTIMPLEMENTED();
73}
74
75void ShellDelegateMus::PreShutdown() {
76 NOTIMPLEMENTED();
77}
78
yhanada8909a542017-07-11 10:06:1979std::unique_ptr<keyboard::KeyboardUI> ShellDelegateMus::CreateKeyboardUI() {
jamescook33375732016-07-14 22:09:2880 NOTIMPLEMENTED();
81 return nullptr;
82}
83
kenobib7af62b2016-07-29 21:40:1684void ShellDelegateMus::OpenUrlFromArc(const GURL& url) {
jamescook33375732016-07-14 22:09:2885 NOTIMPLEMENTED();
86}
87
James Cook8d5b29f2017-08-16 21:19:0688NetworkingConfigDelegate* ShellDelegateMus::GetNetworkingConfigDelegate() {
89 // TODO(mash): Provide a real implementation, perhaps by folding its behavior
90 // into an ash-side network information cache. http://crbug.com/651157
91 NOTIMPLEMENTED();
92 return nullptr;
jamescook33375732016-07-14 22:09:2893}
94
James Cook5e9d3402017-11-01 00:20:1295std::unique_ptr<ScreenshotDelegate>
96ShellDelegateMus::CreateScreenshotDelegate() {
97 return std::make_unique<ScreenshotDelegateMash>();
98}
99
msw0e91d932016-08-25 22:34:09100std::unique_ptr<WallpaperDelegate> ShellDelegateMus::CreateWallpaperDelegate() {
Mitsuru Oshima04b54d02017-10-09 14:22:45101 return std::make_unique<WallpaperDelegateMus>();
jamescook33375732016-07-14 22:09:28102}
103
jamescook33375732016-07-14 22:09:28104AccessibilityDelegate* ShellDelegateMus::CreateAccessibilityDelegate() {
James Cook5fbdccb2017-09-01 21:17:55105 return new DefaultAccessibilityDelegate;
jamescook33375732016-07-14 22:09:28106}
107
jamescook33375732016-07-14 22:09:28108GPUSupport* ShellDelegateMus::CreateGPUSupport() {
sky1eb7caa2016-09-16 00:02:46109 // TODO: http://crbug.com/647421.
jamescook33375732016-07-14 22:09:28110 NOTIMPLEMENTED() << " Using a stub GPUSupport implementation";
111 return new GPUSupportStub();
112}
113
114base::string16 ShellDelegateMus::GetProductName() const {
115 NOTIMPLEMENTED();
116 return base::string16();
117}
118
119gfx::Image ShellDelegateMus::GetDeprecatedAcceleratorImage() const {
120 NOTIMPLEMENTED();
121 return gfx::Image();
122}
123
Scott Violet17a61722017-06-19 17:54:31124ui::InputDeviceControllerClient*
125ShellDelegateMus::GetInputDeviceControllerClient() {
126 if (!connector_)
127 return nullptr; // Happens in tests.
128
129 if (!input_device_controller_client_) {
130 input_device_controller_client_ =
Mitsuru Oshima04b54d02017-10-09 14:22:45131 std::make_unique<ui::InputDeviceControllerClient>(connector_);
Scott Violet17a61722017-06-19 17:54:31132 }
133 return input_device_controller_client_.get();
134}
Scott Violet17a61722017-06-19 17:54:31135
jamescook33375732016-07-14 22:09:28136} // namespace ash