system_tray.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_PUBLIC_CPP_SYSTEM_TRAY_H_
  5. #define ASH_PUBLIC_CPP_SYSTEM_TRAY_H_
  6. #include <string>
  7. #include "ash/public/cpp/ash_public_export.h"
  8. namespace ash {
  9. class SystemTrayClient;
  10. enum class DeferredUpdateState;
  11. enum class NotificationStyle;
  12. enum class UpdateSeverity;
  13. enum class UpdateType;
  14. struct DeviceEnterpriseInfo;
  15. struct LocaleInfo;
  16. struct RelaunchNotificationState;
  17. namespace phonehub {
  18. class PhoneHubManager;
  19. }
  20. // Public interface to control the system tray bubble in ash.
  21. class ASH_PUBLIC_EXPORT SystemTray {
  22. public:
  23. static SystemTray* Get();
  24. // Sets the client interface in the browser.
  25. virtual void SetClient(SystemTrayClient* client) = 0;
  26. // Sets the enabled state of the tray on the primary display. If not |enabled|
  27. // any open menu will be closed.
  28. virtual void SetPrimaryTrayEnabled(bool enabled) = 0;
  29. // Sets the visibility of the tray on the primary display.
  30. virtual void SetPrimaryTrayVisible(bool visible) = 0;
  31. // Sets the clock to use 24 hour time formatting if |use_24_hour| is true.
  32. // Otherwise sets 12 hour time formatting.
  33. virtual void SetUse24HourClock(bool use_24_hour) = 0;
  34. // Creates or updates an item in the system tray menu with information about
  35. // enterprise management.
  36. virtual void SetDeviceEnterpriseInfo(
  37. const DeviceEnterpriseInfo& device_enterprise_info) = 0;
  38. // Creates or updates an item in the system tray menu with information about
  39. // enterprise management.
  40. // |account_domain_manager| may be either a domain name (foo.com) or an email
  41. // address (user@foo.com). These strings will not be sanitized and so must
  42. // come from a trusted location.
  43. virtual void SetEnterpriseAccountDomainInfo(
  44. const std::string& account_domain_manager) = 0;
  45. // Shows or hides an item in the system tray indicating that performance
  46. // tracing is running.
  47. virtual void SetPerformanceTracingIconVisible(bool visible) = 0;
  48. // Sets the list of supported UI locales. |current_locale_iso_code| refers to
  49. // the locale currently used by the UI.
  50. virtual void SetLocaleList(std::vector<LocaleInfo> locale_list,
  51. const std::string& current_locale_iso_code) = 0;
  52. // Shows an icon in the system tray or a notification on the unified system
  53. // menu indicating that a software update is available. Once shown, the icon
  54. // or the notification persists until reboot.
  55. // |severity| specifies how critical is the update.
  56. // |factory_reset_required| is true if during the update the device will
  57. // be wiped.
  58. // |rollback| specifies whether the update is actually an admin-initiated
  59. // rollback. This implies that a the device will be wiped.
  60. // |update_type| specifies the component which has been updated.
  61. //
  62. // These values are used to control the icon, color and the text of the
  63. // tooltip or the notification.
  64. virtual void ShowUpdateIcon(UpdateSeverity severity,
  65. bool factory_reset_required,
  66. bool rollback,
  67. UpdateType update_type) = 0;
  68. // Changes the update notification in the unified system menu,
  69. // according to different policies, when there is an update available
  70. // (it may be recommended or required, from Relaunch Notification policy,
  71. // for example).
  72. // Providing the `RelaunchNotificationState` allows the update countdown logic
  73. // to remain in //chrome/browser, where it is shared with other platforms.
  74. virtual void SetRelaunchNotificationState(
  75. const RelaunchNotificationState& relaunch_notification_state) = 0;
  76. // Resets update state to hide the update icon and notification. It is called
  77. // when a new update starts before the current update is applied.
  78. virtual void ResetUpdateState() = 0;
  79. // Set deferred update state to be either showing a dialog or showing an icon
  80. // in the system tray to indicate that a update is downloaded but deferred.
  81. virtual void SetUpdateDeferred(DeferredUpdateState state) = 0;
  82. // If |visible| is true, shows an icon in the system tray which indicates that
  83. // a software update is available but user's agreement is required as current
  84. // connection is cellular. If |visible| is false, hides the icon because the
  85. // user's one time permission on update over cellular connection has been
  86. // granted.
  87. virtual void SetUpdateOverCellularAvailableIconVisible(bool visible) = 0;
  88. // Shows the volume slider bubble shown at the right bottom of screen.
  89. virtual void ShowVolumeSliderBubble() = 0;
  90. // Shows the network detailed view bubble at the right bottom of the primary
  91. // display.
  92. virtual void ShowNetworkDetailedViewBubble() = 0;
  93. // Provides Phone Hub functionality to the system tray.
  94. virtual void SetPhoneHubManager(
  95. phonehub::PhoneHubManager* phone_hub_manager) = 0;
  96. protected:
  97. SystemTray();
  98. virtual ~SystemTray();
  99. };
  100. } // namespace ash
  101. #endif // ASH_PUBLIC_CPP_SYSTEM_TRAY_H_