Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: ash/common/system/tray/system_tray_controller.h

Issue 2381753002: Use mojo SystemTray interfaces for both mash and classic ash (Closed)
Patch Set: cleanup Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/public/interfaces/system_tray.mojom.h"
9 #include "base/i18n/time_formatting.h"
10 #include "base/macros.h"
11 #include "base/observer_list.h"
12
13 namespace shell {
14 class Connector;
15 }
16
17 namespace ash {
18
19 class ClockObserver;
20
21 // Allows control of the system tray the mojom::SystemTray interface. Provides
22 // caching of state pushed down from chrome browser. Provides a wrapper around
23 // the mojom::SystemTrayClient interface that handles retries.
24 //
25 // TODO: What about tests? How would you mock one of these?
26 //
27 // TODO: Delete SystemTrayDelegateMus
28 // This would be called "SystemTray" but we already have one of those.
29 class SystemTrayController : public mojom::SystemTray {
30 public:
31 explicit SystemTrayController(shell::Connector* connector);
32 ~SystemTrayController() override;
33
34 // REVIEWERS: Methods migrated from SystemTrayDelegate.
35 base::HourClockType GetHourClockType() const;
36 void ShowDateSettings();
37
38 // TODO: Migrate other observers from SystemTrayNotifier.
39 void AddClockObserver(ClockObserver* observer);
40 void RemoveClockObserver(ClockObserver* observer);
41
42 private:
43 // Connects or reconnects to the mojom::SystemTrayClient interface and returns
44 // the interface pointer.
45 mojom::SystemTrayClient* ConnectToSystemTrayClient();
46
47 // Handles errors on the |system_tray_client_| interface connection.
48 void OnClientConnectionError();
49
50 // mojom::SystemTray:
51 void SetUse24HourClock(bool use_24_hour) override;
52
53 // May be null in unit tests.
54 shell::Connector* connector_;
55
56 // Client interface in chrome browser.
57 mojom::SystemTrayClientPtr system_tray_client_;
58
59 // 12 or 24 hour display.
60 base::HourClockType hour_clock_type_;
61
62 base::ObserverList<ClockObserver> clock_observers_;
63
64 DISALLOW_COPY_AND_ASSIGN(SystemTrayController);
65 };
66
67 } // namspace ash
68
69 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698