| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_ | 6 #define CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/common/palette_delegate.h" | 10 #include "ash/common/palette_delegate.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "ash/common/session/session_state_observer.h" |
| 12 #include "base/callback_list.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" |
| 14 #include "ui/events/devices/input_device_event_observer.h" | 17 #include "ui/events/devices/input_device_event_observer.h" |
| 15 | 18 |
| 19 class PrefChangeRegistrar; |
| 20 class Profile; |
| 21 |
| 22 namespace ash { |
| 23 class ScopedSessionStateObserver; |
| 24 } |
| 25 |
| 16 namespace chromeos { | 26 namespace chromeos { |
| 17 | 27 |
| 18 // A class which allows the Ash palette to perform chrome actions. | 28 // A class which allows the Ash palette to perform chrome actions. |
| 19 class PaletteDelegateChromeOS : public ash::PaletteDelegate, | 29 class PaletteDelegateChromeOS : public ash::PaletteDelegate, |
| 20 public ui::InputDeviceEventObserver { | 30 public ui::InputDeviceEventObserver, |
| 31 public ash::SessionStateObserver, |
| 32 public content::NotificationObserver { |
| 21 public: | 33 public: |
| 22 PaletteDelegateChromeOS(); | 34 PaletteDelegateChromeOS(); |
| 23 ~PaletteDelegateChromeOS() override; | 35 ~PaletteDelegateChromeOS() override; |
| 24 | 36 |
| 25 private: | 37 private: |
| 26 // ash::PaletteDelegate: | 38 // ash::PaletteDelegate: |
| 39 std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener( |
| 40 const EnableListener& on_state_changed) override; |
| 27 void CreateNote() override; | 41 void CreateNote() override; |
| 28 bool HasNoteApp() override; | 42 bool HasNoteApp() override; |
| 29 void SetPartialMagnifierState(bool enabled) override; | 43 void SetPartialMagnifierState(bool enabled) override; |
| 30 void SetStylusStateChangedCallback( | 44 void SetStylusStateChangedCallback( |
| 31 const OnStylusStateChangedCallback& on_stylus_state_changed) override; | 45 const OnStylusStateChangedCallback& on_stylus_state_changed) override; |
| 32 bool ShouldAutoOpenPalette() override; | 46 bool ShouldAutoOpenPalette() override; |
| 33 void TakeScreenshot() override; | 47 void TakeScreenshot() override; |
| 34 void TakePartialScreenshot() override; | 48 void TakePartialScreenshot() override; |
| 35 | 49 |
| 50 // ash::SessionStateObserver: |
| 51 void ActiveUserChanged(const AccountId& account_id) override; |
| 52 |
| 53 // content::NotificationObserver: |
| 54 void Observe(int type, |
| 55 const content::NotificationSource& source, |
| 56 const content::NotificationDetails& details) override; |
| 57 |
| 36 // ui::InputDeviceObserver: | 58 // ui::InputDeviceObserver: |
| 37 void OnStylusStateChanged(ui::StylusState state) override; | 59 void OnStylusStateChanged(ui::StylusState state) override; |
| 38 | 60 |
| 61 // Called when the palette enabled pref has changed. |
| 62 void OnPaletteEnabledPrefChanged(); |
| 63 |
| 64 void SetProfile(Profile* profile); |
| 65 |
| 66 base::CallbackList<void(bool)> palette_enabled_callback_list_; |
| 39 OnStylusStateChangedCallback on_stylus_state_changed_; | 67 OnStylusStateChangedCallback on_stylus_state_changed_; |
| 40 | 68 |
| 69 // Unowned pointer to the active profile. |
| 70 Profile* profile_ = nullptr; |
| 71 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; |
| 72 std::unique_ptr<ash::ScopedSessionStateObserver> session_state_observer_; |
| 73 content::NotificationRegistrar registrar_; |
| 74 |
| 41 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateChromeOS); | 75 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateChromeOS); |
| 42 }; | 76 }; |
| 43 | 77 |
| 44 } // namespace chromeos | 78 } // namespace chromeos |
| 45 | 79 |
| 46 #endif // CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_ | 80 #endif // CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_ |
| OLD | NEW |