| OLD | NEW |
| 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 CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_ | 6 #define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_ |
| 7 | 7 |
| 8 #include "ash/public/interfaces/system_tray.mojom.h" | 8 #include "ash/public/interfaces/system_tray.mojom.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chrome/browser/chromeos/system/system_clock_observer.h" | 10 #include "chrome/browser/chromeos/system/system_clock_observer.h" |
| 11 #include "chrome/browser/upgrade_observer.h" | 11 #include "chrome/browser/upgrade_observer.h" |
| 12 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 12 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 13 #include "content/public/browser/notification_observer.h" | |
| 14 #include "content/public/browser/notification_registrar.h" | |
| 15 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
| 16 | 14 |
| 17 namespace ash { | 15 namespace ash { |
| 18 enum class LoginStatus; | 16 enum class LoginStatus; |
| 19 } | 17 } |
| 20 | 18 |
| 21 namespace views { | 19 namespace views { |
| 22 class Widget; | 20 class Widget; |
| 23 class WidgetDelegate; | 21 class WidgetDelegate; |
| 24 } | 22 } |
| 25 | 23 |
| 26 // Handles method calls delegated back to chrome from ash. Also notifies ash of | 24 // Handles method calls delegated back to chrome from ash. Also notifies ash of |
| 27 // relevant state changes in chrome. | 25 // relevant state changes in chrome. |
| 28 // TODO: Consider renaming this to SystemTrayClientChromeOS. | 26 // TODO: Consider renaming this to SystemTrayClientChromeOS. |
| 29 class SystemTrayClient : public ash::mojom::SystemTrayClient, | 27 class SystemTrayClient : public ash::mojom::SystemTrayClient, |
| 30 public chromeos::system::SystemClockObserver, | 28 public chromeos::system::SystemClockObserver, |
| 31 public policy::CloudPolicyStore::Observer, | 29 public policy::CloudPolicyStore::Observer, |
| 32 public content::NotificationObserver, | |
| 33 public UpgradeObserver { | 30 public UpgradeObserver { |
| 34 public: | 31 public: |
| 35 SystemTrayClient(); | 32 SystemTrayClient(); |
| 36 ~SystemTrayClient() override; | 33 ~SystemTrayClient() override; |
| 37 | 34 |
| 38 static SystemTrayClient* Get(); | 35 static SystemTrayClient* Get(); |
| 39 | 36 |
| 40 // Returns the login state based on the user type, lock screen status, etc. | 37 // Returns the login state based on the user type, lock screen status, etc. |
| 41 static ash::LoginStatus GetUserLoginStatus(); | 38 static ash::LoginStatus GetUserLoginStatus(); |
| 42 | 39 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 91 |
| 95 // Requests that ash show the update available icon. | 92 // Requests that ash show the update available icon. |
| 96 void HandleUpdateAvailable(); | 93 void HandleUpdateAvailable(); |
| 97 | 94 |
| 98 // Requests that ash show the update over cellular available icon. | 95 // Requests that ash show the update over cellular available icon. |
| 99 void HandleUpdateOverCellularAvailable(); | 96 void HandleUpdateOverCellularAvailable(); |
| 100 | 97 |
| 101 // chromeos::system::SystemClockObserver: | 98 // chromeos::system::SystemClockObserver: |
| 102 void OnSystemClockChanged(chromeos::system::SystemClock* clock) override; | 99 void OnSystemClockChanged(chromeos::system::SystemClock* clock) override; |
| 103 | 100 |
| 104 // UpgradeObserver: | 101 // UpgradeObserver implementation. |
| 105 void OnUpdateOverCellularAvailable() override; | 102 void OnUpdateOverCellularAvailable() override; |
| 103 void OnUpgradeRecommended() override; |
| 106 | 104 |
| 107 // policy::CloudPolicyStore::Observer | 105 // policy::CloudPolicyStore::Observer |
| 108 void OnStoreLoaded(policy::CloudPolicyStore* store) override; | 106 void OnStoreLoaded(policy::CloudPolicyStore* store) override; |
| 109 void OnStoreError(policy::CloudPolicyStore* store) override; | 107 void OnStoreError(policy::CloudPolicyStore* store) override; |
| 110 | 108 |
| 111 void UpdateEnterpriseDomain(); | 109 void UpdateEnterpriseDomain(); |
| 112 | 110 |
| 113 // content::NotificationObserver: | |
| 114 void Observe(int type, | |
| 115 const content::NotificationSource& source, | |
| 116 const content::NotificationDetails& details) override; | |
| 117 | |
| 118 // System tray mojo service in ash. | 111 // System tray mojo service in ash. |
| 119 ash::mojom::SystemTrayPtr system_tray_; | 112 ash::mojom::SystemTrayPtr system_tray_; |
| 120 | 113 |
| 121 // Binds this object to the client interface. | 114 // Binds this object to the client interface. |
| 122 mojo::Binding<ash::mojom::SystemTrayClient> binding_; | 115 mojo::Binding<ash::mojom::SystemTrayClient> binding_; |
| 123 | 116 |
| 124 // Whether an Adobe Flash component update is available. | 117 // Whether an Adobe Flash component update is available. |
| 125 bool flash_update_available_ = false; | 118 bool flash_update_available_ = false; |
| 126 | 119 |
| 127 // Avoid sending ash an empty enterprise domain at startup and suppress | 120 // Avoid sending ash an empty enterprise domain at startup and suppress |
| 128 // duplicate IPCs during the session. | 121 // duplicate IPCs during the session. |
| 129 std::string last_enterprise_domain_; | 122 std::string last_enterprise_domain_; |
| 130 bool last_active_directory_managed_ = false; | 123 bool last_active_directory_managed_ = false; |
| 131 | 124 |
| 132 content::NotificationRegistrar registrar_; | |
| 133 | |
| 134 DISALLOW_COPY_AND_ASSIGN(SystemTrayClient); | 125 DISALLOW_COPY_AND_ASSIGN(SystemTrayClient); |
| 135 }; | 126 }; |
| 136 | 127 |
| 137 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_ | 128 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_ |
| OLD | NEW |