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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/browser_process_platform_part.h" | 13 #include "chrome/browser/browser_process_platform_part.h" |
14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
15 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 15 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
16 #include "chrome/browser/chromeos/system/system_clock.h" | 16 #include "chrome/browser/chromeos/system/system_clock.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
18 #include "chrome/browser/ui/ash/ash_util.h" | 18 #include "chrome/browser/ui/ash/ash_util.h" |
19 #include "chrome/browser/ui/chrome_pages.h" | 19 #include "chrome/browser/ui/chrome_pages.h" |
20 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 20 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
21 #include "chrome/browser/ui/singleton_tabs.h" | 21 #include "chrome/browser/ui/singleton_tabs.h" |
22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
23 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
24 #include "chromeos/login/login_state.h" | 24 #include "chromeos/login/login_state.h" |
25 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
26 #include "content/public/common/mojo_shell_connection.h" | 26 #include "content/public/common/service_manager_connection.h" |
27 #include "net/base/escape.h" | 27 #include "net/base/escape.h" |
28 #include "services/shell/public/cpp/connector.h" | 28 #include "services/shell/public/cpp/connector.h" |
29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
30 | 30 |
31 using chromeos::LoginState; | 31 using chromeos::LoginState; |
32 | 32 |
33 namespace { | 33 namespace { |
34 | 34 |
35 const char kPaletteSettingsSubPageName[] = "stylus-overlay"; | 35 const char kPaletteSettingsSubPageName[] = "stylus-overlay"; |
36 | 36 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 chromeos::system::SystemClock* clock) { | 176 chromeos::system::SystemClock* clock) { |
177 ConnectToSystemTray(); | 177 ConnectToSystemTray(); |
178 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); | 178 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); |
179 } | 179 } |
180 | 180 |
181 void SystemTrayClient::ConnectToSystemTray() { | 181 void SystemTrayClient::ConnectToSystemTray() { |
182 if (system_tray_.is_bound()) | 182 if (system_tray_.is_bound()) |
183 return; | 183 return; |
184 | 184 |
185 shell::Connector* connector = | 185 shell::Connector* connector = |
186 content::MojoShellConnection::GetForProcess()->GetConnector(); | 186 content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
187 // Under mash the SystemTray interface is in the ash process. In classic ash | 187 // Under mash the SystemTray interface is in the ash process. In classic ash |
188 // we provide it to ourself. | 188 // we provide it to ourself. |
189 if (chrome::IsRunningInMash()) | 189 if (chrome::IsRunningInMash()) |
190 connector->ConnectToInterface("service:ash", &system_tray_); | 190 connector->ConnectToInterface("service:ash", &system_tray_); |
191 else | 191 else |
192 connector->ConnectToInterface("service:content_browser", &system_tray_); | 192 connector->ConnectToInterface("service:content_browser", &system_tray_); |
193 | 193 |
194 // Tolerate ash crashing and coming back up. | 194 // Tolerate ash crashing and coming back up. |
195 system_tray_.set_connection_error_handler(base::Bind( | 195 system_tray_.set_connection_error_handler(base::Bind( |
196 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); | 196 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); |
197 } | 197 } |
198 | 198 |
199 void SystemTrayClient::OnClientConnectionError() { | 199 void SystemTrayClient::OnClientConnectionError() { |
200 system_tray_.reset(); | 200 system_tray_.reset(); |
201 } | 201 } |
OLD | NEW |