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 "chrome/browser/ui/ash/system_tray_client.h" | 5 #include "chrome/browser/ui/ash/system_tray_client.h" |
6 | 6 |
7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 void SystemTrayClient::OnSystemClockChanged( | 181 void SystemTrayClient::OnSystemClockChanged( |
182 chromeos::system::SystemClock* clock) { | 182 chromeos::system::SystemClock* clock) { |
183 ConnectToSystemTray(); | 183 ConnectToSystemTray(); |
184 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); | 184 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); |
185 } | 185 } |
186 | 186 |
187 void SystemTrayClient::ConnectToSystemTray() { | 187 void SystemTrayClient::ConnectToSystemTray() { |
188 if (system_tray_.is_bound()) | 188 if (system_tray_.is_bound()) |
189 return; | 189 return; |
190 | 190 |
191 shell::Connector* connector = | 191 service_manager::Connector* connector = |
192 content::ServiceManagerConnection::GetForProcess()->GetConnector(); | 192 content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
193 // Under mash the SystemTray interface is in the ash process. In classic ash | 193 // Under mash the SystemTray interface is in the ash process. In classic ash |
194 // we provide it to ourself. | 194 // we provide it to ourself. |
195 if (chrome::IsRunningInMash()) | 195 if (chrome::IsRunningInMash()) |
196 connector->ConnectToInterface("service:ash", &system_tray_); | 196 connector->ConnectToInterface("service:ash", &system_tray_); |
197 else | 197 else |
198 connector->ConnectToInterface("service:content_browser", &system_tray_); | 198 connector->ConnectToInterface("service:content_browser", &system_tray_); |
199 | 199 |
200 // Tolerate ash crashing and coming back up. | 200 // Tolerate ash crashing and coming back up. |
201 system_tray_.set_connection_error_handler(base::Bind( | 201 system_tray_.set_connection_error_handler(base::Bind( |
202 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); | 202 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); |
203 } | 203 } |
204 | 204 |
205 void SystemTrayClient::OnClientConnectionError() { | 205 void SystemTrayClient::OnClientConnectionError() { |
206 system_tray_.reset(); | 206 system_tray_.reset(); |
207 } | 207 } |
OLD | NEW |