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

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: Merge branch 'master' into system_menu_transition_animation 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 7f9a9bc53b7f0bc7e3b667e22d40b879ef2058d7..9748571095697ab70fea90d4d0625dd4c7e0216c 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"
@@ -469,18 +470,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