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

Side by Side Diff: ash/common/palette_delegate.h

Issue 2644713002: cros: Use runtime stylus detection for ash palette. (Closed)
Patch Set: Initial upload Created 3 years, 11 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 unified diff | Download patch
OLDNEW
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/callback_list.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "ui/events/devices/stylus_state.h" 12 #include "ui/events/devices/stylus_state.h"
13 13
14 namespace ash { 14 namespace ash {
15 15
16 // 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
17 // Chrome-specific actions. 17 // Chrome-specific actions.
18 class PaletteDelegate { 18 class PaletteDelegate {
19 public: 19 public:
20 using EnableListener = base::Callback<void(bool)>; 20 using EnableListener = base::Callback<void(bool)>;
21 using EnableListenerSubscription = 21 using EnableListenerSubscription =
22 base::CallbackList<void(bool)>::Subscription; 22 base::CallbackList<void(bool)>::Subscription;
23 using OnStylusStateChangedCallback = base::Callback<void(ui::StylusState)>;
24 23
25 virtual ~PaletteDelegate() {} 24 virtual ~PaletteDelegate() {}
26 25
27 // Sets callback function that will receive the current state of the palette 26 // 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 27 // enabled pref. The callback will be invoked once the initial pref value is
29 // available. 28 // available.
30 virtual std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener( 29 virtual std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener(
31 const EnableListener& on_state_changed) = 0; 30 const EnableListener& on_state_changed) = 0;
32 31
33 // Create a new note. 32 // Create a new note.
34 virtual void CreateNote() = 0; 33 virtual void CreateNote() = 0;
35 34
36 // Returns true if there is a note-taking application available. 35 // Returns true if there is a note-taking application available.
37 virtual bool HasNoteApp() = 0; 36 virtual bool HasNoteApp() = 0;
38 37
39 // Enables or disables the partial magnifier. 38 // Enables or disables the partial magnifier.
40 // TODO(sammiequon): This can be removed from the delegate and put in wmshell. 39 // TODO(sammiequon): This can be removed from the delegate and put in wmshell.
41 // See http://crbug.com/647031. 40 // See http://crbug.com/647031.
42 virtual void SetPartialMagnifierState(bool enabled) = 0; 41 virtual void SetPartialMagnifierState(bool enabled) = 0;
43 42
44 // Set callback that is run when a stylus is inserted or removed.
45 virtual void SetStylusStateChangedCallback(
46 const OnStylusStateChangedCallback& on_stylus_state_changed) = 0;
47
48 // Returns true if the palette should be automatically opened on an eject 43 // Returns true if the palette should be automatically opened on an eject
49 // event. 44 // event.
50 virtual bool ShouldAutoOpenPalette() = 0; 45 virtual bool ShouldAutoOpenPalette() = 0;
51 46
52 // Returns true if the palette should be displayed. This is the one-shot 47 // Returns true if the palette should be displayed. This is the one-shot
53 // equivalent to AddPaletteEnableListener. 48 // equivalent to AddPaletteEnableListener.
54 virtual bool ShouldShowPalette() = 0; 49 virtual bool ShouldShowPalette() = 0;
55 50
56 // Take a screenshot of the entire window. 51 // Take a screenshot of the entire window.
57 virtual void TakeScreenshot() = 0; 52 virtual void TakeScreenshot() = 0;
58 53
59 // Take a screenshot of a user-selected region. |done| is called when the 54 // Take a screenshot of a user-selected region. |done| is called when the
60 // partial screenshot session has finished; a screenshot may or may not have 55 // partial screenshot session has finished; a screenshot may or may not have
61 // been taken. 56 // been taken.
62 virtual void TakePartialScreenshot(const base::Closure& done) = 0; 57 virtual void TakePartialScreenshot(const base::Closure& done) = 0;
63 58
64 // Cancels any active partial screenshot session. 59 // Cancels any active partial screenshot session.
65 virtual void CancelPartialScreenshot() = 0; 60 virtual void CancelPartialScreenshot() = 0;
66 61
67 private: 62 private:
68 DISALLOW_ASSIGN(PaletteDelegate); 63 DISALLOW_ASSIGN(PaletteDelegate);
69 }; 64 };
70 65
71 } // namespace ash 66 } // namespace ash
72 67
73 #endif // ASH_COMMON_PALETTE_DELEGATE_H_ 68 #endif // ASH_COMMON_PALETTE_DELEGATE_H_
OLDNEW
« no previous file with comments | « no previous file | ash/common/system/chromeos/palette/palette_tray.h » ('j') | ash/common/system/chromeos/palette/palette_tray.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698