| 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 ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_ |
| 6 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" |
| 8 #include "ash/public/interfaces/system_tray.mojom.h" | 9 #include "ash/public/interfaces/system_tray.mojom.h" |
| 10 #include "base/compiler_specific.h" |
| 9 #include "base/i18n/time_formatting.h" | 11 #include "base/i18n/time_formatting.h" |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "mojo/public/cpp/bindings/binding_set.h" | 13 #include "mojo/public/cpp/bindings/binding_set.h" |
| 12 | 14 |
| 13 namespace shell { | 15 namespace shell { |
| 14 class Connector; | 16 class Connector; |
| 15 } | 17 } |
| 16 | 18 |
| 17 namespace ash { | 19 namespace ash { |
| 18 | 20 |
| 19 // Both implements mojom::SystemTray and wraps the mojom::SystemTrayClient | 21 // Both implements mojom::SystemTray and wraps the mojom::SystemTrayClient |
| 20 // interface. The wrapper makes the initial connection and handles reconnecting | 22 // interface. The wrapper makes the initial connection and handles reconnecting |
| 21 // on error. Implements both because it caches state pushed down from the | 23 // on error. Implements both because it caches state pushed down from the |
| 22 // browser process via SystemTray so it can be synchronously queried inside ash. | 24 // browser process via SystemTray so it can be synchronously queried inside ash. |
| 23 // | 25 // |
| 24 // Conceptually similar to historical ash-to-chrome interfaces like | 26 // Conceptually similar to historical ash-to-chrome interfaces like |
| 25 // SystemTrayDelegate. Lives on the main thread. | 27 // SystemTrayDelegate. Lives on the main thread. |
| 26 // | 28 // |
| 27 // Only connects to the actual mojom::SystemTrayClient interface when running on | 29 // Only connects to the actual mojom::SystemTrayClient interface when running on |
| 28 // Chrome OS. In tests and on Windows all operations are no-ops. | 30 // Chrome OS. In tests and on Windows all operations are no-ops. |
| 29 // | 31 // |
| 30 // TODO: Consider renaming this to SystemTrayClient or renaming the current | 32 // TODO: Consider renaming this to SystemTrayClient or renaming the current |
| 31 // SystemTray to SystemTrayView and making this class SystemTray. | 33 // SystemTray to SystemTrayView and making this class SystemTray. |
| 32 class SystemTrayController : public mojom::SystemTray { | 34 class ASH_EXPORT SystemTrayController |
| 35 : NON_EXPORTED_BASE(public mojom::SystemTray) { |
| 33 public: | 36 public: |
| 34 explicit SystemTrayController(shell::Connector* connector); | 37 explicit SystemTrayController(shell::Connector* connector); |
| 35 ~SystemTrayController() override; | 38 ~SystemTrayController() override; |
| 36 | 39 |
| 37 base::HourClockType hour_clock_type() const { return hour_clock_type_; } | 40 base::HourClockType hour_clock_type() const { return hour_clock_type_; } |
| 38 | 41 |
| 39 // Wrappers around the mojom::SystemTrayClient interface. | 42 // Wrappers around the mojom::SystemTrayClient interface. |
| 40 void ShowSettings(); | 43 void ShowSettings(); |
| 41 void ShowDateSettings(); | 44 void ShowDateSettings(); |
| 42 void ShowDisplaySettings(); | 45 void ShowDisplaySettings(); |
| 43 void ShowPowerSettings(); | 46 void ShowPowerSettings(); |
| 44 void ShowChromeSlow(); | 47 void ShowChromeSlow(); |
| 45 void ShowIMESettings(); | 48 void ShowIMESettings(); |
| 46 void ShowHelp(); | 49 void ShowHelp(); |
| 47 void ShowAccessibilityHelp(); | 50 void ShowAccessibilityHelp(); |
| 48 void ShowAccessibilitySettings(); | 51 void ShowAccessibilitySettings(); |
| 49 void ShowPaletteHelp(); | 52 void ShowPaletteHelp(); |
| 50 void ShowPaletteSettings(); | 53 void ShowPaletteSettings(); |
| 51 void ShowPublicAccountInfo(); | 54 void ShowPublicAccountInfo(); |
| 55 void ShowNetworkConfigure(const std::string& network_id); |
| 52 void ShowNetworkSettings(const std::string& network_id); | 56 void ShowNetworkSettings(const std::string& network_id); |
| 53 void ShowProxySettings(); | 57 void ShowProxySettings(); |
| 54 | 58 |
| 55 // Binds the mojom::SystemTray interface to this object. | 59 // Binds the mojom::SystemTray interface to this object. |
| 56 void BindRequest(mojom::SystemTrayRequest request); | 60 void BindRequest(mojom::SystemTrayRequest request); |
| 57 | 61 |
| 58 private: | 62 private: |
| 59 // Connects or reconnects to the mojom::SystemTrayClient interface when | 63 // Connects or reconnects to the mojom::SystemTrayClient interface when |
| 60 // running on Chrome OS. Otherwise does nothing. Returns true if connected. | 64 // running on Chrome OS. Otherwise does nothing. Returns true if connected. |
| 61 bool ConnectToSystemTrayClient(); | 65 bool ConnectToSystemTrayClient(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 77 | 81 |
| 78 // The type of clock hour display: 12 or 24 hour. | 82 // The type of clock hour display: 12 or 24 hour. |
| 79 base::HourClockType hour_clock_type_; | 83 base::HourClockType hour_clock_type_; |
| 80 | 84 |
| 81 DISALLOW_COPY_AND_ASSIGN(SystemTrayController); | 85 DISALLOW_COPY_AND_ASSIGN(SystemTrayController); |
| 82 }; | 86 }; |
| 83 | 87 |
| 84 } // namspace ash | 88 } // namspace ash |
| 85 | 89 |
| 86 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_ | 90 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_ |
| OLD | NEW |