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

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

Issue 2661283002: cros: Clean up SessionStateDelegate refs in Chrome (Closed)
Patch Set: update browser_finder_chromeos_unittest Created 3 years, 9 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"
12 #include "base/callback_list.h" 11 #include "base/callback_list.h"
13 #include "base/macros.h" 12 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
15 #include "base/values.h" 14 #include "base/values.h"
15 #include "components/user_manager/user_manager.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 18
19 class PrefChangeRegistrar; 19 class PrefChangeRegistrar;
20 class Profile; 20 class Profile;
21 21
22 namespace ash {
23 class ScopedSessionStateObserver;
24 }
25
26 namespace chromeos { 22 namespace chromeos {
27 23
28 // A class which allows the Ash palette to perform chrome actions. 24 // A class which allows the Ash palette to perform chrome actions.
29 class PaletteDelegateChromeOS : public ash::PaletteDelegate, 25 class PaletteDelegateChromeOS
30 public ash::SessionStateObserver, 26 : public ash::PaletteDelegate,
31 public content::NotificationObserver { 27 public user_manager::UserManager::UserSessionStateObserver,
28 public content::NotificationObserver {
32 public: 29 public:
33 PaletteDelegateChromeOS(); 30 PaletteDelegateChromeOS();
34 ~PaletteDelegateChromeOS() override; 31 ~PaletteDelegateChromeOS() override;
35 32
36 private: 33 private:
37 // ash::PaletteDelegate: 34 // ash::PaletteDelegate:
38 std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener( 35 std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener(
39 const EnableListener& on_state_changed) override; 36 const EnableListener& on_state_changed) override;
40 void CreateNote() override; 37 void CreateNote() override;
41 bool HasNoteApp() override; 38 bool HasNoteApp() override;
42 bool ShouldAutoOpenPalette() override; 39 bool ShouldAutoOpenPalette() override;
43 bool ShouldShowPalette() override; 40 bool ShouldShowPalette() override;
44 void TakeScreenshot() override; 41 void TakeScreenshot() override;
45 void TakePartialScreenshot(const base::Closure& done) override; 42 void TakePartialScreenshot(const base::Closure& done) override;
46 void CancelPartialScreenshot() override; 43 void CancelPartialScreenshot() override;
47 44
48 // ash::SessionStateObserver: 45 // user_manager::UserManager::UserSessionStateObserver:
49 void ActiveUserChanged(const AccountId& account_id) override; 46 void ActiveUserChanged(const user_manager::User* active_user) override;
50 47
51 // content::NotificationObserver: 48 // content::NotificationObserver:
52 void Observe(int type, 49 void Observe(int type,
53 const content::NotificationSource& source, 50 const content::NotificationSource& source,
54 const content::NotificationDetails& details) override; 51 const content::NotificationDetails& details) override;
55 52
56 // Called when the palette enabled pref has changed. 53 // Called when the palette enabled pref has changed.
57 void OnPaletteEnabledPrefChanged(); 54 void OnPaletteEnabledPrefChanged();
58 55
59 void SetProfile(Profile* profile); 56 void SetProfile(Profile* profile);
60 void OnPartialScreenshotDone(const base::Closure& then); 57 void OnPartialScreenshotDone(const base::Closure& then);
61 58
62 base::CallbackList<void(bool)> palette_enabled_callback_list_; 59 base::CallbackList<void(bool)> palette_enabled_callback_list_;
63 60
64 // Unowned pointer to the active profile. 61 // Unowned pointer to the active profile.
65 Profile* profile_ = nullptr; 62 Profile* profile_ = nullptr;
66 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; 63 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
67 std::unique_ptr<ash::ScopedSessionStateObserver> session_state_observer_; 64 std::unique_ptr<user_manager::ScopedUserSessionStateObserver>
65 session_state_observer_;
68 content::NotificationRegistrar registrar_; 66 content::NotificationRegistrar registrar_;
69 67
70 base::WeakPtrFactory<PaletteDelegateChromeOS> weak_factory_; 68 base::WeakPtrFactory<PaletteDelegateChromeOS> weak_factory_;
71 69
72 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateChromeOS); 70 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateChromeOS);
73 }; 71 };
74 72
75 } // namespace chromeos 73 } // namespace chromeos
76 74
77 #endif // CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_ 75 #endif // CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698