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

Side by Side Diff: ash/mus/system_tray_delegate_mus.h

Issue 2360143004: mash: Add SystemTrayClient interface, use to show date settings (Closed)
Patch Set: format 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
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_MUS_SYSTEM_TRAY_DELEGATE_MUS_H_ 5 #ifndef ASH_MUS_SYSTEM_TRAY_DELEGATE_MUS_H_
6 #define ASH_MUS_SYSTEM_TRAY_DELEGATE_MUS_H_ 6 #define ASH_MUS_SYSTEM_TRAY_DELEGATE_MUS_H_
7 7
8 #include "ash/common/system/tray/default_system_tray_delegate.h" 8 #include "ash/common/system/tray/default_system_tray_delegate.h"
9 #include "ash/public/interfaces/system_tray.mojom.h" 9 #include "ash/public/interfaces/system_tray.mojom.h"
10 #include "base/i18n/time_formatting.h" 10 #include "base/i18n/time_formatting.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 12
13 namespace shell {
14 class Connector;
15 }
16
13 namespace ash { 17 namespace ash {
14 18
15 // Handles the settings displayed in the system tray menu. For mus most settings 19 // Handles the settings displayed in the system tray menu. For mus most settings
16 // are obtained from chrome browser via mojo IPC. For the classic ash version 20 // are obtained from chrome browser via mojo IPC. For the classic ash version
17 // see SystemTrayDelegateChromeOS. 21 // see SystemTrayDelegateChromeOS.
18 // 22 //
19 // TODO: Support all methods in SystemTrayDelegate. http://crbug.com/647412. 23 // TODO: Support all methods in SystemTrayDelegate. http://crbug.com/647412.
20 class SystemTrayDelegateMus : public DefaultSystemTrayDelegate, 24 class SystemTrayDelegateMus : public DefaultSystemTrayDelegate,
21 public mojom::SystemTray { 25 public mojom::SystemTray {
22 public: 26 public:
23 SystemTrayDelegateMus(); 27 explicit SystemTrayDelegateMus(shell::Connector* connector);
24 ~SystemTrayDelegateMus() override; 28 ~SystemTrayDelegateMus() override;
25 29
26 static SystemTrayDelegateMus* Get(); 30 static SystemTrayDelegateMus* Get();
27 31
28 private: 32 private:
33 // Connects or reconnects the |system_tray_client_| interface.
34 void ConnectToSystemTrayClient();
35
36 // Handles errors on the |system_tray_client_| interface connection.
37 void OnClientConnectionError();
38
29 // SystemTrayDelegate: 39 // SystemTrayDelegate:
30 base::HourClockType GetHourClockType() const override; 40 base::HourClockType GetHourClockType() const override;
41 void ShowDateSettings() override;
31 42
32 // mojom::SystemTray: 43 // mojom::SystemTray:
33 void SetUse24HourClock(bool use_24_hour) override; 44 void SetUse24HourClock(bool use_24_hour) override;
34 45
46 shell::Connector* connector_;
47
48 // Client interface in chrome browser.
49 mojom::SystemTrayClientPtr system_tray_client_;
50
35 // 12 or 24 hour display. 51 // 12 or 24 hour display.
36 base::HourClockType hour_clock_type_; 52 base::HourClockType hour_clock_type_;
37 53
54 // Message loop may spin after this object is deleted during shutdown.
55 base::WeakPtrFactory<SystemTrayDelegateMus> weak_factory_;
56
38 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateMus); 57 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateMus);
39 }; 58 };
40 59
41 } // namespace ash 60 } // namespace ash
42 61
43 #endif // ASH_MUS_SYSTEM_TRAY_DELEGATE_MUS_H_ 62 #endif // ASH_MUS_SYSTEM_TRAY_DELEGATE_MUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698