blob: cae229c04b376aa1f5e8cfcb99d8545eed4b080d [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
Scott Violet4c79b0d2017-11-17 21:47:135#include "ash/shell_delegate_mus.h"
jamescook33375732016-07-14 22:09:286
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 Cook5e9d3402017-11-01 00:20:1211#include "ash/screenshot_delegate.h"
jamescook33375732016-07-14 22:09:2812#include "base/strings/string16.h"
mswccb5d692016-08-17 20:37:4813#include "base/strings/string_util.h"
jamescook33375732016-07-14 22:09:2814#include "components/user_manager/user_info_impl.h"
James Cook5fbdccb2017-09-01 21:17:5515#include "services/ui/public/cpp/input_devices/input_device_controller_client.h"
jamescook33375732016-07-14 22:09:2816#include "ui/gfx/image/image.h"
yhanada8909a542017-07-11 10:06:1917#include "ui/keyboard/keyboard_ui.h"
Scott Violet17a61722017-06-19 17:54:3118
jamescook33375732016-07-14 22:09:2819namespace ash {
James Cook5e9d3402017-11-01 00:20:1220namespace {
21
22// TODO(jamescook): Replace with a mojo-compatible ScreenshotClient.
23class ScreenshotDelegateMash : public ScreenshotDelegate {
24 public:
25 ScreenshotDelegateMash() = default;
26 ~ScreenshotDelegateMash() override = default;
27
28 // ScreenshotDelegate:
29 void HandleTakeScreenshotForAllRootWindows() override { NOTIMPLEMENTED(); }
30 void HandleTakePartialScreenshot(aura::Window* window,
31 const gfx::Rect& rect) override {
32 NOTIMPLEMENTED();
33 }
34 void HandleTakeWindowScreenshot(aura::Window* window) override {
35 NOTIMPLEMENTED();
36 }
37 bool CanTakeScreenshot() override { return true; }
38
39 private:
40 DISALLOW_COPY_AND_ASSIGN(ScreenshotDelegateMash);
41};
42
43} // namespace
jamescook33375732016-07-14 22:09:2844
msw0bc6a072017-02-14 16:33:3845ShellDelegateMus::ShellDelegateMus(service_manager::Connector* connector)
46 : connector_(connector) {}
jamescook33375732016-07-14 22:09:2847
Chris Watkinsc24daf62017-11-28 03:43:0948ShellDelegateMus::~ShellDelegateMus() = default;
jamescook33375732016-07-14 22:09:2849
rockot400ea35b2016-10-15 19:15:3250service_manager::Connector* ShellDelegateMus::GetShellConnector() const {
jamescook2a6b8692016-10-04 02:41:2951 return connector_;
52}
53
jamescook33375732016-07-14 22:09:2854bool ShellDelegateMus::IsRunningInForcedAppMode() const {
Daniel Bratellff541192017-11-02 14:22:2855 NOTIMPLEMENTED_LOG_ONCE();
jamescook33375732016-07-14 22:09:2856 return false;
57}
58
varkhad43f55242017-05-26 20:55:5859bool ShellDelegateMus::CanShowWindowForUser(aura::Window* window) const {
Daniel Bratellff541192017-11-02 14:22:2860 NOTIMPLEMENTED_LOG_ONCE();
jamescook33375732016-07-14 22:09:2861 return true;
62}
63
jamescook33375732016-07-14 22:09:2864void ShellDelegateMus::PreInit() {
Daniel Bratellff541192017-11-02 14:22:2865 NOTIMPLEMENTED_LOG_ONCE();
jamescook33375732016-07-14 22:09:2866}
67
Steven Bennetts7614ab52018-01-12 20:48:1768void ShellDelegateMus::PreShutdown() {
69 NOTIMPLEMENTED_LOG_ONCE();
70}
71
yhanada8909a542017-07-11 10:06:1972std::unique_ptr<keyboard::KeyboardUI> ShellDelegateMus::CreateKeyboardUI() {
Daniel Bratellff541192017-11-02 14:22:2873 NOTIMPLEMENTED_LOG_ONCE();
jamescook33375732016-07-14 22:09:2874 return nullptr;
75}
76
kenobib7af62b2016-07-29 21:40:1677void ShellDelegateMus::OpenUrlFromArc(const GURL& url) {
Daniel Bratellff541192017-11-02 14:22:2878 NOTIMPLEMENTED_LOG_ONCE();
jamescook33375732016-07-14 22:09:2879}
80
James Cook8d5b29f2017-08-16 21:19:0681NetworkingConfigDelegate* ShellDelegateMus::GetNetworkingConfigDelegate() {
82 // TODO(mash): Provide a real implementation, perhaps by folding its behavior
83 // into an ash-side network information cache. http://crbug.com/651157
Daniel Bratellff541192017-11-02 14:22:2884 NOTIMPLEMENTED_LOG_ONCE();
James Cook8d5b29f2017-08-16 21:19:0685 return nullptr;
jamescook33375732016-07-14 22:09:2886}
87
James Cook5e9d3402017-11-01 00:20:1288std::unique_ptr<ScreenshotDelegate>
89ShellDelegateMus::CreateScreenshotDelegate() {
90 return std::make_unique<ScreenshotDelegateMash>();
91}
92
jamescook33375732016-07-14 22:09:2893AccessibilityDelegate* ShellDelegateMus::CreateAccessibilityDelegate() {
James Cook5fbdccb2017-09-01 21:17:5594 return new DefaultAccessibilityDelegate;
jamescook33375732016-07-14 22:09:2895}
96
Scott Violet17a61722017-06-19 17:54:3197ui::InputDeviceControllerClient*
98ShellDelegateMus::GetInputDeviceControllerClient() {
99 if (!connector_)
100 return nullptr; // Happens in tests.
101
102 if (!input_device_controller_client_) {
103 input_device_controller_client_ =
Mitsuru Oshima04b54d02017-10-09 14:22:45104 std::make_unique<ui::InputDeviceControllerClient>(connector_);
Scott Violet17a61722017-06-19 17:54:31105 }
106 return input_device_controller_client_.get();
107}
Scott Violet17a61722017-06-19 17:54:31108
jamescook33375732016-07-14 22:09:28109} // namespace ash