Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1000)

Unified Diff: ash/common/system/tray/system_tray_item.cc

Issue 2494943005: [ash-md] Added a delay between system menu default/detailed view transitions. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/common/system/tray/system_tray_item.cc
diff --git a/ash/common/system/tray/system_tray_item.cc b/ash/common/system/tray/system_tray_item.cc
index e1e579851dca95457f1de8b0f8d7c172d3e0ff4f..e128949d72fd5add753906fd0f2a112103a7a95c 100644
--- a/ash/common/system/tray/system_tray_item.cc
+++ b/ash/common/system/tray/system_tray_item.cc
@@ -6,6 +6,8 @@
#include "ash/common/system/tray/system_tray.h"
#include "ash/common/system/tray/system_tray_delegate.h"
+#include "ash/common/system/tray/tray_constants.h"
+#include "base/timer/timer.h"
#include "ui/views/view.h"
namespace ash {
@@ -40,7 +42,16 @@ void SystemTrayItem::DestroyDetailedView() {}
void SystemTrayItem::DestroyNotificationView() {}
void SystemTrayItem::TransitionDetailedView() {
- system_tray()->ShowDetailedView(this, 0, true, BUBBLE_USE_EXISTING);
+ const int transition_delay =
+ GetTrayConstant(TRAY_POPUP_TRANSITION_TO_DETAILED_DELAY);
+ if (transition_delay <= 0) {
+ DoTransitionToDetailedView();
+ return;
+ }
+ transition_delay_timer_.reset(new base::OneShotTimer());
+ transition_delay_timer_->Start(
+ FROM_HERE, base::TimeDelta::FromMilliseconds(transition_delay), this,
+ &SystemTrayItem::DoTransitionToDetailedView);
}
void SystemTrayItem::UpdateAfterLoginStatusChange(LoginStatus status) {}
@@ -77,4 +88,9 @@ bool SystemTrayItem::ShouldShowShelf() const {
return true;
}
+void SystemTrayItem::DoTransitionToDetailedView() {
+ transition_delay_timer_.reset();
+ system_tray()->ShowDetailedView(this, 0, true, BUBBLE_USE_EXISTING);
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698