• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #include "ash/wm/overview/window_selector_item.h"
6 #include "base/auto_reset.h"
7 #include "ui/aura/window.h"
8 
9 namespace ash {
10 
WindowSelectorItem()11 WindowSelectorItem::WindowSelectorItem()
12     : root_window_(NULL),
13       in_bounds_update_(false) {
14 }
15 
~WindowSelectorItem()16 WindowSelectorItem::~WindowSelectorItem() {
17 }
18 
SetBounds(aura::Window * root_window,const gfx::Rect & target_bounds)19 void WindowSelectorItem::SetBounds(aura::Window* root_window,
20                                    const gfx::Rect& target_bounds) {
21   if (in_bounds_update_)
22     return;
23   base::AutoReset<bool> auto_reset_in_bounds_update(&in_bounds_update_, true);
24   root_window_ = root_window;
25   target_bounds_ = target_bounds;
26   SetItemBounds(root_window, target_bounds, true);
27 }
28 
RecomputeWindowTransforms()29 void WindowSelectorItem::RecomputeWindowTransforms() {
30   if (in_bounds_update_ || target_bounds_.IsEmpty())
31     return;
32   DCHECK(root_window_);
33   base::AutoReset<bool> auto_reset_in_bounds_update(&in_bounds_update_, true);
34   SetItemBounds(root_window_, target_bounds_, false);
35 }
36 
37 }  // namespace ash
38