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

Side by Side Diff: chrome/browser/chromeos/status/status_area_view.cc

Issue 8932001: Update widget size from StatusAreaView::Layout() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years 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 | « chrome/browser/chromeos/status/status_area_view.h ('k') | no next file » | 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 "chrome/browser/chromeos/status/status_area_view.h" 5 #include "chrome/browser/chromeos/status/status_area_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Handle odd number of pixels. 83 // Handle odd number of pixels.
84 cur_y += (height() - cur_size.height()) % 2; 84 cur_y += (height() - cur_size.height()) % 2;
85 85
86 // Put next in row horizontally, and center vertically. 86 // Put next in row horizontally, and center vertically.
87 cur->SetBounds(cur_x, cur_y, cur_size.width(), cur_size.height()); 87 cur->SetBounds(cur_x, cur_y, cur_size.width(), cur_size.height());
88 cur_x += cur_size.width() + kSeparation; 88 cur_x += cur_size.width() + kSeparation;
89 } 89 }
90 } 90 }
91 } 91 }
92 92
93 void StatusAreaView::PreferredSizeChanged() {
94 #if defined(USE_AURA)
95 if (GetWidget())
96 GetWidget()->SetSize(GetPreferredSize());
97 #endif
98 views::AccessiblePaneView::PreferredSizeChanged();
99 }
100
93 void StatusAreaView::ChildPreferredSizeChanged(View* child) { 101 void StatusAreaView::ChildPreferredSizeChanged(View* child) {
94 // When something like the clock menu button's size changes, we need to 102 // When something like the clock menu button's size changes, we need to
95 // relayout. Also mark that this view's size has changed. This will let 103 // relayout. Also mark that this view's size has changed. This will let
96 // BrowserView know to relayout, which will reset the bounds of this view. 104 // BrowserView know to relayout, which will reset the bounds of this view.
97 Layout(); 105 Layout();
98 PreferredSizeChanged(); 106 PreferredSizeChanged();
99 #if defined(USE_AURA)
100 if (GetWidget())
101 GetWidget()->SetSize(GetPreferredSize());
102 #endif
103 } 107 }
104 108
105 void StatusAreaView::MakeButtonsActive(bool active) { 109 void StatusAreaView::MakeButtonsActive(bool active) {
106 for (std::list<StatusAreaButton*>::iterator iter = buttons_.begin(); 110 for (std::list<StatusAreaButton*>::iterator iter = buttons_.begin();
107 iter != buttons_.end(); ++iter) { 111 iter != buttons_.end(); ++iter) {
108 (*iter)->set_menu_active(active); 112 (*iter)->set_menu_active(active);
109 } 113 }
110 } 114 }
111 115
112 void StatusAreaView::UpdateButtonVisibility() { 116 void StatusAreaView::UpdateButtonVisibility() {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 if (need_return_focus_) { 149 if (need_return_focus_) {
146 const views::View* first = GetFirstFocusableChild(); 150 const views::View* first = GetFirstFocusableChild();
147 const views::View* last = GetLastFocusableChild(); 151 const views::View* last = GetLastFocusableChild();
148 const bool first_to_last = (focused_before == first && focused_now == last); 152 const bool first_to_last = (focused_before == first && focused_now == last);
149 const bool last_to_first = (focused_now == first && focused_before == last); 153 const bool last_to_first = (focused_now == first && focused_before == last);
150 154
151 if (first_to_last || last_to_first) 155 if (first_to_last || last_to_first)
152 ReturnFocus(first_to_last); 156 ReturnFocus(first_to_last);
153 } 157 }
154 } 158 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/status_area_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698