| 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 "content/public/browser/notification_observer.h" | |
| 12 #include "content/public/browser/notification_registrar.h" | |
| 13 #include "mojo/public/cpp/bindings/binding.h" | 11 #include "mojo/public/cpp/bindings/binding.h" |
| 14 | 12 |
| 15 namespace ash { | 13 namespace ash { |
| 16 enum class LoginStatus; | 14 enum class LoginStatus; |
| 17 } | 15 } |
| 18 | 16 |
| 19 namespace views { | 17 namespace views { |
| 20 class Widget; | 18 class Widget; |
| 21 class WidgetDelegate; | 19 class WidgetDelegate; |
| 22 } | 20 } |
| 23 | 21 |
| 24 // Handles method calls delegated back to chrome from ash. Also notifies ash of | 22 // Handles method calls delegated back to chrome from ash. Also notifies ash of |
| 25 // relevant state changes in chrome. | 23 // relevant state changes in chrome. |
| 26 // TODO: Consider renaming this to SystemTrayClientChromeOS. | 24 // TODO: Consider renaming this to SystemTrayClientChromeOS. |
| 27 class SystemTrayClient : public ash::mojom::SystemTrayClient, | 25 class SystemTrayClient : public ash::mojom::SystemTrayClient, |
| 28 public chromeos::system::SystemClockObserver, | 26 public chromeos::system::SystemClockObserver { |
| 29 public content::NotificationObserver { | |
| 30 public: | 27 public: |
| 31 SystemTrayClient(); | 28 SystemTrayClient(); |
| 32 ~SystemTrayClient() override; | 29 ~SystemTrayClient() override; |
| 33 | 30 |
| 34 static SystemTrayClient* Get(); | 31 static SystemTrayClient* Get(); |
| 35 | 32 |
| 36 // Returns the login state based on the user type, lock screen status, etc. | 33 // Returns the login state based on the user type, lock screen status, etc. |
| 37 static ash::LoginStatus GetUserLoginStatus(); | 34 static ash::LoginStatus GetUserLoginStatus(); |
| 38 | 35 |
| 39 // Returns the container id for the parent window for new dialogs. The parent | 36 // Returns the container id for the parent window for new dialogs. The parent |
| 40 // varies based on the current login and lock screen state. | 37 // varies based on the current login and lock screen state. |
| 41 static int GetDialogParentContainerId(); | 38 static int GetDialogParentContainerId(); |
| 42 | 39 |
| 43 // Creates a modal dialog in the parent window for new dialogs on the primary | 40 // Creates a modal dialog in the parent window for new dialogs on the primary |
| 44 // display. See GetDialogParentContainerId() and views::CreateDialogWidget(). | 41 // display. See GetDialogParentContainerId() and views::CreateDialogWidget(). |
| 45 // The returned widget is owned by its native widget. | 42 // The returned widget is owned by its native widget. |
| 46 static views::Widget* CreateUnownedDialogWidget( | 43 static views::Widget* CreateUnownedDialogWidget( |
| 47 views::WidgetDelegate* widget_delegate); | 44 views::WidgetDelegate* widget_delegate); |
| 48 | 45 |
| 49 // Shows an update icon for an Adobe Flash update and forces a device reboot | |
| 50 // when the update is applied. | |
| 51 void SetFlashUpdateAvailable(); | |
| 52 | |
| 53 // ash::mojom::SystemTrayClient: | 46 // ash::mojom::SystemTrayClient: |
| 54 void ShowSettings() override; | 47 void ShowSettings() override; |
| 55 void ShowDateSettings() override; | 48 void ShowDateSettings() override; |
| 56 void ShowSetTimeDialog() override; | 49 void ShowSetTimeDialog() override; |
| 57 void ShowDisplaySettings() override; | 50 void ShowDisplaySettings() override; |
| 58 void ShowPowerSettings() override; | 51 void ShowPowerSettings() override; |
| 59 void ShowChromeSlow() override; | 52 void ShowChromeSlow() override; |
| 60 void ShowIMESettings() override; | 53 void ShowIMESettings() override; |
| 61 void ShowHelp() override; | 54 void ShowHelp() override; |
| 62 void ShowAccessibilityHelp() override; | 55 void ShowAccessibilityHelp() override; |
| 63 void ShowAccessibilitySettings() override; | 56 void ShowAccessibilitySettings() override; |
| 64 void ShowPaletteHelp() override; | 57 void ShowPaletteHelp() override; |
| 65 void ShowPaletteSettings() override; | 58 void ShowPaletteSettings() override; |
| 66 void ShowPublicAccountInfo() override; | 59 void ShowPublicAccountInfo() override; |
| 67 void ShowNetworkConfigure(const std::string& network_id) override; | 60 void ShowNetworkConfigure(const std::string& network_id) override; |
| 68 void ShowNetworkCreate(const std::string& type) override; | 61 void ShowNetworkCreate(const std::string& type) override; |
| 69 void ShowThirdPartyVpnCreate(const std::string& extension_id) override; | 62 void ShowThirdPartyVpnCreate(const std::string& extension_id) override; |
| 70 void ShowNetworkSettings(const std::string& network_id) override; | 63 void ShowNetworkSettings(const std::string& network_id) override; |
| 71 void ShowProxySettings() override; | 64 void ShowProxySettings() override; |
| 72 void SignOut() override; | 65 void SignOut() override; |
| 73 void RequestRestartForUpdate() override; | 66 void RequestRestartForUpdate() override; |
| 74 | 67 |
| 75 private: | 68 private: |
| 76 // Requests that ash show the update available icon. | |
| 77 void HandleUpdateAvailable(); | |
| 78 | |
| 79 // chromeos::system::SystemClockObserver: | 69 // chromeos::system::SystemClockObserver: |
| 80 void OnSystemClockChanged(chromeos::system::SystemClock* clock) override; | 70 void OnSystemClockChanged(chromeos::system::SystemClock* clock) override; |
| 81 | 71 |
| 82 // content::NotificationObserver: | |
| 83 void Observe(int type, | |
| 84 const content::NotificationSource& source, | |
| 85 const content::NotificationDetails& details) override; | |
| 86 | |
| 87 // System tray mojo service in ash. | 72 // System tray mojo service in ash. |
| 88 ash::mojom::SystemTrayPtr system_tray_; | 73 ash::mojom::SystemTrayPtr system_tray_; |
| 89 | 74 |
| 90 // Binds this object to the client interface. | 75 // Binds this object to the client interface. |
| 91 mojo::Binding<ash::mojom::SystemTrayClient> binding_; | 76 mojo::Binding<ash::mojom::SystemTrayClient> binding_; |
| 92 | 77 |
| 93 // Whether an Adobe Flash component update is available. | |
| 94 bool flash_update_available_ = false; | |
| 95 | |
| 96 content::NotificationRegistrar registrar_; | |
| 97 | |
| 98 DISALLOW_COPY_AND_ASSIGN(SystemTrayClient); | 78 DISALLOW_COPY_AND_ASSIGN(SystemTrayClient); |
| 99 }; | 79 }; |
| 100 | 80 |
| 101 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_ | 81 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_ |
| OLD | NEW |