OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/ash/palette_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/palette_delegate_chromeos.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
8 #include "ash/aura/shell_port_classic.h" | 8 #include "ash/aura/shell_port_classic.h" |
9 #include "ash/screenshot_delegate.h" | 9 #include "ash/screenshot_delegate.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/system/palette/palette_utils.h" | 11 #include "ash/system/palette/palette_utils.h" |
12 #include "ash/utility/screenshot_controller.h" | 12 #include "ash/utility/screenshot_controller.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/chromeos/arc/arc_util.h" | 15 #include "chrome/browser/chromeos/arc/arc_util.h" |
16 #include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_fr
amework_service.h" | 16 #include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_fr
amework_service.h" |
17 #include "chrome/browser/chromeos/note_taking_helper.h" | 17 #include "chrome/browser/chromeos/note_taking_helper.h" |
18 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
22 #include "components/arc/arc_bridge_service.h" | 22 #include "components/arc/arc_bridge_service.h" |
23 #include "components/arc/arc_service_manager.h" | 23 #include "components/arc/arc_service_manager.h" |
24 #include "components/arc/common/voice_interaction_framework.mojom.h" | |
25 #include "components/prefs/pref_change_registrar.h" | 24 #include "components/prefs/pref_change_registrar.h" |
26 #include "components/prefs/pref_service.h" | 25 #include "components/prefs/pref_service.h" |
27 #include "components/user_manager/user_manager.h" | 26 #include "components/user_manager/user_manager.h" |
28 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/notification_source.h" | 28 #include "content/public/browser/notification_source.h" |
30 | 29 |
31 namespace chromeos { | 30 namespace chromeos { |
32 | 31 |
33 class VoiceInteractionScreenshotDelegate : public ash::ScreenshotDelegate { | 32 class VoiceInteractionScreenshotDelegate : public ash::ScreenshotDelegate { |
34 public: | 33 public: |
35 VoiceInteractionScreenshotDelegate() {} | 34 VoiceInteractionScreenshotDelegate() {} |
36 ~VoiceInteractionScreenshotDelegate() override {} | 35 ~VoiceInteractionScreenshotDelegate() override {} |
37 | 36 |
38 private: | 37 private: |
39 void HandleTakeScreenshotForAllRootWindows() override { NOTIMPLEMENTED(); } | 38 void HandleTakeScreenshotForAllRootWindows() override { NOTIMPLEMENTED(); } |
40 | 39 |
41 void HandleTakePartialScreenshot(aura::Window* window, | 40 void HandleTakePartialScreenshot(aura::Window* window, |
42 const gfx::Rect& rect) override { | 41 const gfx::Rect& rect) override { |
43 arc::mojom::VoiceInteractionFrameworkInstance* framework = | 42 auto* framework = |
44 ARC_GET_INSTANCE_FOR_METHOD(arc::ArcServiceManager::Get() | 43 arc::ArcServiceManager::Get() |
45 ->arc_bridge_service() | 44 ->GetService<arc::ArcVoiceInteractionFrameworkService>(); |
46 ->voice_interaction_framework(), | |
47 StartVoiceInteractionSessionForRegion); | |
48 if (!framework) | 45 if (!framework) |
49 return; | 46 return; |
50 double device_scale_factor = window->layer()->device_scale_factor(); | 47 double device_scale_factor = window->layer()->device_scale_factor(); |
51 framework->StartVoiceInteractionSessionForRegion( | 48 framework->StartSessionFromUserInteraction( |
52 gfx::ScaleToEnclosingRect(rect, device_scale_factor)); | 49 gfx::ScaleToEnclosingRect(rect, device_scale_factor)); |
53 } | 50 } |
54 | 51 |
55 void HandleTakeWindowScreenshot(aura::Window* window) override { | 52 void HandleTakeWindowScreenshot(aura::Window* window) override { |
56 NOTIMPLEMENTED(); | 53 NOTIMPLEMENTED(); |
57 } | 54 } |
58 | 55 |
59 bool CanTakeScreenshot() override { return true; } | 56 bool CanTakeScreenshot() override { return true; } |
60 | 57 |
61 DISALLOW_COPY_AND_ASSIGN(VoiceInteractionScreenshotDelegate); | 58 DISALLOW_COPY_AND_ASSIGN(VoiceInteractionScreenshotDelegate); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 void PaletteDelegateChromeOS::HideMetalayer() { | 227 void PaletteDelegateChromeOS::HideMetalayer() { |
231 arc::ArcVoiceInteractionFrameworkService* service = | 228 arc::ArcVoiceInteractionFrameworkService* service = |
232 arc::ArcServiceManager::Get() | 229 arc::ArcServiceManager::Get() |
233 ->GetService<arc::ArcVoiceInteractionFrameworkService>(); | 230 ->GetService<arc::ArcVoiceInteractionFrameworkService>(); |
234 if (!service) | 231 if (!service) |
235 return; | 232 return; |
236 service->HideMetalayer(); | 233 service->HideMetalayer(); |
237 } | 234 } |
238 | 235 |
239 } // namespace chromeos | 236 } // namespace chromeos |
OLD | NEW |