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

Unified Diff: ash/common/system/tray/tray_details_view.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/tray_details_view.cc
diff --git a/ash/common/system/tray/tray_details_view.cc b/ash/common/system/tray/tray_details_view.cc
index 9ca7fafd1f6a6578666e87fa161057232dcda5b3..cce297039157698e004ff39d9a2544127af2bdde 100644
--- a/ash/common/system/tray/tray_details_view.cc
+++ b/ash/common/system/tray/tray_details_view.cc
@@ -11,6 +11,7 @@
#include "ash/common/system/tray/system_tray_item.h"
#include "ash/common/system/tray/tray_constants.h"
#include "base/containers/adapters.h"
+#include "base/timer/timer.h"
#include "third_party/skia/include/core/SkDrawLooper.h"
#include "ui/compositor/paint_context.h"
#include "ui/compositor/paint_recorder.h"
@@ -384,18 +385,37 @@ void TrayDetailsView::HandleButtonPressed(views::Button* sender,
void TrayDetailsView::CreateExtraTitleRowButtons() {}
void TrayDetailsView::TransitionToDefaultView() {
- // Cache pointer to owner in this function scope. TrayDetailsView will be
- // deleted after called ShowDefaultView.
- SystemTrayItem* owner = owner_;
if (UseMd()) {
if (back_button_ && back_button_->HasFocus())
- owner->set_restore_focus(true);
+ owner_->set_restore_focus(true);
} else {
if (title_row_ && title_row_->content() &&
title_row_->content()->HasFocus()) {
- owner->set_restore_focus(true);
+ owner_->set_restore_focus(true);
}
+ DoTransitionToDefaultView();
+ return;
+ }
+
+ const int transition_delay =
+ GetTrayConstant(TRAY_POPUP_TRANSITION_TO_DEFAULT_DELAY);
+ if (transition_delay <= 0) {
+ DoTransitionToDefaultView();
+ return;
}
+
+ transition_delay_timer_.reset(new base::OneShotTimer());
+ transition_delay_timer_->Start(
+ FROM_HERE, base::TimeDelta::FromMilliseconds(transition_delay), this,
+ &TrayDetailsView::DoTransitionToDefaultView);
+}
+
+void TrayDetailsView::DoTransitionToDefaultView() {
+ transition_delay_timer_.reset();
+
+ // Cache pointer to owner in this function scope. TrayDetailsView will be
+ // deleted after called ShowDefaultView.
+ SystemTrayItem* owner = owner_;
owner->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
owner->set_restore_focus(false);
}

Powered by Google App Engine
This is Rietveld 408576698