Index: chrome/browser/ui/ash/palette_delegate_chromeos.cc |
diff --git a/chrome/browser/ui/ash/palette_delegate_chromeos.cc b/chrome/browser/ui/ash/palette_delegate_chromeos.cc |
index ec2defa2b0379677466d5c8050a0e27dfde46082..6bc49908f8b0851d779590bbe12861f1806b216b 100644 |
--- a/chrome/browser/ui/ash/palette_delegate_chromeos.cc |
+++ b/chrome/browser/ui/ash/palette_delegate_chromeos.cc |
@@ -11,6 +11,9 @@ |
#include "ash/utility/screenshot_controller.h" |
#include "chrome/browser/chromeos/note_taking_app_utils.h" |
#include "chrome/browser/profiles/profile_manager.h" |
+#include "chrome/common/pref_names.h" |
+#include "components/prefs/pref_service.h" |
+#include "ui/events/devices/input_device_manager.h" |
namespace chromeos { |
namespace { |
@@ -21,9 +24,13 @@ Profile* GetProfile() { |
} // namespace |
-PaletteDelegateChromeOS::PaletteDelegateChromeOS() {} |
+PaletteDelegateChromeOS::PaletteDelegateChromeOS() { |
+ ui::InputDeviceManager::GetInstance()->AddObserver(this); |
+} |
-PaletteDelegateChromeOS::~PaletteDelegateChromeOS() {} |
+PaletteDelegateChromeOS::~PaletteDelegateChromeOS() { |
+ ui::InputDeviceManager::GetInstance()->RemoveObserver(this); |
+} |
void PaletteDelegateChromeOS::CreateNote() { |
chromeos::LaunchNoteTakingAppForNewNote(GetProfile(), base::FilePath()); |
@@ -39,6 +46,16 @@ void PaletteDelegateChromeOS::SetPartialMagnifierState(bool enabled) { |
controller->SetEnabled(enabled); |
} |
+void PaletteDelegateChromeOS::SetStylusStateChangedCallback( |
+ const OnStylusStateChangedCallback& on_stylus_state_changed) { |
+ on_stylus_state_changed_ = on_stylus_state_changed; |
+} |
+ |
+bool PaletteDelegateChromeOS::ShouldAutoOpenPalette() { |
+ return GetProfile()->GetPrefs()->GetBoolean( |
+ prefs::kLaunchPaletteOnEjectEvent); |
+} |
+ |
void PaletteDelegateChromeOS::TakeScreenshot() { |
auto* screenshot_delegate = ash::Shell::GetInstance() |
->accelerator_controller_delegate() |
@@ -58,4 +75,8 @@ void PaletteDelegateChromeOS::TakePartialScreenshot() { |
screenshot_delegate, false /* draw_overlay_immediately */); |
} |
+void PaletteDelegateChromeOS::OnStylusStateChanged(ui::StylusState state) { |
+ on_stylus_state_changed_.Run(state); |
+} |
+ |
} // namespace chromeos |