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

Side by Side Diff: chrome/browser/ui/ash/palette_delegate_chromeos.h

Issue 2644713002: cros: Use runtime stylus detection for ash palette. (Closed)
Patch Set: Fix test Created 3 years, 10 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 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 "ash/common/session/session_state_observer.h" 11 #include "ash/common/session/session_state_observer.h"
12 #include "base/callback_list.h" 12 #include "base/callback_list.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
18 #include "ui/events/devices/input_device_event_observer.h"
19 18
20 class PrefChangeRegistrar; 19 class PrefChangeRegistrar;
21 class Profile; 20 class Profile;
22 21
23 namespace ash { 22 namespace ash {
24 class ScopedSessionStateObserver; 23 class ScopedSessionStateObserver;
25 } 24 }
26 25
27 namespace chromeos { 26 namespace chromeos {
28 27
29 // A class which allows the Ash palette to perform chrome actions. 28 // A class which allows the Ash palette to perform chrome actions.
30 class PaletteDelegateChromeOS : public ash::PaletteDelegate, 29 class PaletteDelegateChromeOS : public ash::PaletteDelegate,
31 public ui::InputDeviceEventObserver,
32 public ash::SessionStateObserver, 30 public ash::SessionStateObserver,
33 public content::NotificationObserver { 31 public content::NotificationObserver {
34 public: 32 public:
35 // Attempts to create a palette delegate. This will return null if the palette 33 PaletteDelegateChromeOS();
36 // feature is not enabled.
37 static std::unique_ptr<PaletteDelegateChromeOS> Create();
38
39 ~PaletteDelegateChromeOS() override; 34 ~PaletteDelegateChromeOS() override;
40 35
41 private: 36 private:
42 PaletteDelegateChromeOS();
43
44 // ash::PaletteDelegate: 37 // ash::PaletteDelegate:
45 std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener( 38 std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener(
46 const EnableListener& on_state_changed) override; 39 const EnableListener& on_state_changed) override;
47 void CreateNote() override; 40 void CreateNote() override;
48 bool HasNoteApp() override; 41 bool HasNoteApp() override;
49 void SetStylusStateChangedCallback(
50 const OnStylusStateChangedCallback& on_stylus_state_changed) override;
51 bool ShouldAutoOpenPalette() override; 42 bool ShouldAutoOpenPalette() override;
52 bool ShouldShowPalette() override; 43 bool ShouldShowPalette() override;
53 void TakeScreenshot() override; 44 void TakeScreenshot() override;
54 void TakePartialScreenshot(const base::Closure& done) override; 45 void TakePartialScreenshot(const base::Closure& done) override;
55 void CancelPartialScreenshot() override; 46 void CancelPartialScreenshot() override;
56 47
57 // ash::SessionStateObserver: 48 // ash::SessionStateObserver:
58 void ActiveUserChanged(const AccountId& account_id) override; 49 void ActiveUserChanged(const AccountId& account_id) override;
59 50
60 // content::NotificationObserver: 51 // content::NotificationObserver:
61 void Observe(int type, 52 void Observe(int type,
62 const content::NotificationSource& source, 53 const content::NotificationSource& source,
63 const content::NotificationDetails& details) override; 54 const content::NotificationDetails& details) override;
64 55
65 // ui::InputDeviceObserver:
66 void OnStylusStateChanged(ui::StylusState state) override;
67
68 // Called when the palette enabled pref has changed. 56 // Called when the palette enabled pref has changed.
69 void OnPaletteEnabledPrefChanged(); 57 void OnPaletteEnabledPrefChanged();
70 58
71 void SetProfile(Profile* profile); 59 void SetProfile(Profile* profile);
72 void OnPartialScreenshotDone(const base::Closure& then); 60 void OnPartialScreenshotDone(const base::Closure& then);
73 61
74 base::CallbackList<void(bool)> palette_enabled_callback_list_; 62 base::CallbackList<void(bool)> palette_enabled_callback_list_;
75 OnStylusStateChangedCallback on_stylus_state_changed_;
76 63
77 // Unowned pointer to the active profile. 64 // Unowned pointer to the active profile.
78 Profile* profile_ = nullptr; 65 Profile* profile_ = nullptr;
79 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; 66 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
80 std::unique_ptr<ash::ScopedSessionStateObserver> session_state_observer_; 67 std::unique_ptr<ash::ScopedSessionStateObserver> session_state_observer_;
81 content::NotificationRegistrar registrar_; 68 content::NotificationRegistrar registrar_;
82 69
83 base::WeakPtrFactory<PaletteDelegateChromeOS> weak_factory_; 70 base::WeakPtrFactory<PaletteDelegateChromeOS> weak_factory_;
84 71
85 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateChromeOS); 72 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateChromeOS);
86 }; 73 };
87 74
88 } // namespace chromeos 75 } // namespace chromeos
89 76
90 #endif // CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_ 77 #endif // CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.cc ('k') | chrome/browser/ui/ash/palette_delegate_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698