| 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_controller_mus.h" | 5 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/browser_process_platform_part.h" | 8 #include "chrome/browser/browser_process_platform_part.h" |
| 9 #include "chrome/browser/chromeos/system/system_clock.h" | 9 #include "chrome/browser/chromeos/system/system_clock.h" |
| 10 #include "chrome/browser/ui/ash/system_tray_common.h" |
| 10 #include "content/public/common/mojo_shell_connection.h" | 11 #include "content/public/common/mojo_shell_connection.h" |
| 11 #include "services/shell/public/cpp/connector.h" | 12 #include "services/shell/public/cpp/connector.h" |
| 12 | 13 |
| 13 SystemTrayControllerMus::SystemTrayControllerMus() { | 14 SystemTrayClient::SystemTrayClient() : binding_(this) { |
| 15 // Connect to the mojo SystemTray service in ash. |
| 14 shell::Connector* connector = | 16 shell::Connector* connector = |
| 15 content::MojoShellConnection::GetForProcess()->GetConnector(); | 17 content::MojoShellConnection::GetForProcess()->GetConnector(); |
| 16 connector->ConnectToInterface("mojo:ash", &system_tray_); | 18 connector->ConnectToInterface("mojo:ash", &system_tray_); |
| 17 | 19 |
| 20 // Register this object as the SystemTrayClient interface implementation. |
| 21 system_tray_->SetClient(binding_.CreateInterfacePtrAndBind()); |
| 22 |
| 18 g_browser_process->platform_part()->GetSystemClock()->AddObserver(this); | 23 g_browser_process->platform_part()->GetSystemClock()->AddObserver(this); |
| 19 } | 24 } |
| 20 | 25 |
| 21 SystemTrayControllerMus::~SystemTrayControllerMus() { | 26 SystemTrayClient::~SystemTrayClient() { |
| 22 g_browser_process->platform_part()->GetSystemClock()->RemoveObserver(this); | 27 g_browser_process->platform_part()->GetSystemClock()->RemoveObserver(this); |
| 23 } | 28 } |
| 24 | 29 |
| 25 void SystemTrayControllerMus::OnSystemClockChanged( | 30 void SystemTrayClient::ShowDateSettings() { |
| 31 SystemTrayCommon::ShowDateSettings(); |
| 32 } |
| 33 |
| 34 void SystemTrayClient::OnSystemClockChanged( |
| 26 chromeos::system::SystemClock* clock) { | 35 chromeos::system::SystemClock* clock) { |
| 27 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); | 36 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); |
| 28 } | 37 } |
| OLD | NEW |