| 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/login_status.h" | 7 #include "ash/common/login_status.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/browser_process_platform_part.h" | 16 #include "chrome/browser/browser_process_platform_part.h" |
| 17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 18 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 18 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 19 #include "chrome/browser/chromeos/options/network_config_view.h" | 19 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 20 #include "chrome/browser/chromeos/set_time_dialog.h" | 20 #include "chrome/browser/chromeos/set_time_dialog.h" |
| 21 #include "chrome/browser/chromeos/system/system_clock.h" | 21 #include "chrome/browser/chromeos/system/system_clock.h" |
| 22 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" | 22 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" |
| 23 #include "chrome/browser/lifetime/application_lifetime.h" |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
| 24 #include "chrome/browser/ui/ash/ash_util.h" | 25 #include "chrome/browser/ui/ash/ash_util.h" |
| 25 #include "chrome/browser/ui/chrome_pages.h" | 26 #include "chrome/browser/ui/chrome_pages.h" |
| 26 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 27 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 27 #include "chrome/browser/ui/singleton_tabs.h" | 28 #include "chrome/browser/ui/singleton_tabs.h" |
| 28 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
| 29 #include "chromeos/dbus/dbus_thread_manager.h" | 30 #include "chromeos/dbus/dbus_thread_manager.h" |
| 30 #include "chromeos/dbus/session_manager_client.h" | 31 #include "chromeos/dbus/session_manager_client.h" |
| 31 #include "chromeos/login/login_state.h" | 32 #include "chromeos/login/login_state.h" |
| 32 #include "content/public/browser/user_metrics.h" | 33 #include "content/public/browser/user_metrics.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 271 } |
| 271 | 272 |
| 272 void SystemTrayClient::ShowProxySettings() { | 273 void SystemTrayClient::ShowProxySettings() { |
| 273 LoginState* login_state = LoginState::Get(); | 274 LoginState* login_state = LoginState::Get(); |
| 274 // User is not logged in. | 275 // User is not logged in. |
| 275 CHECK(!login_state->IsUserLoggedIn() || | 276 CHECK(!login_state->IsUserLoggedIn() || |
| 276 login_state->GetLoggedInUserType() == LoginState::LOGGED_IN_USER_NONE); | 277 login_state->GetLoggedInUserType() == LoginState::LOGGED_IN_USER_NONE); |
| 277 chromeos::LoginDisplayHost::default_host()->OpenProxySettings(); | 278 chromeos::LoginDisplayHost::default_host()->OpenProxySettings(); |
| 278 } | 279 } |
| 279 | 280 |
| 281 void SystemTrayClient::SignOut() { |
| 282 chrome::AttemptUserExit(); |
| 283 } |
| 284 |
| 285 void SystemTrayClient::RequestRestartForUpdate() { |
| 286 // We expect that UpdateEngine is in "Reboot for update" state now. |
| 287 chrome::NotifyAndTerminate(true /* fast_path */); |
| 288 } |
| 289 |
| 280 //////////////////////////////////////////////////////////////////////////////// | 290 //////////////////////////////////////////////////////////////////////////////// |
| 281 // chromeos::system::SystemClockObserver: | 291 // chromeos::system::SystemClockObserver: |
| 282 | 292 |
| 283 void SystemTrayClient::OnSystemClockChanged( | 293 void SystemTrayClient::OnSystemClockChanged( |
| 284 chromeos::system::SystemClock* clock) { | 294 chromeos::system::SystemClock* clock) { |
| 285 ConnectToSystemTray(); | 295 ConnectToSystemTray(); |
| 286 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); | 296 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); |
| 287 } | 297 } |
| 288 | 298 |
| 289 void SystemTrayClient::ConnectToSystemTray() { | 299 void SystemTrayClient::ConnectToSystemTray() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 300 connector->ConnectToInterface("service:content_browser", &system_tray_); | 310 connector->ConnectToInterface("service:content_browser", &system_tray_); |
| 301 | 311 |
| 302 // Tolerate ash crashing and coming back up. | 312 // Tolerate ash crashing and coming back up. |
| 303 system_tray_.set_connection_error_handler(base::Bind( | 313 system_tray_.set_connection_error_handler(base::Bind( |
| 304 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); | 314 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); |
| 305 } | 315 } |
| 306 | 316 |
| 307 void SystemTrayClient::OnClientConnectionError() { | 317 void SystemTrayClient::OnClientConnectionError() { |
| 308 system_tray_.reset(); | 318 system_tray_.reset(); |
| 309 } | 319 } |
| OLD | NEW |