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 #ifndef ASH_COMMON_PALETTE_DELEGATE_H_ | 5 #ifndef ASH_COMMON_PALETTE_DELEGATE_H_ |
6 #define ASH_COMMON_PALETTE_DELEGATE_H_ | 6 #define ASH_COMMON_PALETTE_DELEGATE_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/callback_list.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "ui/events/devices/stylus_state.h" | 12 #include "ui/events/devices/stylus_state.h" |
12 | 13 |
13 namespace ash { | 14 namespace ash { |
14 | 15 |
15 // This delegate allows the UI code in ash, e.g. |PaletteTray|, to perform | 16 // This delegate allows the UI code in ash, e.g. |PaletteTray|, to perform |
16 // Chrome-specific actions. | 17 // Chrome-specific actions. |
17 class PaletteDelegate { | 18 class PaletteDelegate { |
18 public: | 19 public: |
| 20 using EnableListener = base::Callback<void(bool)>; |
| 21 using EnableListenerSubscription = |
| 22 base::CallbackList<void(bool)>::Subscription; |
19 using OnStylusStateChangedCallback = base::Callback<void(ui::StylusState)>; | 23 using OnStylusStateChangedCallback = base::Callback<void(ui::StylusState)>; |
20 | 24 |
21 virtual ~PaletteDelegate() {} | 25 virtual ~PaletteDelegate() {} |
22 | 26 |
| 27 // Sets callback function that will receive the current state of the palette |
| 28 // enabled pref. The callback will be invoked once the initial pref value is |
| 29 // available. |
| 30 virtual std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener( |
| 31 const EnableListener& on_state_changed) = 0; |
| 32 |
23 // Create a new note. | 33 // Create a new note. |
24 virtual void CreateNote() = 0; | 34 virtual void CreateNote() = 0; |
25 | 35 |
26 // Returns true if there is a note-taking application available. | 36 // Returns true if there is a note-taking application available. |
27 virtual bool HasNoteApp() = 0; | 37 virtual bool HasNoteApp() = 0; |
28 | 38 |
29 // Enables or disables the partial magnifier. | 39 // Enables or disables the partial magnifier. |
30 virtual void SetPartialMagnifierState(bool enabled) = 0; | 40 virtual void SetPartialMagnifierState(bool enabled) = 0; |
31 | 41 |
32 // Set callback that is run when a stylus is inserted or removed. | 42 // Set callback that is run when a stylus is inserted or removed. |
(...skipping 10 matching lines...) Expand all Loading... |
43 // Take a screenshot of a user-selected region. | 53 // Take a screenshot of a user-selected region. |
44 virtual void TakePartialScreenshot() = 0; | 54 virtual void TakePartialScreenshot() = 0; |
45 | 55 |
46 private: | 56 private: |
47 DISALLOW_ASSIGN(PaletteDelegate); | 57 DISALLOW_ASSIGN(PaletteDelegate); |
48 }; | 58 }; |
49 | 59 |
50 } // namespace ash | 60 } // namespace ash |
51 | 61 |
52 #endif // ASH_COMMON_PALETTE_DELEGATE_H_ | 62 #endif // ASH_COMMON_PALETTE_DELEGATE_H_ |
OLD | NEW |