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

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

Issue 2291913002: Allow the user to cancel the capture region action, and show its active status in the tray. (Closed)
Patch Set: Created 4 years, 3 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/values.h" 15 #include "base/values.h"
15 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
17 #include "ui/events/devices/input_device_event_observer.h" 18 #include "ui/events/devices/input_device_event_observer.h"
18 19
19 class PrefChangeRegistrar; 20 class PrefChangeRegistrar;
20 class Profile; 21 class Profile;
21 22
22 namespace ash { 23 namespace ash {
23 class ScopedSessionStateObserver; 24 class ScopedSessionStateObserver;
24 } 25 }
25 26
26 namespace chromeos { 27 namespace chromeos {
27 28
28 // A class which allows the Ash palette to perform chrome actions. 29 // A class which allows the Ash palette to perform chrome actions.
29 class PaletteDelegateChromeOS : public ash::PaletteDelegate, 30 class PaletteDelegateChromeOS : public ash::PaletteDelegate,
30 public ui::InputDeviceEventObserver, 31 public ui::InputDeviceEventObserver,
31 public ash::SessionStateObserver, 32 public ash::SessionStateObserver,
32 public content::NotificationObserver { 33 public content::NotificationObserver {
33 public: 34 public:
34 // Attempts to create a palette delegate. This will return null if the palette 35 // Attempts to create a palette delegate. This will return null if the palette
35 // feature is not enabled. 36 // feature is not enabled.
36 static std::unique_ptr<PaletteDelegateChromeOS> Create(); 37 static std::unique_ptr<PaletteDelegateChromeOS> Create();
37 38
38 ~PaletteDelegateChromeOS() override; 39 ~PaletteDelegateChromeOS() override;
39 40
40 private: 41 private:
41 PaletteDelegateChromeOS(); 42 PaletteDelegateChromeOS();
42 43
44 class ProxyScreenshotDelegate;
45
43 // ash::PaletteDelegate: 46 // ash::PaletteDelegate:
44 std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener( 47 std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener(
45 const EnableListener& on_state_changed) override; 48 const EnableListener& on_state_changed) override;
46 void CreateNote() override; 49 void CreateNote() override;
47 bool HasNoteApp() override; 50 bool HasNoteApp() override;
48 void SetPartialMagnifierState(bool enabled) override; 51 void SetPartialMagnifierState(bool enabled) override;
49 void SetStylusStateChangedCallback( 52 void SetStylusStateChangedCallback(
50 const OnStylusStateChangedCallback& on_stylus_state_changed) override; 53 const OnStylusStateChangedCallback& on_stylus_state_changed) override;
51 bool ShouldAutoOpenPalette() override; 54 bool ShouldAutoOpenPalette() override;
52 bool ShouldShowPalette() override; 55 bool ShouldShowPalette() override;
53 void TakeScreenshot() override; 56 void TakeScreenshot() override;
54 void TakePartialScreenshot() override; 57 void TakePartialScreenshot(const base::Closure& done) override;
58 void CancelPartialScreenshot() override;
55 59
56 // ash::SessionStateObserver: 60 // ash::SessionStateObserver:
57 void ActiveUserChanged(const AccountId& account_id) override; 61 void ActiveUserChanged(const AccountId& account_id) override;
58 62
59 // content::NotificationObserver: 63 // content::NotificationObserver:
60 void Observe(int type, 64 void Observe(int type,
61 const content::NotificationSource& source, 65 const content::NotificationSource& source,
62 const content::NotificationDetails& details) override; 66 const content::NotificationDetails& details) override;
63 67
64 // ui::InputDeviceObserver: 68 // ui::InputDeviceObserver:
65 void OnStylusStateChanged(ui::StylusState state) override; 69 void OnStylusStateChanged(ui::StylusState state) override;
66 70
67 // Called when the palette enabled pref has changed. 71 // Called when the palette enabled pref has changed.
68 void OnPaletteEnabledPrefChanged(); 72 void OnPaletteEnabledPrefChanged();
69 73
70 void SetProfile(Profile* profile); 74 void SetProfile(Profile* profile);
75 void OnPartialScreenshotDone(const base::Closure& then);
71 76
72 base::CallbackList<void(bool)> palette_enabled_callback_list_; 77 base::CallbackList<void(bool)> palette_enabled_callback_list_;
73 OnStylusStateChangedCallback on_stylus_state_changed_; 78 OnStylusStateChangedCallback on_stylus_state_changed_;
74 79
80 std::unique_ptr<ProxyScreenshotDelegate> proxy_screenshot_delegate_;
81
75 // Unowned pointer to the active profile. 82 // Unowned pointer to the active profile.
76 Profile* profile_ = nullptr; 83 Profile* profile_ = nullptr;
77 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; 84 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
78 std::unique_ptr<ash::ScopedSessionStateObserver> session_state_observer_; 85 std::unique_ptr<ash::ScopedSessionStateObserver> session_state_observer_;
79 content::NotificationRegistrar registrar_; 86 content::NotificationRegistrar registrar_;
80 87
88 base::WeakPtrFactory<PaletteDelegateChromeOS> weak_factory_;
89
81 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateChromeOS); 90 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateChromeOS);
82 }; 91 };
83 92
84 } // namespace chromeos 93 } // namespace chromeos
85 94
86 #endif // CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_ 95 #endif // CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698