| 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 #include "ash/mus/system_tray_delegate_mus.h" | 5 #include "ash/mus/system_tray_delegate_mus.h" |
| 6 | 6 |
| 7 #include "ash/common/system/networking_config_delegate.h" |
| 7 #include "ash/common/system/tray/system_tray_notifier.h" | 8 #include "ash/common/system/tray/system_tray_notifier.h" |
| 8 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/mus/vpn_delegate_mus.h" |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 11 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
| 12 #include "base/logging.h" | 14 #include "base/logging.h" |
| 13 #include "services/shell/public/cpp/connector.h" | 15 #include "services/shell/public/cpp/connector.h" |
| 14 | 16 |
| 15 namespace ash { | 17 namespace ash { |
| 16 namespace { | 18 namespace { |
| 17 | 19 |
| 18 SystemTrayDelegateMus* g_instance = nullptr; | 20 SystemTrayDelegateMus* g_instance = nullptr; |
| 19 | 21 |
| 22 // TODO(mash): Provide a real implementation, perhaps by folding its behavior |
| 23 // into an ash-side network information cache. http://crbug.com/651157 |
| 24 class StubNetworkingConfigDelegate : public NetworkingConfigDelegate { |
| 25 public: |
| 26 StubNetworkingConfigDelegate() {} |
| 27 ~StubNetworkingConfigDelegate() override {} |
| 28 |
| 29 private: |
| 30 // NetworkingConfigDelegate: |
| 31 std::unique_ptr<const ExtensionInfo> LookUpExtensionForNetwork( |
| 32 const std::string& service_path) override { |
| 33 return nullptr; |
| 34 } |
| 35 |
| 36 DISALLOW_COPY_AND_ASSIGN(StubNetworkingConfigDelegate); |
| 37 }; |
| 38 |
| 20 } // namespace | 39 } // namespace |
| 21 | 40 |
| 22 SystemTrayDelegateMus::SystemTrayDelegateMus(shell::Connector* connector) | 41 SystemTrayDelegateMus::SystemTrayDelegateMus(shell::Connector* connector) |
| 23 : connector_(connector), hour_clock_type_(base::GetHourClockType()) { | 42 : connector_(connector), |
| 43 hour_clock_type_(base::GetHourClockType()), |
| 44 networking_config_delegate_(new StubNetworkingConfigDelegate), |
| 45 vpn_delegate_(new VPNDelegateMus) { |
| 24 // Don't make an initial connection to exe:chrome. Do it on demand. | 46 // Don't make an initial connection to exe:chrome. Do it on demand. |
| 25 DCHECK(!g_instance); | 47 DCHECK(!g_instance); |
| 26 g_instance = this; | 48 g_instance = this; |
| 27 } | 49 } |
| 28 | 50 |
| 29 SystemTrayDelegateMus::~SystemTrayDelegateMus() { | 51 SystemTrayDelegateMus::~SystemTrayDelegateMus() { |
| 30 DCHECK_EQ(this, g_instance); | 52 DCHECK_EQ(this, g_instance); |
| 31 g_instance = nullptr; | 53 g_instance = nullptr; |
| 32 } | 54 } |
| 33 | 55 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 139 |
| 118 void SystemTrayDelegateMus::ShowEnterpriseInfo() { | 140 void SystemTrayDelegateMus::ShowEnterpriseInfo() { |
| 119 // http://crbug.com/647412 | 141 // http://crbug.com/647412 |
| 120 NOTIMPLEMENTED(); | 142 NOTIMPLEMENTED(); |
| 121 } | 143 } |
| 122 | 144 |
| 123 void SystemTrayDelegateMus::ShowProxySettings() { | 145 void SystemTrayDelegateMus::ShowProxySettings() { |
| 124 ConnectToSystemTrayClient()->ShowProxySettings(); | 146 ConnectToSystemTrayClient()->ShowProxySettings(); |
| 125 } | 147 } |
| 126 | 148 |
| 149 NetworkingConfigDelegate* SystemTrayDelegateMus::GetNetworkingConfigDelegate() |
| 150 const { |
| 151 return networking_config_delegate_.get(); |
| 152 } |
| 153 |
| 154 VPNDelegate* SystemTrayDelegateMus::GetVPNDelegate() const { |
| 155 return vpn_delegate_.get(); |
| 156 } |
| 157 |
| 127 //////////////////////////////////////////////////////////////////////////////// | 158 //////////////////////////////////////////////////////////////////////////////// |
| 128 // mojom::SystemTray: | 159 // mojom::SystemTray: |
| 129 | 160 |
| 130 void SystemTrayDelegateMus::SetUse24HourClock(bool use_24_hour) { | 161 void SystemTrayDelegateMus::SetUse24HourClock(bool use_24_hour) { |
| 131 hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock; | 162 hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock; |
| 132 WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged(); | 163 WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged(); |
| 133 } | 164 } |
| 134 | 165 |
| 135 } // namespace ash | 166 } // namespace ash |
| OLD | NEW |