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