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" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "chrome/browser/chromeos/view_ids.h" | 12 #include "chrome/browser/chromeos/view_ids.h" |
13 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
14 #include "ui/views/border.h" | 14 #include "ui/views/border.h" |
15 | 15 |
16 #if defined(USE_AURA) | |
17 #include "ui/aura_shell/shell.h" | |
stevenjb
2011/12/05 20:08:59
We don't need this include any more.
Nikita (slow)
2011/12/06 08:26:19
Done.
| |
18 #include "ui/views/widget/widget.h" | |
19 #endif | |
20 | |
16 // Number of pixels to separate each icon. | 21 // Number of pixels to separate each icon. |
17 #if defined(TOUCH_UI) | 22 #if defined(TOUCH_UI) |
18 const int kSeparation = 25; | 23 const int kSeparation = 25; |
19 #else | 24 #else |
20 const int kSeparation = 0; | 25 const int kSeparation = 0; |
21 #endif | 26 #endif |
22 | 27 |
23 StatusAreaView::StatusAreaView() | 28 StatusAreaView::StatusAreaView() |
24 : need_return_focus_(false) { | 29 : need_return_focus_(false) { |
25 set_id(VIEW_ID_STATUS_AREA); | 30 set_id(VIEW_ID_STATUS_AREA); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 } | 90 } |
86 } | 91 } |
87 } | 92 } |
88 | 93 |
89 void StatusAreaView::ChildPreferredSizeChanged(View* child) { | 94 void StatusAreaView::ChildPreferredSizeChanged(View* child) { |
90 // When something like the clock menu button's size changes, we need to | 95 // When something like the clock menu button's size changes, we need to |
91 // relayout. Also mark that this view's size has changed. This will let | 96 // relayout. Also mark that this view's size has changed. This will let |
92 // BrowserView know to relayout, which will reset the bounds of this view. | 97 // BrowserView know to relayout, which will reset the bounds of this view. |
93 Layout(); | 98 Layout(); |
94 PreferredSizeChanged(); | 99 PreferredSizeChanged(); |
100 #if defined(USE_AURA) | |
101 if (GetWidget()) | |
102 GetWidget()->SetSize(GetPreferredSize()); | |
103 #endif | |
95 } | 104 } |
96 | 105 |
97 void StatusAreaView::MakeButtonsActive(bool active) { | 106 void StatusAreaView::MakeButtonsActive(bool active) { |
98 for (std::list<StatusAreaButton*>::iterator iter = buttons_.begin(); | 107 for (std::list<StatusAreaButton*>::iterator iter = buttons_.begin(); |
99 iter != buttons_.end(); ++iter) { | 108 iter != buttons_.end(); ++iter) { |
100 (*iter)->set_menu_active(active); | 109 (*iter)->set_menu_active(active); |
101 } | 110 } |
102 } | 111 } |
103 | 112 |
104 void StatusAreaView::UpdateButtonVisibility() { | 113 void StatusAreaView::UpdateButtonVisibility() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 if (need_return_focus_) { | 146 if (need_return_focus_) { |
138 const views::View* first = GetFirstFocusableChild(); | 147 const views::View* first = GetFirstFocusableChild(); |
139 const views::View* last = GetLastFocusableChild(); | 148 const views::View* last = GetLastFocusableChild(); |
140 const bool first_to_last = (focused_before == first && focused_now == last); | 149 const bool first_to_last = (focused_before == first && focused_now == last); |
141 const bool last_to_first = (focused_now == first && focused_before == last); | 150 const bool last_to_first = (focused_now == first && focused_before == last); |
142 | 151 |
143 if (first_to_last || last_to_first) | 152 if (first_to_last || last_to_first) |
144 ReturnFocus(first_to_last); | 153 ReturnFocus(first_to_last); |
145 } | 154 } |
146 } | 155 } |
OLD | NEW |