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

Side by Side Diff: ash/wm/overview/window_selector_item.cc

Issue 810033010: Remove TransparentActivateWindowButton from Overview Mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now installing targeters on each of the windows instead of the container. Created 5 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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/overview/window_selector_item.h" 5 #include "ash/wm/overview/window_selector_item.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_window_ids.h" 12 #include "ash/shell_window_ids.h"
13 #include "ash/wm/overview/overview_animation_type.h" 13 #include "ash/wm/overview/overview_animation_type.h"
14 #include "ash/wm/overview/overview_window_targeter.h"
14 #include "ash/wm/overview/scoped_overview_animation_settings.h" 15 #include "ash/wm/overview/scoped_overview_animation_settings.h"
15 #include "ash/wm/overview/scoped_transform_overview_window.h" 16 #include "ash/wm/overview/scoped_transform_overview_window.h"
16 #include "ash/wm/overview/window_selector_controller.h" 17 #include "ash/wm/overview/window_selector_controller.h"
17 #include "ash/wm/window_state.h" 18 #include "ash/wm/window_state.h"
18 #include "base/auto_reset.h" 19 #include "base/auto_reset.h"
19 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
20 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
21 #include "base/time/time.h" 22 #include "base/time/time.h"
22 #include "grit/ash_resources.h" 23 #include "grit/ash_resources.h"
23 #include "grit/ash_strings.h" 24 #include "grit/ash_strings.h"
24 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
25 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/resource/resource_bundle.h" 27 #include "ui/base/resource/resource_bundle.h"
27 #include "ui/gfx/geometry/vector2d.h" 28 #include "ui/gfx/geometry/vector2d.h"
28 #include "ui/gfx/transform_util.h" 29 #include "ui/gfx/transform_util.h"
29 #include "ui/strings/grit/ui_strings.h" 30 #include "ui/strings/grit/ui_strings.h"
31 #include "ui/views/border.h"
30 #include "ui/views/controls/button/image_button.h" 32 #include "ui/views/controls/button/image_button.h"
31 #include "ui/views/controls/label.h" 33 #include "ui/views/controls/button/label_button.h"
32 #include "ui/views/layout/box_layout.h" 34 #include "ui/views/layout/box_layout.h"
33 #include "ui/views/widget/widget.h" 35 #include "ui/views/widget/widget.h"
34 #include "ui/wm/core/window_util.h" 36 #include "ui/wm/core/window_util.h"
35 37
36 namespace ash { 38 namespace ash {
37 39
38 namespace { 40 namespace {
39 41
40 // In the conceptual overview table, the window margin is the space reserved 42 // In the conceptual overview table, the window margin is the space reserved
41 // around the window within the cell. This margin does not overlap so the 43 // around the window within the cell. This margin does not overlap so the
42 // closest distance between adjacent windows will be twice this amount. 44 // closest distance between adjacent windows will be twice this amount.
43 static const int kWindowMargin = 30; 45 static const int kWindowMargin = 30;
44 46
45 // Foreground label color. 47 // Foreground label color.
46 static const SkColor kLabelColor = SK_ColorWHITE; 48 static const SkColor kLabelColor = SK_ColorWHITE;
47 49
48 // Background label color.
49 static const SkColor kLabelBackground = SK_ColorTRANSPARENT;
50
51 // Label shadow color. 50 // Label shadow color.
52 static const SkColor kLabelShadow = 0xB0000000; 51 static const SkColor kLabelShadow = 0xB0000000;
53 52
54 // Vertical padding for the label, both over and beneath it.
55 static const int kVerticalLabelPadding = 20;
56
57 // Solid shadow length from the label 53 // Solid shadow length from the label
58 static const int kVerticalShadowOffset = 1; 54 static const int kVerticalShadowOffset = 1;
59 55
60 // Amount of blur applied to the label shadow 56 // Amount of blur applied to the label shadow
61 static const int kShadowBlur = 10; 57 static const int kShadowBlur = 10;
62 58
63 // Opacity for dimmed items. 59 // Opacity for dimmed items.
64 static const float kDimmedItemOpacity = 0.5f; 60 static const float kDimmedItemOpacity = 0.5f;
65 61
66 // Calculates the |window| bounds after being transformed to the selector's 62 // Calculates the |window| bounds after being transformed to the selector's
(...skipping 13 matching lines...) Expand all
80 // long the lay out animations take. 76 // long the lay out animations take.
81 void SetupFadeInAfterLayout(aura::Window* window) { 77 void SetupFadeInAfterLayout(aura::Window* window) {
82 ui::Layer* layer = window->layer(); 78 ui::Layer* layer = window->layer();
83 layer->SetOpacity(0.0f); 79 layer->SetOpacity(0.0f);
84 ScopedOverviewAnimationSettings animation_settings( 80 ScopedOverviewAnimationSettings animation_settings(
85 OverviewAnimationType::OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN, 81 OverviewAnimationType::OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN,
86 window); 82 window);
87 layer->SetOpacity(1.0f); 83 layer->SetOpacity(1.0f);
88 } 84 }
89 85
86 // LabelButton shown under each of the windows.
87 // The button is activated as soon as the mouse is pressed to avoid relying on
88 // the mouse up to target this view.
tdanderson 2015/01/21 17:24:24 Does this mean that the window will be selected an
Nina 2015/01/22 19:44:32 I added mouse release tracking to the OverviewLabe
89 // TODO(nsatragno): Find a way to redirect the mouse up event to the correct
90 // view and delete this class.
91 class OverviewLabelButton : public views::LabelButton {
92 public:
93 OverviewLabelButton(views::ButtonListener* listener,
94 const base::string16& text);
95 ~OverviewLabelButton() override;
96
97 // views::View:
98 bool OnMousePressed(const ui::MouseEvent& event) override;
99 };
100
101 OverviewLabelButton::OverviewLabelButton(views::ButtonListener* listener,
102 const base::string16& text)
103 : views::LabelButton(listener, text) {
104 }
105
106 OverviewLabelButton::~OverviewLabelButton() {
107 }
108
109 bool OverviewLabelButton::OnMousePressed(const ui::MouseEvent& event) {
110 NotifyClick(event);
111 return true;
112 }
113
90 // An image button with a close window icon. 114 // An image button with a close window icon.
91 class OverviewCloseButton : public views::ImageButton { 115 class OverviewCloseButton : public views::ImageButton {
92 public: 116 public:
93 explicit OverviewCloseButton(views::ButtonListener* listener); 117 explicit OverviewCloseButton(views::ButtonListener* listener);
94 ~OverviewCloseButton() override; 118 ~OverviewCloseButton() override;
95 119
96 private: 120 private:
97 DISALLOW_COPY_AND_ASSIGN(OverviewCloseButton); 121 DISALLOW_COPY_AND_ASSIGN(OverviewCloseButton);
98 }; 122 };
99 123
(...skipping 11 matching lines...) Expand all
111 OverviewCloseButton::~OverviewCloseButton() { 135 OverviewCloseButton::~OverviewCloseButton() {
112 } 136 }
113 137
114 } // namespace 138 } // namespace
115 139
116 WindowSelectorItem::WindowSelectorItem(aura::Window* window) 140 WindowSelectorItem::WindowSelectorItem(aura::Window* window)
117 : dimmed_(false), 141 : dimmed_(false),
118 root_window_(window->GetRootWindow()), 142 root_window_(window->GetRootWindow()),
119 transform_window_(window), 143 transform_window_(window),
120 in_bounds_update_(false), 144 in_bounds_update_(false),
121 window_label_view_(nullptr), 145 window_label_button_view_(nullptr),
122 close_button_(new OverviewCloseButton(this)), 146 close_button_(new OverviewCloseButton(this)),
123 selector_item_activate_window_button_( 147 overview_window_targeter_(nullptr),
124 new TransparentActivateWindowButton(root_window_, this)) { 148 scoped_window_targeter_(nullptr) {
125 views::Widget::InitParams params; 149 views::Widget::InitParams params;
126 params.type = views::Widget::InitParams::TYPE_POPUP; 150 params.type = views::Widget::InitParams::TYPE_POPUP;
127 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 151 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
128 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 152 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
129 params.parent = Shell::GetContainer(root_window_, 153 params.parent = Shell::GetContainer(root_window_,
130 kShellWindowId_OverlayContainer); 154 kShellWindowId_OverlayContainer);
131 close_button_widget_.set_focus_on_creation(false); 155 close_button_widget_.set_focus_on_creation(false);
132 close_button_widget_.Init(params); 156 close_button_widget_.Init(params);
133 close_button_->SetVisible(false); 157 close_button_->SetVisible(false);
134 close_button_widget_.SetContentsView(close_button_); 158 close_button_widget_.SetContentsView(close_button_);
135 close_button_widget_.SetSize(close_button_->GetPreferredSize()); 159 close_button_widget_.SetSize(close_button_->GetPreferredSize());
136 close_button_widget_.Show(); 160 close_button_widget_.Show();
137 161
138 gfx::Rect close_button_rect(close_button_widget_.GetNativeWindow()->bounds()); 162 gfx::Rect close_button_rect(close_button_widget_.GetNativeWindow()->bounds());
139 // Align the center of the button with position (0, 0) so that the 163 // Align the center of the button with position (0, 0) so that the
140 // translate transform does not need to take the button dimensions into 164 // translate transform does not need to take the button dimensions into
141 // account. 165 // account.
142 close_button_rect.set_x(-close_button_rect.width() / 2); 166 close_button_rect.set_x(-close_button_rect.width() / 2);
143 close_button_rect.set_y(-close_button_rect.height() / 2); 167 close_button_rect.set_y(-close_button_rect.height() / 2);
144 close_button_widget_.GetNativeWindow()->SetBounds(close_button_rect); 168 close_button_widget_.GetNativeWindow()->SetBounds(close_button_rect);
145 169
146 GetWindow()->AddObserver(this); 170 GetWindow()->AddObserver(this);
171 CreateWindowLabel();
147 172
148 UpdateCloseButtonAccessibilityName(); 173 UpdateCloseButtonAccessibilityName();
174
175 overview_window_targeter_ =
176 new OverviewWindowTargeter(window_label_->GetNativeWindow());
177 scoped_window_targeter_.reset(new aura::ScopedWindowTargeter(
178 window, scoped_ptr<OverviewWindowTargeter>(overview_window_targeter_)));
149 } 179 }
150 180
151 WindowSelectorItem::~WindowSelectorItem() { 181 WindowSelectorItem::~WindowSelectorItem() {
152 GetWindow()->RemoveObserver(this); 182 GetWindow()->RemoveObserver(this);
153 } 183 }
154 184
155 aura::Window* WindowSelectorItem::GetWindow() { 185 aura::Window* WindowSelectorItem::GetWindow() {
156 return transform_window_.window(); 186 return transform_window_.window();
157 } 187 }
158 188
(...skipping 22 matching lines...) Expand all
181 211
182 UpdateWindowLabels(target_bounds, animation_type); 212 UpdateWindowLabels(target_bounds, animation_type);
183 213
184 gfx::Rect inset_bounds(target_bounds); 214 gfx::Rect inset_bounds(target_bounds);
185 inset_bounds.Inset(kWindowMargin, kWindowMargin); 215 inset_bounds.Inset(kWindowMargin, kWindowMargin);
186 SetItemBounds(inset_bounds, animation_type); 216 SetItemBounds(inset_bounds, animation_type);
187 217
188 // SetItemBounds is called before UpdateCloseButtonLayout so the close button 218 // SetItemBounds is called before UpdateCloseButtonLayout so the close button
189 // can properly use the updated windows bounds. 219 // can properly use the updated windows bounds.
190 UpdateCloseButtonLayout(animation_type); 220 UpdateCloseButtonLayout(animation_type);
191 UpdateSelectorButtons();
192 } 221 }
193 222
194 void WindowSelectorItem::RecomputeWindowTransforms() { 223 void WindowSelectorItem::RecomputeWindowTransforms() {
195 if (in_bounds_update_ || target_bounds_.IsEmpty()) 224 if (in_bounds_update_ || target_bounds_.IsEmpty())
196 return; 225 return;
197 base::AutoReset<bool> auto_reset_in_bounds_update(&in_bounds_update_, true); 226 base::AutoReset<bool> auto_reset_in_bounds_update(&in_bounds_update_, true);
198 gfx::Rect inset_bounds(target_bounds_); 227 gfx::Rect inset_bounds(target_bounds_);
199 inset_bounds.Inset(kWindowMargin, kWindowMargin); 228 inset_bounds.Inset(kWindowMargin, kWindowMargin);
200 SetItemBounds(inset_bounds, OverviewAnimationType::OVERVIEW_ANIMATION_NONE); 229 SetItemBounds(inset_bounds, OverviewAnimationType::OVERVIEW_ANIMATION_NONE);
201
202 UpdateCloseButtonLayout(OverviewAnimationType::OVERVIEW_ANIMATION_NONE); 230 UpdateCloseButtonLayout(OverviewAnimationType::OVERVIEW_ANIMATION_NONE);
203 UpdateSelectorButtons();
204 } 231 }
205 232
206 void WindowSelectorItem::SendFocusAlert() const { 233 void WindowSelectorItem::SendFocusAlert() const {
207 selector_item_activate_window_button_->SendFocusAlert(); 234 window_label_button_view_->NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true);
208 } 235 }
209 236
210 void WindowSelectorItem::SetDimmed(bool dimmed) { 237 void WindowSelectorItem::SetDimmed(bool dimmed) {
211 dimmed_ = dimmed; 238 dimmed_ = dimmed;
212 SetOpacity(dimmed ? kDimmedItemOpacity : 1.0f); 239 SetOpacity(dimmed ? kDimmedItemOpacity : 1.0f);
213 } 240 }
214 241
215 void WindowSelectorItem::ButtonPressed(views::Button* sender, 242 void WindowSelectorItem::ButtonPressed(views::Button* sender,
216 const ui::Event& event) { 243 const ui::Event& event) {
217 transform_window_.Close(); 244 if (sender == close_button_) {
245 transform_window_.Close();
246 return;
247 }
248 // sender == window_label_button_view_
tdanderson 2015/01/21 17:24:24 Possibly worthwhile to turn this comment into a DC
Nina 2015/01/22 19:44:32 Done.
249 wm::GetWindowState(GetWindow())->Activate();
218 } 250 }
219 251
220 void WindowSelectorItem::OnWindowDestroying(aura::Window* window) { 252 void WindowSelectorItem::OnWindowDestroying(aura::Window* window) {
221 window->RemoveObserver(this); 253 window->RemoveObserver(this);
222 transform_window_.OnWindowDestroyed(); 254 transform_window_.OnWindowDestroyed();
223 } 255 }
224 256
225 void WindowSelectorItem::OnWindowTitleChanged(aura::Window* window) { 257 void WindowSelectorItem::OnWindowTitleChanged(aura::Window* window) {
226 // TODO(flackr): Maybe add the new title to a vector of titles so that we can 258 // TODO(flackr): Maybe add the new title to a vector of titles so that we can
227 // filter any of the titles the window had while in the overview session. 259 // filter any of the titles the window had while in the overview session.
228 if (window == GetWindow()) { 260 window_label_button_view_->SetText(window->title());
229 window_label_view_->SetText(window->title()); 261 UpdateCloseButtonAccessibilityName();
230 UpdateCloseButtonAccessibilityName();
231 }
232 UpdateCloseButtonLayout(OverviewAnimationType::OVERVIEW_ANIMATION_NONE);
233 UpdateSelectorButtons();
234 }
235
236 void WindowSelectorItem::Select() {
237 aura::Window* selection_window = GetWindow();
238 if (selection_window)
239 wm::GetWindowState(selection_window)->Activate();
240 } 262 }
241 263
242 void WindowSelectorItem::SetItemBounds(const gfx::Rect& target_bounds, 264 void WindowSelectorItem::SetItemBounds(const gfx::Rect& target_bounds,
243 OverviewAnimationType animation_type) { 265 OverviewAnimationType animation_type) {
244 DCHECK(root_window_ == GetWindow()->GetRootWindow()); 266 DCHECK(root_window_ == GetWindow()->GetRootWindow());
245 gfx::Rect screen_bounds = transform_window_.GetTargetBoundsInScreen(); 267 gfx::Rect screen_bounds = transform_window_.GetTargetBoundsInScreen();
246 gfx::Rect selector_item_bounds = 268 gfx::Rect selector_item_bounds =
247 ScopedTransformOverviewWindow::ShrinkRectToFitPreservingAspectRatio( 269 ScopedTransformOverviewWindow::ShrinkRectToFitPreservingAspectRatio(
248 screen_bounds, target_bounds); 270 screen_bounds, target_bounds);
249 gfx::Transform transform = 271 gfx::Transform transform =
250 ScopedTransformOverviewWindow::GetTransformForRect(screen_bounds, 272 ScopedTransformOverviewWindow::GetTransformForRect(screen_bounds,
251 selector_item_bounds); 273 selector_item_bounds);
252 ScopedTransformOverviewWindow::ScopedAnimationSettings animation_settings; 274 ScopedTransformOverviewWindow::ScopedAnimationSettings animation_settings;
253 transform_window_.BeginScopedAnimation(animation_type, &animation_settings); 275 transform_window_.BeginScopedAnimation(animation_type, &animation_settings);
254 transform_window_.SetTransform(root_window_, transform); 276 transform_window_.SetTransform(root_window_, transform);
255 transform_window_.set_overview_transform(transform); 277 transform_window_.set_overview_transform(transform);
278 overview_window_targeter_->set_bounds(target_bounds);
256 } 279 }
257 280
258 void WindowSelectorItem::SetOpacity(float opacity) { 281 void WindowSelectorItem::SetOpacity(float opacity) {
259 window_label_->GetNativeWindow()->layer()->SetOpacity(opacity); 282 window_label_->GetNativeWindow()->layer()->SetOpacity(opacity);
260 close_button_widget_.GetNativeWindow()->layer()->SetOpacity(opacity); 283 close_button_widget_.GetNativeWindow()->layer()->SetOpacity(opacity);
261 284
262 transform_window_.SetOpacity(opacity); 285 transform_window_.SetOpacity(opacity);
263 } 286 }
264 287
265 void WindowSelectorItem::UpdateWindowLabels( 288 void WindowSelectorItem::UpdateWindowLabels(
266 const gfx::Rect& window_bounds, 289 const gfx::Rect& window_bounds,
267 OverviewAnimationType animation_type) { 290 OverviewAnimationType animation_type) {
268
269 if (!window_label_) {
270 CreateWindowLabel(GetWindow()->title());
271 SetupFadeInAfterLayout(window_label_->GetNativeWindow());
272 }
273
274 gfx::Rect converted_bounds = ScreenUtil::ConvertRectFromScreen(root_window_, 291 gfx::Rect converted_bounds = ScreenUtil::ConvertRectFromScreen(root_window_,
275 window_bounds); 292 window_bounds);
276 gfx::Rect label_bounds(converted_bounds.x(), 293 gfx::Rect label_bounds(converted_bounds.x(),
277 converted_bounds.bottom(), 294 converted_bounds.bottom(),
278 converted_bounds.width(), 295 converted_bounds.width(),
279 0); 296 0);
280 label_bounds.set_height(window_label_->GetContentsView()-> 297 label_bounds.set_height(window_label_->GetContentsView()->
281 GetPreferredSize().height()); 298 GetPreferredSize().height());
282 label_bounds.set_y(label_bounds.y() - window_label_-> 299 label_bounds.set_y(label_bounds.y() - window_label_->
283 GetContentsView()->GetPreferredSize().height()); 300 GetContentsView()->GetPreferredSize().height());
284 301
285 ScopedOverviewAnimationSettings animation_settings(animation_type, 302 ScopedOverviewAnimationSettings animation_settings(animation_type,
286 window_label_->GetNativeWindow()); 303 window_label_->GetNativeWindow());
287 304
288 window_label_->GetNativeWindow()->SetBounds(label_bounds); 305 window_label_->GetNativeWindow()->SetBounds(label_bounds);
289 } 306 }
290 307
291 void WindowSelectorItem::CreateWindowLabel(const base::string16& title) { 308 void WindowSelectorItem::CreateWindowLabel() {
292 window_label_.reset(new views::Widget); 309 window_label_.reset(new views::Widget);
293 views::Widget::InitParams params; 310 views::Widget::InitParams params;
294 params.type = views::Widget::InitParams::TYPE_POPUP; 311 params.type = views::Widget::InitParams::TYPE_POPUP;
295 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 312 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
296 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 313 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
297 params.parent = Shell::GetContainer(root_window_, 314 params.parent = Shell::GetContainer(root_window_,
298 kShellWindowId_OverlayContainer); 315 kShellWindowId_OverlayContainer);
299 params.accept_events = false;
300 params.visible_on_all_workspaces = true; 316 params.visible_on_all_workspaces = true;
301 window_label_->set_focus_on_creation(false); 317 window_label_->set_focus_on_creation(false);
302 window_label_->Init(params); 318 window_label_->Init(params);
303 window_label_view_ = new views::Label; 319 window_label_button_view_ =
304 window_label_view_->SetEnabledColor(kLabelColor); 320 new OverviewLabelButton(this, GetWindow()->title());
305 window_label_view_->SetBackgroundColor(kLabelBackground); 321 window_label_button_view_->SetTextColor(views::LabelButton::STATE_NORMAL,
306 window_label_view_->SetShadows(gfx::ShadowValues( 322 kLabelColor);
307 1, 323 window_label_button_view_->SetTextColor(views::LabelButton::STATE_HOVERED,
308 gfx::ShadowValue( 324 kLabelColor);
309 gfx::Point(0, kVerticalShadowOffset), kShadowBlur, kLabelShadow))); 325 window_label_button_view_->SetTextColor(views::LabelButton::STATE_PRESSED,
326 kLabelColor);
327 window_label_button_view_->set_animate_on_state_change(false);
328 window_label_button_view_->SetHorizontalAlignment(gfx::ALIGN_CENTER);
329 window_label_button_view_->SetBorder(views::Border::NullBorder());
330 window_label_button_view_->SetTextShadows(gfx::ShadowValues(
331 1, gfx::ShadowValue(gfx::Point(0, kVerticalShadowOffset), kShadowBlur,
332 kLabelShadow)));
310 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 333 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
311 window_label_view_->SetFontList( 334 window_label_button_view_->SetFontList(
312 bundle.GetFontList(ui::ResourceBundle::BoldFont)); 335 bundle.GetFontList(ui::ResourceBundle::BoldFont));
313 window_label_view_->SetText(title); 336 window_label_->SetContentsView(window_label_button_view_);
314 views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kVertical,
315 0,
316 kVerticalLabelPadding,
317 0);
318 window_label_view_->SetLayoutManager(layout);
319 window_label_->SetContentsView(window_label_view_);
320 window_label_->Show(); 337 window_label_->Show();
321 } 338 SetupFadeInAfterLayout(window_label_->GetNativeWindow());
bruthig 2015/01/21 16:55:42 The call to SetupFadeInAfterLayout was intentional
Nina 2015/01/22 19:44:32 Thanks for the heads up. Because we need the windo
322
323 void WindowSelectorItem::UpdateSelectorButtons() {
324 aura::Window* window = GetWindow();
325
326 selector_item_activate_window_button_->SetBounds(target_bounds());
327 selector_item_activate_window_button_->SetAccessibleName(window->title());
328
329 TransparentActivateWindowButton* activate_button =
330 transform_window_.activate_button();
331 activate_button->SetBounds(target_bounds());
332 activate_button->SetAccessibleName(window->title());
333 } 339 }
334 340
335 void WindowSelectorItem::UpdateCloseButtonLayout( 341 void WindowSelectorItem::UpdateCloseButtonLayout(
336 OverviewAnimationType animation_type) { 342 OverviewAnimationType animation_type) {
337 if (!close_button_->visible()) { 343 if (!close_button_->visible()) {
338 close_button_->SetVisible(true); 344 close_button_->SetVisible(true);
339 SetupFadeInAfterLayout(close_button_widget_.GetNativeWindow()); 345 SetupFadeInAfterLayout(close_button_widget_.GetNativeWindow());
340 } 346 }
341 ScopedOverviewAnimationSettings animation_settings(animation_type, 347 ScopedOverviewAnimationSettings animation_settings(animation_type,
342 close_button_widget_.GetNativeWindow()); 348 close_button_widget_.GetNativeWindow());
343 349
344 gfx::Rect transformed_window_bounds = ScreenUtil::ConvertRectFromScreen( 350 gfx::Rect transformed_window_bounds = ScreenUtil::ConvertRectFromScreen(
345 close_button_widget_.GetNativeWindow()->GetRootWindow(), 351 close_button_widget_.GetNativeWindow()->GetRootWindow(),
346 GetTransformedBounds(GetWindow())); 352 GetTransformedBounds(GetWindow()));
347 353
348 gfx::Transform close_button_transform; 354 gfx::Transform close_button_transform;
349 close_button_transform.Translate(transformed_window_bounds.right(), 355 close_button_transform.Translate(transformed_window_bounds.right(),
350 transformed_window_bounds.y()); 356 transformed_window_bounds.y());
351 close_button_widget_.GetNativeWindow()->SetTransform( 357 close_button_widget_.GetNativeWindow()->SetTransform(
352 close_button_transform); 358 close_button_transform);
353 } 359 }
354 360
355 void WindowSelectorItem::UpdateCloseButtonAccessibilityName() { 361 void WindowSelectorItem::UpdateCloseButtonAccessibilityName() {
356 close_button_->SetAccessibleName(l10n_util::GetStringFUTF16( 362 close_button_->SetAccessibleName(l10n_util::GetStringFUTF16(
357 IDS_ASH_OVERVIEW_CLOSE_ITEM_BUTTON_ACCESSIBLE_NAME, 363 IDS_ASH_OVERVIEW_CLOSE_ITEM_BUTTON_ACCESSIBLE_NAME,
358 GetWindow()->title())); 364 GetWindow()->title()));
359 } 365 }
360 366
361 } // namespace ash 367 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698