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

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: Addressed gab@'s comments. 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 055584a3402ff9e5ddc8f06a71b6c5235862713b..37951067f27e3d259b72302389071d76e1b01b98 100644
--- a/ash/common/system/tray/tray_details_view.cc
+++ b/ash/common/system/tray/tray_details_view.cc
@@ -15,6 +15,7 @@
#include "ash/common/system/tray/tray_popup_utils.h"
#include "ash/common/system/tray/tri_view.h"
#include "base/containers/adapters.h"
+#include "base/timer/timer.h"
#include "grit/ash_strings.h"
#include "third_party/skia/include/core/SkDrawLooper.h"
#include "ui/base/resource/resource_bundle.h"
@@ -455,18 +456,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