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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 void SystemTrayClient::ConnectToSystemTray() { | 69 void SystemTrayClient::ConnectToSystemTray() { |
70 if (system_tray_.is_bound()) | 70 if (system_tray_.is_bound()) |
71 return; | 71 return; |
72 | 72 |
73 shell::Connector* connector = | 73 shell::Connector* connector = |
74 content::MojoShellConnection::GetForProcess()->GetConnector(); | 74 content::MojoShellConnection::GetForProcess()->GetConnector(); |
75 // Under mash the SystemTray interface is in the ash process. In classic ash | 75 // Under mash the SystemTray interface is in the ash process. In classic ash |
76 // we provide it to ourself. | 76 // we provide it to ourself. |
77 if (chrome::IsRunningInMash()) | 77 if (chrome::IsRunningInMash()) |
78 connector->ConnectToInterface("mojo:ash", &system_tray_); | 78 connector->ConnectToInterface("service:ash", &system_tray_); |
79 else | 79 else |
80 connector->ConnectToInterface("exe:content_browser", &system_tray_); | 80 connector->ConnectToInterface("service:content_browser", &system_tray_); |
81 | 81 |
82 // Tolerate ash crashing and coming back up. | 82 // Tolerate ash crashing and coming back up. |
83 system_tray_.set_connection_error_handler(base::Bind( | 83 system_tray_.set_connection_error_handler(base::Bind( |
84 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); | 84 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); |
85 } | 85 } |
86 | 86 |
87 void SystemTrayClient::OnClientConnectionError() { | 87 void SystemTrayClient::OnClientConnectionError() { |
88 system_tray_.reset(); | 88 system_tray_.reset(); |
89 } | 89 } |
90 | 90 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
173 | 173 |
174 //////////////////////////////////////////////////////////////////////////////// | 174 //////////////////////////////////////////////////////////////////////////////// |
175 // chromeos::system::SystemClockObserver: | 175 // chromeos::system::SystemClockObserver: |
176 | 176 |
177 void SystemTrayClient::OnSystemClockChanged( | 177 void SystemTrayClient::OnSystemClockChanged( |
178 chromeos::system::SystemClock* clock) { | 178 chromeos::system::SystemClock* clock) { |
179 ConnectToSystemTray(); | 179 ConnectToSystemTray(); |
180 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); | 180 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); |
181 } | 181 } |
OLD | NEW |