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/common/system/tray/system_tray_controller.h" | 5 #include "ash/common/system/tray/system_tray_controller.h" |
6 | 6 |
7 #include "ash/common/system/tray/system_tray_notifier.h" | 7 #include "ash/common/system/tray/system_tray_notifier.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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // Unit tests may not have a connector. | 90 // Unit tests may not have a connector. |
91 if (!connector_) | 91 if (!connector_) |
92 return false; | 92 return false; |
93 | 93 |
94 #if defined(OS_CHROMEOS) | 94 #if defined(OS_CHROMEOS) |
95 // If already connected, nothing to do. | 95 // If already connected, nothing to do. |
96 if (system_tray_client_.is_bound()) | 96 if (system_tray_client_.is_bound()) |
97 return true; | 97 return true; |
98 | 98 |
99 // Connect (or reconnect) to the interface. | 99 // Connect (or reconnect) to the interface. |
100 if (WmShell::Get()->IsRunningInMash()) | 100 if (WmShell::Get()->IsRunningInMash()) { |
101 connector_->ConnectToInterface("exe:chrome", &system_tray_client_); | 101 connector_->ConnectToInterface("exe:chrome", &system_tray_client_); |
102 else | 102 } else { |
103 connector_->ConnectToInterface("exe:content_browser", &system_tray_client_); | 103 connector_->ConnectToInterface("service:content_browser", |
| 104 &system_tray_client_); |
| 105 } |
104 | 106 |
105 // Handle chrome crashes by forcing a reconnect on the next request. | 107 // Handle chrome crashes by forcing a reconnect on the next request. |
106 system_tray_client_.set_connection_error_handler(base::Bind( | 108 system_tray_client_.set_connection_error_handler(base::Bind( |
107 &SystemTrayController::OnClientConnectionError, base::Unretained(this))); | 109 &SystemTrayController::OnClientConnectionError, base::Unretained(this))); |
108 return true; | 110 return true; |
109 #else | 111 #else |
110 // The SystemTrayClient interface in the browser is only implemented for | 112 // The SystemTrayClient interface in the browser is only implemented for |
111 // Chrome OS, so don't try to connect on other platforms. | 113 // Chrome OS, so don't try to connect on other platforms. |
112 return false; | 114 return false; |
113 #endif // defined(OS_CHROMEOS) | 115 #endif // defined(OS_CHROMEOS) |
114 } | 116 } |
115 | 117 |
116 void SystemTrayController::OnClientConnectionError() { | 118 void SystemTrayController::OnClientConnectionError() { |
117 system_tray_client_.reset(); | 119 system_tray_client_.reset(); |
118 } | 120 } |
119 | 121 |
120 void SystemTrayController::SetUse24HourClock(bool use_24_hour) { | 122 void SystemTrayController::SetUse24HourClock(bool use_24_hour) { |
121 hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock; | 123 hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock; |
122 WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged(); | 124 WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged(); |
123 } | 125 } |
124 | 126 |
125 } // namespace ash | 127 } // namespace ash |
OLD | NEW |