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 d6c6ea55df3c980096237ba8bc17f49042491925..e0904f881e7bc5b526e18f6f80bbd06f331d608b 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" |
@@ -399,18 +400,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); |
} |