Commit 3a3d9e2a authored by jamescook's avatar jamescook Committed by Commit bot

mash: Migrate ShowSetTimeDialog from SystemTrayDelegate to mojo

This is part of the mustash refactoring of ash.

Migrate to the existing SystemTrayClient mojo interface.

BUG=647412
TEST=show time settings via system tray at the login screen

Review-Url: https://codereview.chromium.org/2438023004
Cr-Commit-Position: refs/heads/master@{#427104}
parent 33da1a91
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "ash/common/material_design/material_design_controller.h" #include "ash/common/material_design/material_design_controller.h"
#include "ash/common/system/tray/system_tray_controller.h" #include "ash/common/system/tray/system_tray_controller.h"
#include "ash/common/system/tray/system_tray_delegate.h"
#include "ash/common/system/tray/tray_constants.h" #include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_utils.h" #include "ash/common/system/tray/tray_utils.h"
#include "ash/common/wm_shell.h" #include "ash/common/wm_shell.h"
...@@ -198,7 +197,7 @@ bool DateView::PerformAction(const ui::Event& event) { ...@@ -198,7 +197,7 @@ bool DateView::PerformAction(const ui::Event& event) {
if (action_ == TrayDate::SHOW_DATE_SETTINGS) if (action_ == TrayDate::SHOW_DATE_SETTINGS)
WmShell::Get()->system_tray_controller()->ShowDateSettings(); WmShell::Get()->system_tray_controller()->ShowDateSettings();
else if (action_ == TrayDate::SET_SYSTEM_TIME) else if (action_ == TrayDate::SET_SYSTEM_TIME)
WmShell::Get()->system_tray_delegate()->ShowSetTimeDialog(); WmShell::Get()->system_tray_controller()->ShowSetTimeDialog();
else else
return false; return false;
CloseSystemBubble(); CloseSystemBubble();
......
...@@ -28,6 +28,11 @@ void SystemTrayController::ShowDateSettings() { ...@@ -28,6 +28,11 @@ void SystemTrayController::ShowDateSettings() {
system_tray_client_->ShowDateSettings(); system_tray_client_->ShowDateSettings();
} }
void SystemTrayController::ShowSetTimeDialog() {
if (ConnectToSystemTrayClient())
system_tray_client_->ShowSetTimeDialog();
}
void SystemTrayController::ShowDisplaySettings() { void SystemTrayController::ShowDisplaySettings() {
if (ConnectToSystemTrayClient()) if (ConnectToSystemTrayClient())
system_tray_client_->ShowDisplaySettings(); system_tray_client_->ShowDisplaySettings();
......
...@@ -42,6 +42,7 @@ class ASH_EXPORT SystemTrayController ...@@ -42,6 +42,7 @@ class ASH_EXPORT SystemTrayController
// Wrappers around the mojom::SystemTrayClient interface. // Wrappers around the mojom::SystemTrayClient interface.
void ShowSettings(); void ShowSettings();
void ShowDateSettings(); void ShowDateSettings();
void ShowSetTimeDialog();
void ShowDisplaySettings(); void ShowDisplaySettings();
void ShowPowerSettings(); void ShowPowerSettings();
void ShowChromeSlow(); void ShowChromeSlow();
......
...@@ -80,8 +80,6 @@ bool SystemTrayDelegate::ShouldShowSettings() { ...@@ -80,8 +80,6 @@ bool SystemTrayDelegate::ShouldShowSettings() {
return false; return false;
} }
void SystemTrayDelegate::ShowSetTimeDialog() {}
void SystemTrayDelegate::ShowEnterpriseInfo() {} void SystemTrayDelegate::ShowEnterpriseInfo() {}
void SystemTrayDelegate::ShowUserLogin() {} void SystemTrayDelegate::ShowUserLogin() {}
......
...@@ -149,9 +149,6 @@ class ASH_EXPORT SystemTrayDelegate { ...@@ -149,9 +149,6 @@ class ASH_EXPORT SystemTrayDelegate {
// Returns true if settings menu item should appear. // Returns true if settings menu item should appear.
virtual bool ShouldShowSettings(); virtual bool ShouldShowSettings();
// Shows the dialog to set system time, date, and timezone.
virtual void ShowSetTimeDialog();
// Shows information about enterprise enrolled devices. // Shows information about enterprise enrolled devices.
virtual void ShowEnterpriseInfo(); virtual void ShowEnterpriseInfo();
......
...@@ -20,7 +20,8 @@ interface SystemTrayClient { ...@@ -20,7 +20,8 @@ interface SystemTrayClient {
// Shows the settings related to date, timezone etc. // Shows the settings related to date, timezone etc.
ShowDateSettings(); ShowDateSettings();
// TODO(crbug.com/647412): ShowSetTimeDialog(); // Shows the dialog to set system time, date, and timezone.
ShowSetTimeDialog();
// Shows settings related to multiple displays. // Shows settings related to multiple displays.
ShowDisplaySettings(); ShowDisplaySettings();
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "chrome/browser/chromeos/accessibility/accessibility_util.h" #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/browser/chromeos/options/network_config_view.h" #include "chrome/browser/chromeos/options/network_config_view.h"
#include "chrome/browser/chromeos/set_time_dialog.h"
#include "chrome/browser/chromeos/system/system_clock.h" #include "chrome/browser/chromeos/system/system_clock.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/ash_util.h" #include "chrome/browser/ui/ash/ash_util.h"
...@@ -143,6 +144,10 @@ void SystemTrayClient::ShowDateSettings() { ...@@ -143,6 +144,10 @@ void SystemTrayClient::ShowDateSettings() {
sub_page); sub_page);
} }
void SystemTrayClient::ShowSetTimeDialog() {
chromeos::SetTimeDialog::ShowDialogInContainer(GetDialogParentContainerId());
}
void SystemTrayClient::ShowDisplaySettings() { void SystemTrayClient::ShowDisplaySettings() {
content::RecordAction(base::UserMetricsAction("ShowDisplayOptions")); content::RecordAction(base::UserMetricsAction("ShowDisplayOptions"));
ShowSettingsSubPageForActiveUser(kDisplaySettingsSubPageName); ShowSettingsSubPageForActiveUser(kDisplaySettingsSubPageName);
......
...@@ -35,6 +35,7 @@ class SystemTrayClient : public ash::mojom::SystemTrayClient, ...@@ -35,6 +35,7 @@ class SystemTrayClient : public ash::mojom::SystemTrayClient,
// ash::mojom::SystemTrayClient: // ash::mojom::SystemTrayClient:
void ShowSettings() override; void ShowSettings() override;
void ShowDateSettings() override; void ShowDateSettings() override;
void ShowSetTimeDialog() override;
void ShowDisplaySettings() override; void ShowDisplaySettings() override;
void ShowPowerSettings() override; void ShowPowerSettings() override;
void ShowChromeSlow() override; void ShowChromeSlow() override;
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
#include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
#include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/set_time_dialog.h"
#include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h"
#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/application_lifetime.h"
...@@ -348,12 +347,6 @@ bool SystemTrayDelegateChromeOS::ShouldShowSettings() { ...@@ -348,12 +347,6 @@ bool SystemTrayDelegateChromeOS::ShouldShowSettings() {
!wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen();
} }
void SystemTrayDelegateChromeOS::ShowSetTimeDialog() {
// TODO(mash): Move to SystemTrayClient.
SetTimeDialog::ShowDialogInContainer(
SystemTrayClient::GetDialogParentContainerId());
}
void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() { void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() {
// TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient. // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient.
ash::LoginStatus status = GetUserLoginStatus(); ash::LoginStatus status = GetUserLoginStatus();
......
...@@ -89,7 +89,6 @@ class SystemTrayDelegateChromeOS ...@@ -89,7 +89,6 @@ class SystemTrayDelegateChromeOS
bool IsUserChild() const override; bool IsUserChild() const override;
void GetSystemUpdateInfo(ash::UpdateInfo* info) const override; void GetSystemUpdateInfo(ash::UpdateInfo* info) const override;
bool ShouldShowSettings() override; bool ShouldShowSettings() override;
void ShowSetTimeDialog() override;
void ShowEnterpriseInfo() override; void ShowEnterpriseInfo() override;
void ShowUserLogin() override; void ShowUserLogin() override;
void SignOut() override; void SignOut() override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment