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" |
| 8 #include "ash/magnifier/partial_magnification_controller.h" |
| 9 #include "ash/screenshot_delegate.h" |
| 10 #include "ash/shell.h" |
| 11 #include "ash/utility/screenshot_controller.h" |
7 #include "chrome/browser/chromeos/note_taking_app_utils.h" | 12 #include "chrome/browser/chromeos/note_taking_app_utils.h" |
8 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
9 | 14 |
10 namespace chromeos { | 15 namespace chromeos { |
11 namespace { | 16 namespace { |
12 | 17 |
13 Profile* GetProfile() { | 18 Profile* GetProfile() { |
14 return ProfileManager::GetActiveUserProfile(); | 19 return ProfileManager::GetActiveUserProfile(); |
15 } | 20 } |
16 | 21 |
17 } // namespace | 22 } // namespace |
18 | 23 |
19 PaletteDelegateChromeOS::PaletteDelegateChromeOS() {} | 24 PaletteDelegateChromeOS::PaletteDelegateChromeOS() {} |
20 | 25 |
21 PaletteDelegateChromeOS::~PaletteDelegateChromeOS() {} | 26 PaletteDelegateChromeOS::~PaletteDelegateChromeOS() {} |
22 | 27 |
23 void PaletteDelegateChromeOS::CreateNote() { | 28 void PaletteDelegateChromeOS::CreateNote() { |
24 chromeos::LaunchNoteTakingAppForNewNote(GetProfile(), base::FilePath()); | 29 chromeos::LaunchNoteTakingAppForNewNote(GetProfile(), base::FilePath()); |
25 } | 30 } |
26 | 31 |
27 bool PaletteDelegateChromeOS::HasNoteApp() { | 32 bool PaletteDelegateChromeOS::HasNoteApp() { |
28 return chromeos::IsNoteTakingAppAvailable(GetProfile()); | 33 return chromeos::IsNoteTakingAppAvailable(GetProfile()); |
29 } | 34 } |
30 | 35 |
| 36 void PaletteDelegateChromeOS::SetPartialMagnifierState(bool enabled) { |
| 37 ash::PartialMagnificationController* controller = |
| 38 ash::Shell::GetInstance()->partial_magnification_controller(); |
| 39 controller->SetEnabled(enabled); |
| 40 } |
| 41 |
| 42 void PaletteDelegateChromeOS::TakeScreenshot() { |
| 43 auto* screenshot_delegate = ash::Shell::GetInstance() |
| 44 ->accelerator_controller_delegate() |
| 45 ->screenshot_delegate(); |
| 46 screenshot_delegate->HandleTakeScreenshotForAllRootWindows(); |
| 47 } |
| 48 |
| 49 void PaletteDelegateChromeOS::TakePartialScreenshot() { |
| 50 auto* screenshot_controller = |
| 51 ash::Shell::GetInstance()->screenshot_controller(); |
| 52 auto* screenshot_delegate = ash::Shell::GetInstance() |
| 53 ->accelerator_controller_delegate() |
| 54 ->screenshot_delegate(); |
| 55 |
| 56 screenshot_controller->set_pen_events_only(true); |
| 57 screenshot_controller->StartPartialScreenshotSession( |
| 58 screenshot_delegate, false /* draw_overlay_immediately */); |
| 59 } |
| 60 |
31 } // namespace chromeos | 61 } // namespace chromeos |
OLD | NEW |