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

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

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

Powered by Google App Engine
This is Rietveld 408576698