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

Side by Side Diff: ash/wm/status_area_layout_manager.cc

Issue 9877009: Two tweaks to avoid invoking ShelfLayoutManager::LayoutShelf unless we (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/controls/image_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/status_area_layout_manager.h" 5 #include "ash/wm/status_area_layout_manager.h"
6 6
7 #include "ash/wm/shelf_layout_manager.h" 7 #include "ash/wm/shelf_layout_manager.h"
8 #include "base/auto_reset.h" 8 #include "base/auto_reset.h"
9 #include "ui/aura/window.h"
10 #include "ui/views/widget/widget.h"
9 11
10 namespace ash { 12 namespace ash {
11 namespace internal { 13 namespace internal {
12 14
13 //////////////////////////////////////////////////////////////////////////////// 15 ////////////////////////////////////////////////////////////////////////////////
14 // StatusAreaLayoutManager, public: 16 // StatusAreaLayoutManager, public:
15 17
16 StatusAreaLayoutManager::StatusAreaLayoutManager(ShelfLayoutManager* shelf) 18 StatusAreaLayoutManager::StatusAreaLayoutManager(ShelfLayoutManager* shelf)
17 : in_layout_(false), 19 : in_layout_(false),
18 shelf_(shelf) { 20 shelf_(shelf) {
(...skipping 14 matching lines...) Expand all
33 35
34 void StatusAreaLayoutManager::OnWillRemoveWindowFromLayout( 36 void StatusAreaLayoutManager::OnWillRemoveWindowFromLayout(
35 aura::Window* child) { 37 aura::Window* child) {
36 } 38 }
37 39
38 void StatusAreaLayoutManager::OnChildWindowVisibilityChanged( 40 void StatusAreaLayoutManager::OnChildWindowVisibilityChanged(
39 aura::Window* child, bool visible) { 41 aura::Window* child, bool visible) {
40 } 42 }
41 43
42 void StatusAreaLayoutManager::SetChildBounds( 44 void StatusAreaLayoutManager::SetChildBounds(
43 aura::Window* child, const gfx::Rect& requested_bounds) { 45 aura::Window* child,
46 const gfx::Rect& requested_bounds) {
47 // Only need to have the shelf do a layout if the child changing is the status
48 // area and the shelf isn't in the process of doing a layout.
49 if (child != shelf_->status()->GetNativeView() || in_layout_) {
50 SetChildBoundsDirect(child, requested_bounds);
51 return;
52 }
53
54 // If the size matches, no need to do anything. We don't check the location as
55 // that is managed by the shelf.
56 if (requested_bounds.size() == child->bounds().size())
57 return;
58
44 SetChildBoundsDirect(child, requested_bounds); 59 SetChildBoundsDirect(child, requested_bounds);
45 if (!in_layout_) 60 LayoutStatusArea();
46 LayoutStatusArea();
47 } 61 }
48 62
49 //////////////////////////////////////////////////////////////////////////////// 63 ////////////////////////////////////////////////////////////////////////////////
50 // StatusAreaLayoutManager, private: 64 // StatusAreaLayoutManager, private:
51 65
52 void StatusAreaLayoutManager::LayoutStatusArea() { 66 void StatusAreaLayoutManager::LayoutStatusArea() {
53 // Shelf layout manager may be already doing layout. 67 // Shelf layout manager may be already doing layout.
54 if (shelf_->in_layout()) 68 if (shelf_->in_layout())
55 return; 69 return;
56 70
57 AutoReset<bool> auto_reset_in_layout(&in_layout_, true); 71 AutoReset<bool> auto_reset_in_layout(&in_layout_, true);
58 shelf_->LayoutShelf(); 72 shelf_->LayoutShelf();
59 } 73 }
60 74
61 } // namespace internal 75 } // namespace internal
62 } // namespace ash 76 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/image_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698