jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 1 | // 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 Violet | 4c79b0d | 2017-11-17 21:47:13 | [diff] [blame] | 5 | #include "ash/shell_delegate_mus.h" |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 6 | |
Mitsuru Oshima | 04b54d0 | 2017-10-09 14:22:45 | [diff] [blame] | 7 | #include <memory> |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 8 | #include <utility> |
| 9 | |
James Cook | 37b7d10 | 2017-10-06 04:35:19 | [diff] [blame] | 10 | #include "ash/accessibility/default_accessibility_delegate.h" |
James Cook | 5e9d340 | 2017-11-01 00:20:12 | [diff] [blame] | 11 | #include "ash/screenshot_delegate.h" |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 12 | #include "base/strings/string16.h" |
msw | ccb5d69 | 2016-08-17 20:37:48 | [diff] [blame] | 13 | #include "base/strings/string_util.h" |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 14 | #include "components/user_manager/user_info_impl.h" |
James Cook | 5fbdccb | 2017-09-01 21:17:55 | [diff] [blame] | 15 | #include "services/ui/public/cpp/input_devices/input_device_controller_client.h" |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 16 | #include "ui/gfx/image/image.h" |
yhanada | 8909a54 | 2017-07-11 10:06:19 | [diff] [blame] | 17 | #include "ui/keyboard/keyboard_ui.h" |
Scott Violet | 17a6172 | 2017-06-19 17:54:31 | [diff] [blame] | 18 | |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 19 | namespace ash { |
James Cook | 5e9d340 | 2017-11-01 00:20:12 | [diff] [blame] | 20 | namespace { |
| 21 | |
| 22 | // TODO(jamescook): Replace with a mojo-compatible ScreenshotClient. |
| 23 | class 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 |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 44 | |
msw | 0bc6a07 | 2017-02-14 16:33:38 | [diff] [blame] | 45 | ShellDelegateMus::ShellDelegateMus(service_manager::Connector* connector) |
| 46 | : connector_(connector) {} |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 47 | |
Chris Watkins | c24daf6 | 2017-11-28 03:43:09 | [diff] [blame] | 48 | ShellDelegateMus::~ShellDelegateMus() = default; |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 49 | |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 50 | service_manager::Connector* ShellDelegateMus::GetShellConnector() const { |
jamescook | 2a6b869 | 2016-10-04 02:41:29 | [diff] [blame] | 51 | return connector_; |
| 52 | } |
| 53 | |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 54 | bool ShellDelegateMus::IsRunningInForcedAppMode() const { |
Daniel Bratell | ff54119 | 2017-11-02 14:22:28 | [diff] [blame] | 55 | NOTIMPLEMENTED_LOG_ONCE(); |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 56 | return false; |
| 57 | } |
| 58 | |
varkha | d43f5524 | 2017-05-26 20:55:58 | [diff] [blame] | 59 | bool ShellDelegateMus::CanShowWindowForUser(aura::Window* window) const { |
Daniel Bratell | ff54119 | 2017-11-02 14:22:28 | [diff] [blame] | 60 | NOTIMPLEMENTED_LOG_ONCE(); |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 61 | return true; |
| 62 | } |
| 63 | |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 64 | void ShellDelegateMus::PreInit() { |
Daniel Bratell | ff54119 | 2017-11-02 14:22:28 | [diff] [blame] | 65 | NOTIMPLEMENTED_LOG_ONCE(); |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 66 | } |
| 67 | |
Steven Bennetts | 7614ab5 | 2018-01-12 20:48:17 | [diff] [blame] | 68 | void ShellDelegateMus::PreShutdown() { |
| 69 | NOTIMPLEMENTED_LOG_ONCE(); |
| 70 | } |
| 71 | |
yhanada | 8909a54 | 2017-07-11 10:06:19 | [diff] [blame] | 72 | std::unique_ptr<keyboard::KeyboardUI> ShellDelegateMus::CreateKeyboardUI() { |
Daniel Bratell | ff54119 | 2017-11-02 14:22:28 | [diff] [blame] | 73 | NOTIMPLEMENTED_LOG_ONCE(); |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 74 | return nullptr; |
| 75 | } |
| 76 | |
kenobi | b7af62b | 2016-07-29 21:40:16 | [diff] [blame] | 77 | void ShellDelegateMus::OpenUrlFromArc(const GURL& url) { |
Daniel Bratell | ff54119 | 2017-11-02 14:22:28 | [diff] [blame] | 78 | NOTIMPLEMENTED_LOG_ONCE(); |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 79 | } |
| 80 | |
James Cook | 8d5b29f | 2017-08-16 21:19:06 | [diff] [blame] | 81 | NetworkingConfigDelegate* 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 Bratell | ff54119 | 2017-11-02 14:22:28 | [diff] [blame] | 84 | NOTIMPLEMENTED_LOG_ONCE(); |
James Cook | 8d5b29f | 2017-08-16 21:19:06 | [diff] [blame] | 85 | return nullptr; |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 86 | } |
| 87 | |
James Cook | 5e9d340 | 2017-11-01 00:20:12 | [diff] [blame] | 88 | std::unique_ptr<ScreenshotDelegate> |
| 89 | ShellDelegateMus::CreateScreenshotDelegate() { |
| 90 | return std::make_unique<ScreenshotDelegateMash>(); |
| 91 | } |
| 92 | |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 93 | AccessibilityDelegate* ShellDelegateMus::CreateAccessibilityDelegate() { |
James Cook | 5fbdccb | 2017-09-01 21:17:55 | [diff] [blame] | 94 | return new DefaultAccessibilityDelegate; |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 95 | } |
| 96 | |
Scott Violet | 17a6172 | 2017-06-19 17:54:31 | [diff] [blame] | 97 | ui::InputDeviceControllerClient* |
| 98 | ShellDelegateMus::GetInputDeviceControllerClient() { |
| 99 | if (!connector_) |
| 100 | return nullptr; // Happens in tests. |
| 101 | |
| 102 | if (!input_device_controller_client_) { |
| 103 | input_device_controller_client_ = |
Mitsuru Oshima | 04b54d0 | 2017-10-09 14:22:45 | [diff] [blame] | 104 | std::make_unique<ui::InputDeviceControllerClient>(connector_); |
Scott Violet | 17a6172 | 2017-06-19 17:54:31 | [diff] [blame] | 105 | } |
| 106 | return input_device_controller_client_.get(); |
| 107 | } |
Scott Violet | 17a6172 | 2017-06-19 17:54:31 | [diff] [blame] | 108 | |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 109 | } // namespace ash |