Commit 503056d3 authored by yoshiki iguchi's avatar yoshiki iguchi Committed by Commit Bot

Close Chrome OS message center on back key

This CL has DummyView handle a back key event and close the Chrome OS
message center if it opens. This fix is for ag/112017890.

Note that DummyView handles key events only when no other ARC window
is focused.

ARC-side: ag/4779503
Chromium-side: crrev.com/1175709

Bug: b/112017890
Test: Ran atest
Change-Id: If0603bd68f2ad4f482521e7cf3e698edb934183f
Reviewed-on: https://chromium-review.googlesource.com/1175709Reviewed-by: default avatarGreg Kerr <kerrnel@chromium.org>
Reviewed-by: default avatarEliot Courtney <edcourtney@chromium.org>
Commit-Queue: Yoshiki Iguchi <yoshiki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590044}
parent 31f68667
......@@ -55,4 +55,20 @@ void ArcNotificationManagerDelegateImpl::ShowMessageCenter() {
}
}
void ArcNotificationManagerDelegateImpl::HideMessageCenter() {
// Close the message center on all the displays.
for (auto* root_window_controller :
RootWindowController::root_window_controllers()) {
if (features::IsSystemTrayUnifiedEnabled()) {
root_window_controller->GetStatusAreaWidget()
->unified_system_tray()
->CloseBubble();
} else {
root_window_controller->GetStatusAreaWidget()
->notification_tray()
->ShowMessageCenter(false /* show_by_click */);
}
}
}
} // namespace ash
......@@ -21,6 +21,7 @@ class ArcNotificationManagerDelegateImpl
void GetAppIdByPackageName(const std::string& package_name,
GetAppIdByPackageNameCallback callback) override;
void ShowMessageCenter() override;
void HideMessageCenter() override;
private:
DISALLOW_COPY_AND_ASSIGN(ArcNotificationManagerDelegateImpl);
......
......@@ -229,6 +229,10 @@ void ArcNotificationManager::OpenMessageCenter() {
delegate_->ShowMessageCenter();
}
void ArcNotificationManager::CloseMessageCenter() {
delegate_->HideMessageCenter();
}
void ArcNotificationManager::OnNotificationRemoved(const std::string& key) {
auto it = items_.find(key);
if (it == items_.end()) {
......
......@@ -51,6 +51,7 @@ class ArcNotificationManager
void OnNotificationUpdated(arc::mojom::ArcNotificationDataPtr data) override;
void OnNotificationRemoved(const std::string& key) override;
void OpenMessageCenter() override;
void CloseMessageCenter() override;
void OnDoNotDisturbStatusUpdated(
arc::mojom::ArcDoNotDisturbStatusPtr status) override;
......
......@@ -28,6 +28,9 @@ class ArcNotificationManagerDelegate {
// Shows the message center.
virtual void ShowMessageCenter() = 0;
// Hides the message center.
virtual void HideMessageCenter() = 0;
};
} // namespace ash
......
......@@ -85,6 +85,7 @@ class FakeArcNotificationManagerDelegate
std::move(callback).Run(std::string());
}
void ShowMessageCenter() override {}
void HideMessageCenter() override {}
private:
DISALLOW_COPY_AND_ASSIGN(FakeArcNotificationManagerDelegate);
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Next MinVersion: 20
// Next MinVersion: 21
module arc.mojom;
......@@ -161,7 +161,7 @@ struct ArcDoNotDisturbStatus {
bool enabled;
};
// Next Method ID: 8
// Next Method ID: 9
interface NotificationsHost {
// Set the Do-Not-Disturb status on Chrome side from Android side.
[MinVersion=18]
......@@ -184,6 +184,10 @@ interface NotificationsHost {
[MinVersion=16]
// Opens the Chrome OS message center.
OpenMessageCenter@6();
[MinVersion=20]
// Closes the Chrome OS message center.
CloseMessageCenter@8();
};
// Next Method ID: 9
......
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