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

Side by Side Diff: ash/wm/overview/window_selector_window.cc

Issue 231643002: Added labels under the windows in OverviewMode displaying their current name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added blurred shadows to labels Created 6 years, 8 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/wm/overview/window_selector_window.h" 5 #include "ash/wm/overview/window_selector_window.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/wm/overview/scoped_transform_overview_window.h" 9 #include "ash/wm/overview/scoped_transform_overview_window.h"
10 #include "grit/ash_resources.h" 10 #include "grit/ash_resources.h"
(...skipping 28 matching lines...) Expand all
39 button->SetImage(views::CustomButton::STATE_HOVERED, 39 button->SetImage(views::CustomButton::STATE_HOVERED,
40 rb.GetImageSkiaNamed(IDR_AURA_WINDOW_OVERVIEW_CLOSE_H)); 40 rb.GetImageSkiaNamed(IDR_AURA_WINDOW_OVERVIEW_CLOSE_H));
41 button->SetImage(views::CustomButton::STATE_PRESSED, 41 button->SetImage(views::CustomButton::STATE_PRESSED,
42 rb.GetImageSkiaNamed(IDR_AURA_WINDOW_OVERVIEW_CLOSE_P)); 42 rb.GetImageSkiaNamed(IDR_AURA_WINDOW_OVERVIEW_CLOSE_P));
43 widget->SetContentsView(button); 43 widget->SetContentsView(button);
44 widget->SetSize(rb.GetImageSkiaNamed(IDR_AURA_WINDOW_OVERVIEW_CLOSE)->size()); 44 widget->SetSize(rb.GetImageSkiaNamed(IDR_AURA_WINDOW_OVERVIEW_CLOSE)->size());
45 widget->Show(); 45 widget->Show();
46 return widget; 46 return widget;
47 } 47 }
48 48
49 // The time for the close button to fade in when initially shown on entering
50 // overview mode.
51 const int kCloseButtonFadeInMilliseconds = 80;
52
53 } // namespace 49 } // namespace
54 50
55 WindowSelectorWindow::WindowSelectorWindow(aura::Window* window) 51 WindowSelectorWindow::WindowSelectorWindow(aura::Window* window)
56 : transform_window_(window) { 52 : transform_window_(window) {
57 } 53 }
58 54
59 WindowSelectorWindow::~WindowSelectorWindow() { 55 WindowSelectorWindow::~WindowSelectorWindow() {
60 } 56 }
61 57
58 base::string16 WindowSelectorWindow::GetLabelName() {
59 return transform_window_.window()->title();
60 }
61
62 aura::Window* WindowSelectorWindow::GetRootWindow() { 62 aura::Window* WindowSelectorWindow::GetRootWindow() {
63 return transform_window_.window()->GetRootWindow(); 63 return transform_window_.window()->GetRootWindow();
64 } 64 }
65 65
66 bool WindowSelectorWindow::HasSelectableWindow(const aura::Window* window) { 66 bool WindowSelectorWindow::HasSelectableWindow(const aura::Window* window) {
67 return transform_window_.window() == window; 67 return transform_window_.window() == window;
68 } 68 }
69 69
70 aura::Window* WindowSelectorWindow::TargetedWindow(const aura::Window* target) { 70 aura::Window* WindowSelectorWindow::TargetedWindow(const aura::Window* target) {
71 if (transform_window_.Contains(target)) 71 if (transform_window_.Contains(target))
(...skipping 23 matching lines...) Expand all
95 } 95 }
96 96
97 void WindowSelectorWindow::PrepareForOverview() { 97 void WindowSelectorWindow::PrepareForOverview() {
98 transform_window_.PrepareForOverview(); 98 transform_window_.PrepareForOverview();
99 } 99 }
100 100
101 void WindowSelectorWindow::SetItemBounds(aura::Window* root_window, 101 void WindowSelectorWindow::SetItemBounds(aura::Window* root_window,
102 const gfx::Rect& target_bounds, 102 const gfx::Rect& target_bounds,
103 bool animate) { 103 bool animate) {
104 gfx::Rect src_rect = transform_window_.GetBoundsInScreen(); 104 gfx::Rect src_rect = transform_window_.GetBoundsInScreen();
105 set_bounds(ScopedTransformOverviewWindow:: 105 const gfx::Rect window_bounds =
106 ShrinkRectToFitPreservingAspectRatio(src_rect, target_bounds)); 106 ScopedTransformOverviewWindow::
107 ShrinkRectToFitPreservingAspectRatio(src_rect, target_bounds);
108 set_bounds(window_bounds);
107 transform_window_.SetTransform(root_window, 109 transform_window_.SetTransform(root_window,
108 ScopedTransformOverviewWindow::GetTransformForRect(src_rect, bounds()), 110 ScopedTransformOverviewWindow::GetTransformForRect(src_rect, bounds()),
109 animate); 111 animate);
110 UpdateCloseButtonBounds(); 112 UpdateCloseButtonBounds();
111 } 113 }
112 114
113 void WindowSelectorWindow::ButtonPressed(views::Button* sender, 115 void WindowSelectorWindow::ButtonPressed(views::Button* sender,
114 const ui::Event& event) { 116 const ui::Event& event) {
115 views::Widget::GetTopLevelWidgetForNativeView( 117 views::Widget::GetTopLevelWidgetForNativeView(
116 transform_window_.window())->Close(); 118 transform_window_.window())->Close();
(...skipping 29 matching lines...) Expand all
146 layer->GetAnimator()->StopAnimating(); 148 layer->GetAnimator()->StopAnimating();
147 layer->GetAnimator()->SchedulePauseForProperties( 149 layer->GetAnimator()->SchedulePauseForProperties(
148 base::TimeDelta::FromMilliseconds( 150 base::TimeDelta::FromMilliseconds(
149 ScopedTransformOverviewWindow::kTransitionMilliseconds), 151 ScopedTransformOverviewWindow::kTransitionMilliseconds),
150 ui::LayerAnimationElement::OPACITY); 152 ui::LayerAnimationElement::OPACITY);
151 { 153 {
152 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); 154 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
153 settings.SetPreemptionStrategy( 155 settings.SetPreemptionStrategy(
154 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 156 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
155 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( 157 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
156 kCloseButtonFadeInMilliseconds)); 158 ScopedTransformOverviewWindow::kFadeInMilliseconds));
157 layer->SetOpacity(1); 159 layer->SetOpacity(1);
158 } 160 }
159 } else { 161 } else {
160 ui::ScopedLayerAnimationSettings settings( 162 ui::ScopedLayerAnimationSettings settings(
161 close_button_->GetNativeWindow()->layer()->GetAnimator()); 163 close_button_->GetNativeWindow()->layer()->GetAnimator());
162 settings.SetPreemptionStrategy( 164 settings.SetPreemptionStrategy(
163 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 165 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
164 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( 166 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
165 ScopedTransformOverviewWindow::kTransitionMilliseconds)); 167 ScopedTransformOverviewWindow::kTransitionMilliseconds));
166 close_button_->GetNativeWindow()->SetTransform(close_button_transform); 168 close_button_->GetNativeWindow()->SetTransform(close_button_transform);
167 } 169 }
168 } 170 }
169 171
170 } // namespace ash 172 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698