Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/system/tray/tray_details_view.h" | 5 #include "ash/common/system/tray/tray_details_view.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_view_ids.h" | 7 #include "ash/common/ash_view_ids.h" |
| 8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
| 9 #include "ash/common/system/tray/system_menu_button.h" | 9 #include "ash/common/system/tray/system_menu_button.h" |
| 10 #include "ash/common/system/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
| 11 #include "ash/common/system/tray/system_tray_item.h" | 11 #include "ash/common/system/tray/system_tray_item.h" |
| 12 #include "ash/common/system/tray/tray_constants.h" | 12 #include "ash/common/system/tray/tray_constants.h" |
| 13 #include "ash/common/system/tray/tray_popup_item_style.h" | 13 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 14 #include "ash/common/system/tray/tray_popup_utils.h" | 14 #include "ash/common/system/tray/tray_popup_utils.h" |
| 15 #include "ash/common/system/tray/tri_view.h" | 15 #include "ash/common/system/tray/tri_view.h" |
| 16 #include "base/containers/adapters.h" | 16 #include "base/containers/adapters.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/timer/timer.h" | |
| 19 #include "grit/ash_strings.h" | 18 #include "grit/ash_strings.h" |
| 20 #include "third_party/skia/include/core/SkDrawLooper.h" | 19 #include "third_party/skia/include/core/SkDrawLooper.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/compositor/paint_context.h" | 21 #include "ui/compositor/paint_context.h" |
| 23 #include "ui/compositor/paint_recorder.h" | 22 #include "ui/compositor/paint_recorder.h" |
| 24 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
| 25 #include "ui/gfx/skia_paint_util.h" | 24 #include "ui/gfx/skia_paint_util.h" |
| 26 #include "ui/views/background.h" | 25 #include "ui/views/background.h" |
| 27 #include "ui/views/border.h" | 26 #include "ui/views/border.h" |
| 28 #include "ui/views/controls/label.h" | 27 #include "ui/views/controls/label.h" |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 owner_->set_restore_focus(true); | 448 owner_->set_restore_focus(true); |
| 450 } else { | 449 } else { |
| 451 if (title_row_ && title_row_->content() && | 450 if (title_row_ && title_row_->content() && |
| 452 title_row_->content()->HasFocus()) { | 451 title_row_->content()->HasFocus()) { |
| 453 owner_->set_restore_focus(true); | 452 owner_->set_restore_focus(true); |
| 454 } | 453 } |
| 455 DoTransitionToDefaultView(); | 454 DoTransitionToDefaultView(); |
| 456 return; | 455 return; |
| 457 } | 456 } |
| 458 | 457 |
| 459 const int transition_delay = | 458 transition_delay_timer_.Start(FROM_HERE, |
| 460 GetTrayConstant(TRAY_POPUP_TRANSITION_TO_DEFAULT_DELAY); | 459 base::TimeDelta::FromMilliseconds(100), this, |
|
tdanderson
2017/02/17 21:46:11
Use kTrayDetailedViewTransitionDelayMs in place of
Evan Stade
2017/02/17 21:51:33
oops, thanks for catching
| |
| 461 if (transition_delay <= 0) { | 460 &TrayDetailsView::DoTransitionToDefaultView); |
| 462 DoTransitionToDefaultView(); | |
| 463 return; | |
| 464 } | |
| 465 | |
| 466 transition_delay_timer_.reset(new base::OneShotTimer()); | |
| 467 transition_delay_timer_->Start( | |
| 468 FROM_HERE, base::TimeDelta::FromMilliseconds(transition_delay), this, | |
| 469 &TrayDetailsView::DoTransitionToDefaultView); | |
| 470 } | 461 } |
| 471 | 462 |
| 472 void TrayDetailsView::DoTransitionToDefaultView() { | 463 void TrayDetailsView::DoTransitionToDefaultView() { |
| 473 transition_delay_timer_.reset(); | |
| 474 | |
| 475 // Cache pointer to owner in this function scope. TrayDetailsView will be | 464 // Cache pointer to owner in this function scope. TrayDetailsView will be |
| 476 // deleted after called ShowDefaultView. | 465 // deleted after called ShowDefaultView. |
| 477 SystemTrayItem* owner = owner_; | 466 SystemTrayItem* owner = owner_; |
| 478 owner->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING); | 467 owner->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
| 479 owner->set_restore_focus(false); | 468 owner->set_restore_focus(false); |
| 480 } | 469 } |
| 481 | 470 |
| 482 views::Button* TrayDetailsView::CreateBackButton() { | 471 views::Button* TrayDetailsView::CreateBackButton() { |
| 483 DCHECK(UseMd()); | 472 DCHECK(UseMd()); |
| 484 SystemMenuButton* button = new SystemMenuButton( | 473 SystemMenuButton* button = new SystemMenuButton( |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 509 if (index < child_count() - 1 && child_at(index + 1) != title_row_) | 498 if (index < child_count() - 1 && child_at(index + 1) != title_row_) |
| 510 scroll_border_->set_visible(true); | 499 scroll_border_->set_visible(true); |
| 511 else | 500 else |
| 512 scroll_border_->set_visible(false); | 501 scroll_border_->set_visible(false); |
| 513 } | 502 } |
| 514 | 503 |
| 515 views::View::OnPaintBorder(canvas); | 504 views::View::OnPaintBorder(canvas); |
| 516 } | 505 } |
| 517 | 506 |
| 518 } // namespace ash | 507 } // namespace ash |
| OLD | NEW |