OLD | NEW |
---|---|
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 int cur_y = (height() - cur_size.height()) / 2; | 81 int cur_y = (height() - cur_size.height()) / 2; |
82 | 82 |
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 #if defined(USE_AURA) | |
92 if (GetWidget()) | |
sky
2011/12/13 16:40:41
This makes it easy to get stuck in a loop. Can we
stevenjb
2011/12/14 02:10:51
We already do; I will override PreferredSizeChange
| |
93 GetWidget()->SetSize(GetPreferredSize()); | |
94 #endif | |
91 } | 95 } |
92 | 96 |
93 void StatusAreaView::ChildPreferredSizeChanged(View* child) { | 97 void StatusAreaView::ChildPreferredSizeChanged(View* child) { |
94 // When something like the clock menu button's size changes, we need to | 98 // 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 | 99 // 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. | 100 // BrowserView know to relayout, which will reset the bounds of this view. |
97 Layout(); | 101 Layout(); |
98 PreferredSizeChanged(); | 102 PreferredSizeChanged(); |
99 #if defined(USE_AURA) | |
100 if (GetWidget()) | |
101 GetWidget()->SetSize(GetPreferredSize()); | |
102 #endif | |
103 } | 103 } |
104 | 104 |
105 void StatusAreaView::MakeButtonsActive(bool active) { | 105 void StatusAreaView::MakeButtonsActive(bool active) { |
106 for (std::list<StatusAreaButton*>::iterator iter = buttons_.begin(); | 106 for (std::list<StatusAreaButton*>::iterator iter = buttons_.begin(); |
107 iter != buttons_.end(); ++iter) { | 107 iter != buttons_.end(); ++iter) { |
108 (*iter)->set_menu_active(active); | 108 (*iter)->set_menu_active(active); |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 void StatusAreaView::UpdateButtonVisibility() { | 112 void StatusAreaView::UpdateButtonVisibility() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 if (need_return_focus_) { | 145 if (need_return_focus_) { |
146 const views::View* first = GetFirstFocusableChild(); | 146 const views::View* first = GetFirstFocusableChild(); |
147 const views::View* last = GetLastFocusableChild(); | 147 const views::View* last = GetLastFocusableChild(); |
148 const bool first_to_last = (focused_before == first && focused_now == last); | 148 const bool first_to_last = (focused_before == first && focused_now == last); |
149 const bool last_to_first = (focused_now == first && focused_before == last); | 149 const bool last_to_first = (focused_now == first && focused_before == last); |
150 | 150 |
151 if (first_to_last || last_to_first) | 151 if (first_to_last || last_to_first) |
152 ReturnFocus(first_to_last); | 152 ReturnFocus(first_to_last); |
153 } | 153 } |
154 } | 154 } |
OLD | NEW |