1 // Copyright 2018 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_SYSTEM_MODEL_SYSTEM_TRAY_MODEL_H_
6 #define ASH_SYSTEM_MODEL_SYSTEM_TRAY_MODEL_H_
7 
8 #include <memory>
9 
10 #include "ash/public/cpp/system_tray.h"
11 #include "base/macros.h"
12 
13 namespace ash {
14 
15 class ActiveNetworkIcon;
16 class ClockModel;
17 class EnterpriseDomainModel;
18 class LocaleModel;
19 class SessionLengthLimitModel;
20 class SystemTrayClient;
21 class TracingModel;
22 class TrayNetworkStateModel;
23 class UpdateModel;
24 class VirtualKeyboardModel;
25 
26 // Top level model of SystemTray.
27 class SystemTrayModel : public SystemTray {
28  public:
29   SystemTrayModel();
30   ~SystemTrayModel() override;
31 
32   // SystemTray:
33   void SetClient(SystemTrayClient* client) override;
34   void SetPrimaryTrayEnabled(bool enabled) override;
35   void SetPrimaryTrayVisible(bool visible) override;
36   void SetUse24HourClock(bool use_24_hour) override;
37   void SetEnterpriseDomainInfo(const std::string& enterprise_domain_manager,
38                                bool active_directory_managed) override;
39   void SetPerformanceTracingIconVisible(bool visible) override;
40   void SetLocaleList(std::vector<LocaleInfo> locale_list,
41                      const std::string& current_locale_iso_code) override;
42   void ShowUpdateIcon(UpdateSeverity severity,
43                       bool factory_reset_required,
44                       bool rollback,
45                       UpdateType update_type) override;
46   void SetUpdateNotificationState(
47       NotificationStyle style,
48       const base::string16& notification_title,
49       const base::string16& notification_body) override;
50   void SetUpdateOverCellularAvailableIconVisible(bool visible) override;
51   void ShowVolumeSliderBubble() override;
52   void ShowNetworkDetailedViewBubble(bool show_by_click) override;
53   void SetPhoneHubManager(
54       chromeos::phonehub::PhoneHubManager* phone_hub_manager) override;
55 
clock()56   ClockModel* clock() { return clock_.get(); }
enterprise_domain()57   EnterpriseDomainModel* enterprise_domain() {
58     return enterprise_domain_.get();
59   }
locale()60   LocaleModel* locale() { return locale_.get(); }
session_length_limit()61   SessionLengthLimitModel* session_length_limit() {
62     return session_length_limit_.get();
63   }
tracing()64   TracingModel* tracing() { return tracing_.get(); }
update_model()65   UpdateModel* update_model() { return update_model_.get(); }
virtual_keyboard()66   VirtualKeyboardModel* virtual_keyboard() { return virtual_keyboard_.get(); }
network_state_model()67   TrayNetworkStateModel* network_state_model() {
68     return network_state_model_.get();
69   }
active_network_icon()70   ActiveNetworkIcon* active_network_icon() {
71     return active_network_icon_.get();
72   }
client()73   SystemTrayClient* client() { return client_; }
74 
75  private:
76   std::unique_ptr<ClockModel> clock_;
77   std::unique_ptr<EnterpriseDomainModel> enterprise_domain_;
78   std::unique_ptr<LocaleModel> locale_;
79   std::unique_ptr<SessionLengthLimitModel> session_length_limit_;
80   std::unique_ptr<TracingModel> tracing_;
81   std::unique_ptr<UpdateModel> update_model_;
82   std::unique_ptr<VirtualKeyboardModel> virtual_keyboard_;
83   std::unique_ptr<TrayNetworkStateModel> network_state_model_;
84   std::unique_ptr<ActiveNetworkIcon> active_network_icon_;
85 
86   // TODO(tetsui): Add following as a sub-model of SystemTrayModel:
87   // * BluetoothModel
88 
89   // Client interface in chrome browser. May be null in tests.
90   SystemTrayClient* client_ = nullptr;
91 
92   DISALLOW_COPY_AND_ASSIGN(SystemTrayModel);
93 };
94 
95 }  // namespace ash
96 
97 #endif  // ASH_SYSTEM_MODEL_SYSTEM_TRAY_MODEL_H_
98