OLD | NEW |
---|---|
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_item.h" | 5 #include "ash/wm/overview/window_selector_item.h" |
6 | 6 |
7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/overview/scoped_transform_overview_window.h" | 10 #include "ash/wm/overview/scoped_transform_overview_window.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 0); | 100 0); |
101 label->SetLayoutManager(layout); | 101 label->SetLayoutManager(layout); |
102 widget->SetContentsView(label); | 102 widget->SetContentsView(label); |
103 widget->Show(); | 103 widget->Show(); |
104 return widget; | 104 return widget; |
105 } | 105 } |
106 | 106 |
107 const int WindowSelectorItem::kFadeInMilliseconds = 80; | 107 const int WindowSelectorItem::kFadeInMilliseconds = 80; |
108 | 108 |
109 WindowSelectorItem::WindowSelectorItem() | 109 WindowSelectorItem::WindowSelectorItem() |
110 : root_window_(NULL), | 110 : dimmed_(false), |
111 root_window_(NULL), | |
111 in_bounds_update_(false) { | 112 in_bounds_update_(false) { |
112 } | 113 } |
113 | 114 |
114 WindowSelectorItem::~WindowSelectorItem() { | 115 WindowSelectorItem::~WindowSelectorItem() { |
115 } | 116 } |
116 | 117 |
117 void WindowSelectorItem::RemoveWindow(const aura::Window* window) { | 118 void WindowSelectorItem::RemoveWindow(const aura::Window* window) { |
118 // If empty WindowSelectorItem will be destroyed immediately after this by | 119 // If empty WindowSelectorItem will be destroyed immediately after this by |
119 // its owner. | 120 // its owner. |
120 if (empty()) | 121 if (empty()) |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 228 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
228 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 229 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
229 ScopedTransformOverviewWindow::kTransitionMilliseconds)); | 230 ScopedTransformOverviewWindow::kTransitionMilliseconds)); |
230 close_button_->GetNativeWindow()->SetTransform(close_button_transform); | 231 close_button_->GetNativeWindow()->SetTransform(close_button_transform); |
231 } else { | 232 } else { |
232 close_button_->GetNativeWindow()->SetTransform(close_button_transform); | 233 close_button_->GetNativeWindow()->SetTransform(close_button_transform); |
233 } | 234 } |
234 } | 235 } |
235 } | 236 } |
236 | 237 |
238 void WindowSelectorItem::SetDimmed(bool dimmed) { | |
239 dimmed_ = dimmed; | |
240 window_label_->GetNativeWindow()->layer()->SetOpacity(dimmed ? 0.5 : 1); | |
241 close_button_->GetNativeWindow()->layer()->SetOpacity(dimmed ? 0.5 : 1); | |
flackr
2014/06/26 17:33:08
These should be done as part of ChangeItemVisibili
Nina
2014/06/27 15:20:39
Done.
| |
242 ChangeItemVisibility(!dimmed); | |
243 } | |
244 | |
237 void WindowSelectorItem::UpdateWindowLabels(const gfx::Rect& window_bounds, | 245 void WindowSelectorItem::UpdateWindowLabels(const gfx::Rect& window_bounds, |
238 aura::Window* root_window, | 246 aura::Window* root_window, |
239 bool animate) { | 247 bool animate) { |
240 gfx::Rect converted_bounds = ScreenUtil::ConvertRectFromScreen(root_window, | 248 gfx::Rect converted_bounds = ScreenUtil::ConvertRectFromScreen(root_window, |
241 window_bounds); | 249 window_bounds); |
242 gfx::Rect label_bounds(converted_bounds.x(), | 250 gfx::Rect label_bounds(converted_bounds.x(), |
243 converted_bounds.bottom(), | 251 converted_bounds.bottom(), |
244 converted_bounds.width(), | 252 converted_bounds.width(), |
245 0); | 253 0); |
246 | 254 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 296 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
289 ScopedTransformOverviewWindow::kTransitionMilliseconds)); | 297 ScopedTransformOverviewWindow::kTransitionMilliseconds)); |
290 window_label_->GetNativeWindow()->SetBounds(label_bounds); | 298 window_label_->GetNativeWindow()->SetBounds(label_bounds); |
291 } else { | 299 } else { |
292 window_label_->GetNativeWindow()->SetBounds(label_bounds); | 300 window_label_->GetNativeWindow()->SetBounds(label_bounds); |
293 } | 301 } |
294 } | 302 } |
295 } | 303 } |
296 | 304 |
297 } // namespace ash | 305 } // namespace ash |
OLD | NEW |