OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_ | |
6 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "ash/public/interfaces/system_tray.mojom.h" | |
10 #include "base/compiler_specific.h" | |
11 #include "base/i18n/time_formatting.h" | |
12 #include "base/macros.h" | |
13 #include "mojo/public/cpp/bindings/binding_set.h" | |
14 | |
15 namespace ash { | |
16 | |
17 // Both implements mojom::SystemTray and wraps the mojom::SystemTrayClient | |
18 // interface. Implements both because it caches state pushed down from the | |
19 // browser process via SystemTray so it can be synchronously queried inside ash. | |
20 // | |
21 // Conceptually similar to historical ash-to-chrome interfaces like | |
22 // SystemTrayDelegate. Lives on the main thread. | |
23 // | |
24 // TODO: Consider renaming this to SystemTrayClient or renaming the current | |
25 // SystemTray to SystemTrayView and making this class SystemTray. | |
26 class ASH_EXPORT SystemTrayController | |
27 : NON_EXPORTED_BASE(public mojom::SystemTray) { | |
28 public: | |
29 SystemTrayController(); | |
30 ~SystemTrayController() override; | |
31 | |
32 base::HourClockType hour_clock_type() const { return hour_clock_type_; } | |
33 | |
34 // Wrappers around the mojom::SystemTrayClient interface. | |
35 void ShowSettings(); | |
36 void ShowDateSettings(); | |
37 void ShowSetTimeDialog(); | |
38 void ShowDisplaySettings(); | |
39 void ShowPowerSettings(); | |
40 void ShowChromeSlow(); | |
41 void ShowIMESettings(); | |
42 void ShowHelp(); | |
43 void ShowAccessibilityHelp(); | |
44 void ShowAccessibilitySettings(); | |
45 void ShowPaletteHelp(); | |
46 void ShowPaletteSettings(); | |
47 void ShowPublicAccountInfo(); | |
48 void ShowNetworkConfigure(const std::string& network_id); | |
49 void ShowNetworkCreate(const std::string& type); | |
50 void ShowThirdPartyVpnCreate(const std::string& extension_id); | |
51 void ShowNetworkSettings(const std::string& network_id); | |
52 void ShowProxySettings(); | |
53 void SignOut(); | |
54 void RequestRestartForUpdate(); | |
55 | |
56 // Binds the mojom::SystemTray interface to this object. | |
57 void BindRequest(mojom::SystemTrayRequest request); | |
58 | |
59 // mojom::SystemTray overrides. Public for testing. | |
60 void SetClient(mojom::SystemTrayClientPtr client) override; | |
61 void SetPrimaryTrayEnabled(bool enabled) override; | |
62 void SetPrimaryTrayVisible(bool visible) override; | |
63 void SetUse24HourClock(bool use_24_hour) override; | |
64 void ShowUpdateIcon(mojom::UpdateSeverity severity, | |
65 bool factory_reset_required) override; | |
66 | |
67 private: | |
68 // Client interface in chrome browser. Only bound on Chrome OS. | |
69 mojom::SystemTrayClientPtr system_tray_client_; | |
70 | |
71 // Bindings for the SystemTray interface. | |
72 mojo::BindingSet<mojom::SystemTray> bindings_; | |
73 | |
74 // The type of clock hour display: 12 or 24 hour. | |
75 base::HourClockType hour_clock_type_; | |
76 | |
77 DISALLOW_COPY_AND_ASSIGN(SystemTrayController); | |
78 }; | |
79 | |
80 } // namspace ash | |
81 | |
82 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_ | |
OLD | NEW |