Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Unified Diff: chrome/browser/ui/ash/palette_delegate_chromeos.cc

Issue 2234203002: Auto open and close the palette on an eject event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tool-note
Patch Set: Use weak ptr Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/ash/palette_delegate_chromeos.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/ui/ash/palette_delegate_chromeos.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698