OLD | NEW |
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 "base/compiler_specific.h" | 11 #include "ash/common/session/session_state_observer.h" |
| 12 #include "base/callback_list.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/values.h" | 14 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" |
| 16 |
| 17 class PrefChangeRegistrar; |
| 18 class Profile; |
| 19 |
| 20 namespace ash { |
| 21 class ScopedSessionStateObserver; |
| 22 } |
14 | 23 |
15 namespace chromeos { | 24 namespace chromeos { |
16 | 25 |
17 // A class which allows the Ash palette to perform chrome actions. | 26 // A class which allows the Ash palette to perform chrome actions. |
18 class PaletteDelegateChromeOS : public ash::PaletteDelegate { | 27 class PaletteDelegateChromeOS : public ash::PaletteDelegate, |
| 28 public ash::SessionStateObserver, |
| 29 public content::NotificationObserver { |
19 public: | 30 public: |
20 PaletteDelegateChromeOS(); | 31 PaletteDelegateChromeOS(); |
21 ~PaletteDelegateChromeOS() override; | 32 ~PaletteDelegateChromeOS() override; |
22 | 33 |
23 private: | 34 private: |
| 35 // ash::PaletteDelegate: |
| 36 std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener( |
| 37 const EnableListener& on_state_changed) override; |
| 38 |
| 39 // ash::SessionStateObserver: |
| 40 void ActiveUserChanged(const AccountId& account_id) override; |
| 41 |
| 42 // content::NotificationObserver: |
| 43 void Observe(int type, |
| 44 const content::NotificationSource& source, |
| 45 const content::NotificationDetails& details) override; |
| 46 |
| 47 // Called when the palette enabled pref has changed. |
| 48 void OnPaletteEnabledPrefChanged(); |
| 49 |
| 50 void SetProfile(Profile* profile); |
| 51 |
| 52 base::CallbackList<void(bool)> callback_list_; |
| 53 |
| 54 // Unowned pointer to the active profile. |
| 55 Profile* profile_ = nullptr; |
| 56 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; |
| 57 std::unique_ptr<ash::ScopedSessionStateObserver> session_state_observer_; |
| 58 content::NotificationRegistrar registrar_; |
| 59 |
24 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateChromeOS); | 60 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateChromeOS); |
25 }; | 61 }; |
26 | 62 |
27 } // namespace chromeos | 63 } // namespace chromeos |
28 | 64 |
29 #endif // CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_ | 65 #endif // CHROME_BROWSER_UI_ASH_PALETTE_DELEGATE_CHROMEOS_H_ |
OLD | NEW |