OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 bool GetHitTestMask(aura::Window* window, gfx::Path* mask) const override { | 117 bool GetHitTestMask(aura::Window* window, gfx::Path* mask) const override { |
118 mask->addRect(gfx::RectToSkRect(search_box_->GetContentsBounds())); | 118 mask->addRect(gfx::RectToSkRect(search_box_->GetContentsBounds())); |
119 return true; | 119 return true; |
120 } | 120 } |
121 | 121 |
122 views::View* search_box_; | 122 views::View* search_box_; |
123 | 123 |
124 DISALLOW_COPY_AND_ASSIGN(SearchBoxWindowTargeter); | 124 DISALLOW_COPY_AND_ASSIGN(SearchBoxWindowTargeter); |
125 }; | 125 }; |
126 | 126 |
127 // Checks if the fullscreen app list has been enabled via cmd line switch. | |
vadimt
2017/04/19 00:57:15
Returns whether ...
newcomer
2017/04/20 19:59:02
Done.
| |
128 bool IsFullscreenAppListEnabled() { | |
129 return base::CommandLine::ForCurrentProcess()->HasSwitch( | |
130 switches::kEnableFullscreenAppList); | |
131 } | |
132 | |
127 } // namespace | 133 } // namespace |
128 | 134 |
129 // An animation observer to hide the view at the end of the animation. | 135 // An animation observer to hide the view at the end of the animation. |
130 class HideViewAnimationObserver : public ui::ImplicitAnimationObserver { | 136 class HideViewAnimationObserver : public ui::ImplicitAnimationObserver { |
131 public: | 137 public: |
132 HideViewAnimationObserver() | 138 HideViewAnimationObserver() : frame_(NULL), target_(NULL) {} |
133 : frame_(NULL), | |
134 target_(NULL) { | |
135 } | |
136 | 139 |
137 ~HideViewAnimationObserver() override { | 140 ~HideViewAnimationObserver() override { |
138 if (target_) | 141 if (target_) |
139 StopObservingImplicitAnimations(); | 142 StopObservingImplicitAnimations(); |
140 } | 143 } |
141 | 144 |
142 void SetTarget(views::View* target) { | 145 void SetTarget(views::View* target) { |
143 if (target_) | 146 if (target_) |
144 StopObservingImplicitAnimations(); | 147 StopObservingImplicitAnimations(); |
145 target_ = target; | 148 target_ = target; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 delegate_->GetSpeechUI()->AddObserver(this); | 186 delegate_->GetSpeechUI()->AddObserver(this); |
184 } | 187 } |
185 | 188 |
186 AppListView::~AppListView() { | 189 AppListView::~AppListView() { |
187 delegate_->GetSpeechUI()->RemoveObserver(this); | 190 delegate_->GetSpeechUI()->RemoveObserver(this); |
188 animation_observer_.reset(); | 191 animation_observer_.reset(); |
189 // Remove child views first to ensure no remaining dependencies on delegate_. | 192 // Remove child views first to ensure no remaining dependencies on delegate_. |
190 RemoveAllChildViews(true); | 193 RemoveAllChildViews(true); |
191 } | 194 } |
192 | 195 |
196 void AppListView::InitializeFullscreenHelper( | |
197 gfx::NativeView parent, | |
198 int initial_apps_page, | |
199 const gfx::Rect display_work_area_bounds) { | |
200 InitContents(parent, initial_apps_page); | |
201 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); | |
202 set_color(kContentsBackgroundColor); | |
203 views::Widget* widget = new views::Widget; | |
204 views::Widget::InitParams app_list_overlay_view_params( | |
205 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | |
206 | |
207 app_list_overlay_view_params.parent = parent; | |
208 app_list_overlay_view_params.delegate = this; | |
209 | |
210 widget->Init(app_list_overlay_view_params); | |
211 widget->SetBounds(display_work_area_bounds); | |
212 widget->GetLayer()->SetFillsBoundsOpaquely(false); | |
213 widget->GetLayer()->SetBackgroundBlur(10); | |
214 | |
215 InitChildWidgets(); | |
216 overlay_view_ = new AppListOverlayView(0 /* no corners */); | |
217 AddChildView(overlay_view_); | |
218 if (delegate_) | |
219 delegate_->ViewInitialized(); | |
220 } | |
221 | |
222 void AppListView::InitializeBubbleHelper(gfx::NativeView parent, | |
223 int initial_apps_page) { | |
224 InitContents(parent, initial_apps_page); | |
sky
2017/04/19 15:18:51
There is a lot of similar code in the two function
newcomer
2017/04/20 19:59:02
I've refactored the repeated code. Do you have an
| |
225 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); | |
226 set_margins(gfx::Insets()); | |
227 set_parent_window(parent); | |
228 set_close_on_deactivate(false); | |
229 set_shadow(views::BubbleBorder::NO_ASSETS); | |
230 set_color(kContentsBackgroundColor); | |
231 | |
232 // This creates the app list widget. (Before this, child widgets cannot be | |
233 // created.) | |
234 views::BubbleDialogDelegateView::CreateBubble(this); | |
235 | |
236 SetBubbleArrow(views::BubbleBorder::FLOAT); | |
237 // We can now create the internal widgets. | |
238 | |
239 InitChildWidgets(); | |
240 aura::Window* window = GetWidget()->GetNativeWindow(); | |
241 window->SetEventTargeter(base::MakeUnique<views::BubbleWindowTargeter>(this)); | |
242 | |
243 const int kOverlayCornerRadius = | |
244 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(); | |
245 overlay_view_ = new AppListOverlayView(kOverlayCornerRadius); | |
246 overlay_view_->SetBoundsRect(GetContentsBounds()); | |
247 AddChildView(overlay_view_); | |
248 | |
249 if (delegate_) | |
250 delegate_->ViewInitialized(); | |
251 } | |
252 | |
253 void AppListView::Initialize(gfx::NativeView parent, | |
254 int initial_apps_page, | |
255 const gfx::Rect display_work_area_bounds) { | |
256 base::Time start_time = base::Time::Now(); | |
257 | |
258 if (IsFullscreenAppListEnabled()) { | |
259 InitializeFullscreenHelper(parent, initial_apps_page, | |
260 display_work_area_bounds); | |
261 } else { | |
262 InitializeBubbleHelper(parent, initial_apps_page); | |
263 } | |
264 | |
265 UMA_HISTOGRAM_TIMES("Apps.AppListCreationTime", | |
266 base::Time::Now() - start_time); | |
267 } | |
268 | |
193 void AppListView::InitAsBubble(gfx::NativeView parent, int initial_apps_page) { | 269 void AppListView::InitAsBubble(gfx::NativeView parent, int initial_apps_page) { |
194 base::Time start_time = base::Time::Now(); | 270 base::Time start_time = base::Time::Now(); |
195 | 271 |
196 InitContents(parent, initial_apps_page); | 272 InitContents(parent, initial_apps_page); |
197 | 273 |
198 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); | 274 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); |
199 set_margins(gfx::Insets()); | 275 set_margins(gfx::Insets()); |
200 set_parent_window(parent); | 276 set_parent_window(parent); |
201 set_close_on_deactivate(false); | 277 set_close_on_deactivate(false); |
202 set_shadow(views::BubbleBorder::NO_ASSETS); | 278 set_shadow(views::BubbleBorder::NO_ASSETS); |
(...skipping 21 matching lines...) Expand all Loading... | |
224 UMA_HISTOGRAM_TIMES("Apps.AppListCreationTime", | 300 UMA_HISTOGRAM_TIMES("Apps.AppListCreationTime", |
225 base::Time::Now() - start_time); | 301 base::Time::Now() - start_time); |
226 } | 302 } |
227 | 303 |
228 void AppListView::SetBubbleArrow(views::BubbleBorder::Arrow arrow) { | 304 void AppListView::SetBubbleArrow(views::BubbleBorder::Arrow arrow) { |
229 GetBubbleFrameView()->bubble_border()->set_arrow(arrow); | 305 GetBubbleFrameView()->bubble_border()->set_arrow(arrow); |
230 SizeToContents(); // Recalcuates with new border. | 306 SizeToContents(); // Recalcuates with new border. |
231 GetBubbleFrameView()->SchedulePaint(); | 307 GetBubbleFrameView()->SchedulePaint(); |
232 } | 308 } |
233 | 309 |
234 void AppListView::SetAnchorPoint(const gfx::Point& anchor_point) { | 310 void AppListView::SetAnchorPoint(const gfx::Point& anchor_point) { |
vadimt
2017/04/19 00:57:15
MaybeSetAnchorPoint
newcomer
2017/04/20 19:59:01
Done.
| |
235 SetAnchorRect(gfx::Rect(anchor_point, gfx::Size())); | 311 // if the AppListView is a bubble |
312 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
313 app_list::switches::kEnableFullscreenAppList)) { | |
314 SetAnchorRect(gfx::Rect(anchor_point, gfx::Size())); | |
315 } | |
236 } | 316 } |
237 | 317 |
238 void AppListView::SetDragAndDropHostOfCurrentAppList( | 318 void AppListView::SetDragAndDropHostOfCurrentAppList( |
239 ApplicationDragAndDropHost* drag_and_drop_host) { | 319 ApplicationDragAndDropHost* drag_and_drop_host) { |
240 app_list_main_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); | 320 app_list_main_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); |
241 } | 321 } |
242 | 322 |
243 void AppListView::ShowWhenReady() { | 323 void AppListView::ShowWhenReady() { |
244 app_list_main_view_->ShowAppListWhenReady(); | 324 app_list_main_view_->ShowAppListWhenReady(); |
245 } | 325 } |
246 | 326 |
247 void AppListView::CloseAppList() { | 327 void AppListView::CloseAppList() { |
248 app_list_main_view_->Close(); | 328 app_list_main_view_->Close(); |
249 delegate_->Dismiss(); | 329 delegate_->Dismiss(); |
250 } | 330 } |
251 | 331 |
252 void AppListView::UpdateBounds() { | 332 void AppListView::UpdateBounds() { |
253 SizeToContents(); | 333 // if the AppListView is a bubble |
334 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
335 app_list::switches::kEnableFullscreenAppList)) { | |
336 SizeToContents(); | |
337 } | |
254 } | 338 } |
255 | 339 |
256 void AppListView::SetAppListOverlayVisible(bool visible) { | 340 void AppListView::SetAppListOverlayVisible(bool visible) { |
257 DCHECK(overlay_view_); | 341 DCHECK(overlay_view_); |
258 | 342 |
259 // Display the overlay immediately so we can begin the animation. | 343 // Display the overlay immediately so we can begin the animation. |
260 overlay_view_->SetVisible(true); | 344 overlay_view_->SetVisible(true); |
261 | 345 |
262 ui::ScopedLayerAnimationSettings settings( | 346 ui::ScopedLayerAnimationSettings settings( |
263 overlay_view_->layer()->GetAnimator()); | 347 overlay_view_->layer()->GetAnimator()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 } | 381 } |
298 | 382 |
299 void AppListView::OnPaint(gfx::Canvas* canvas) { | 383 void AppListView::OnPaint(gfx::Canvas* canvas) { |
300 views::BubbleDialogDelegateView::OnPaint(canvas); | 384 views::BubbleDialogDelegateView::OnPaint(canvas); |
301 if (!next_paint_callback_.is_null()) { | 385 if (!next_paint_callback_.is_null()) { |
302 next_paint_callback_.Run(); | 386 next_paint_callback_.Run(); |
303 next_paint_callback_.Reset(); | 387 next_paint_callback_.Reset(); |
304 } | 388 } |
305 } | 389 } |
306 | 390 |
391 const char* AppListView::GetClassName() const { | |
392 return "AppListView"; | |
393 } | |
394 | |
307 bool AppListView::ShouldHandleSystemCommands() const { | 395 bool AppListView::ShouldHandleSystemCommands() const { |
308 return true; | 396 return true; |
309 } | 397 } |
310 | 398 |
311 bool AppListView::ShouldDescendIntoChildForEventHandling( | 399 bool AppListView::ShouldDescendIntoChildForEventHandling( |
312 gfx::NativeView child, | 400 gfx::NativeView child, |
313 const gfx::Point& location) { | 401 const gfx::Point& location) { |
314 // While on the start page, don't descend into the custom launcher page. Since | 402 // While on the start page, don't descend into the custom launcher page. Since |
315 // the only valid action is to open it. | 403 // the only valid action is to open it. |
316 ContentsView* contents_view = app_list_main_view_->contents_view(); | 404 ContentsView* contents_view = app_list_main_view_->contents_view(); |
(...skipping 19 matching lines...) Expand all Loading... | |
336 // crbug.com/441028 are fixed. | 424 // crbug.com/441028 are fixed. |
337 tracked_objects::ScopedTracker tracking_profile( | 425 tracked_objects::ScopedTracker tracking_profile( |
338 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 426 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
339 "440224, 441028 AppListView::InitContents")); | 427 "440224, 441028 AppListView::InitContents")); |
340 | 428 |
341 app_list_main_view_ = new AppListMainView(delegate_); | 429 app_list_main_view_ = new AppListMainView(delegate_); |
342 AddChildView(app_list_main_view_); | 430 AddChildView(app_list_main_view_); |
343 app_list_main_view_->SetPaintToLayer(); | 431 app_list_main_view_->SetPaintToLayer(); |
344 app_list_main_view_->layer()->SetFillsBoundsOpaquely(false); | 432 app_list_main_view_->layer()->SetFillsBoundsOpaquely(false); |
345 app_list_main_view_->layer()->SetMasksToBounds(true); | 433 app_list_main_view_->layer()->SetMasksToBounds(true); |
346 | |
347 // This will be added to the |search_box_widget_| after the app list widget is | 434 // This will be added to the |search_box_widget_| after the app list widget is |
348 // initialized. | 435 // initialized. |
349 search_box_view_ = new SearchBoxView(app_list_main_view_, delegate_); | 436 search_box_view_ = new SearchBoxView(app_list_main_view_, delegate_); |
350 search_box_view_->SetPaintToLayer(); | 437 search_box_view_->SetPaintToLayer(); |
351 search_box_view_->layer()->SetFillsBoundsOpaquely(false); | 438 search_box_view_->layer()->SetFillsBoundsOpaquely(false); |
352 search_box_view_->layer()->SetMasksToBounds(true); | 439 search_box_view_->layer()->SetMasksToBounds(true); |
353 | 440 |
354 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and | 441 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and |
355 // crbug.com/441028 are fixed. | 442 // crbug.com/441028 are fixed. |
356 tracked_objects::ScopedTracker tracking_profile1( | 443 tracked_objects::ScopedTracker tracking_profile1( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 GetWidget()->GetFocusTraversable()); | 490 GetWidget()->GetFocusTraversable()); |
404 | 491 |
405 // Mouse events on the search box shadow should not be captured. | 492 // Mouse events on the search box shadow should not be captured. |
406 aura::Window* window = search_box_widget_->GetNativeWindow(); | 493 aura::Window* window = search_box_widget_->GetNativeWindow(); |
407 window->SetEventTargeter( | 494 window->SetEventTargeter( |
408 base::MakeUnique<SearchBoxWindowTargeter>(search_box_view_)); | 495 base::MakeUnique<SearchBoxWindowTargeter>(search_box_view_)); |
409 | 496 |
410 app_list_main_view_->contents_view()->Layout(); | 497 app_list_main_view_->contents_view()->Layout(); |
411 } | 498 } |
412 | 499 |
413 void AppListView::OnBeforeBubbleWidgetInit( | 500 void AppListView::OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, |
414 views::Widget::InitParams* params, | 501 views::Widget* widget) const { |
415 views::Widget* widget) const { | |
416 if (!params->native_widget) { | 502 if (!params->native_widget) { |
417 views::ViewsDelegate* views_delegate = views::ViewsDelegate::GetInstance(); | 503 views::ViewsDelegate* views_delegate = views::ViewsDelegate::GetInstance(); |
418 if (views_delegate && !views_delegate->native_widget_factory().is_null()) { | 504 if (views_delegate && !views_delegate->native_widget_factory().is_null()) { |
419 params->native_widget = | 505 params->native_widget = |
420 views_delegate->native_widget_factory().Run(*params, widget); | 506 views_delegate->native_widget_factory().Run(*params, widget); |
421 } | 507 } |
422 } | 508 } |
423 // Apply a WM-provided shadow (see ui/wm/core/). | 509 // Apply a WM-provided shadow (see ui/wm/core/). |
424 params->shadow_type = views::Widget::InitParams::SHADOW_TYPE_DROP; | 510 params->shadow_type = views::Widget::InitParams::SHADOW_TYPE_DROP; |
425 params->shadow_elevation = wm::ShadowElevation::LARGE; | 511 params->shadow_elevation = wm::ShadowElevation::LARGE; |
426 } | 512 } |
427 | 513 |
428 int AppListView::GetDialogButtons() const { | 514 int AppListView::GetDialogButtons() const { |
429 return ui::DIALOG_BUTTON_NONE; | 515 return ui::DIALOG_BUTTON_NONE; |
430 } | 516 } |
431 | 517 |
432 views::View* AppListView::GetInitiallyFocusedView() { | 518 views::View* AppListView::GetInitiallyFocusedView() { |
433 return app_list_main_view_->search_box_view()->search_box(); | 519 return app_list_main_view_->search_box_view()->search_box(); |
434 } | 520 } |
435 | 521 |
436 bool AppListView::WidgetHasHitTestMask() const { | 522 bool AppListView::WidgetHasHitTestMask() const { |
437 return GetBubbleFrameView() != nullptr; | 523 return GetBubbleFrameView() != nullptr; |
438 } | 524 } |
439 | 525 |
440 void AppListView::GetWidgetHitTestMask(gfx::Path* mask) const { | 526 void AppListView::GetWidgetHitTestMask(gfx::Path* mask) const { |
441 DCHECK(mask); | 527 DCHECK(mask); |
442 DCHECK(GetBubbleFrameView()); | 528 DCHECK(GetBubbleFrameView()); |
443 | 529 |
444 mask->addRect(gfx::RectToSkRect( | 530 mask->addRect(gfx::RectToSkRect(GetBubbleFrameView()->GetContentsBounds())); |
445 GetBubbleFrameView()->GetContentsBounds())); | |
446 } | 531 } |
447 | 532 |
448 bool AppListView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 533 bool AppListView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
449 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code()); | 534 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code()); |
450 | 535 |
451 // If the ContentsView does not handle the back action, then this is the | 536 // If the ContentsView does not handle the back action, then this is the |
452 // top level, so we close the app list. | 537 // top level, so we close the app list. |
453 if (!app_list_main_view_->contents_view()->Back()) { | 538 if (!app_list_main_view_->contents_view()->Back()) { |
454 GetWidget()->Deactivate(); | 539 GetWidget()->Deactivate(); |
455 CloseAppList(); | 540 CloseAppList(); |
(...skipping 12 matching lines...) Expand all Loading... | |
468 centered_bounds.ClampToCenteredSize(gfx::Size( | 553 centered_bounds.ClampToCenteredSize(gfx::Size( |
469 app_list_main_view_->contents_view()->GetDefaultContentsBounds().width(), | 554 app_list_main_view_->contents_view()->GetDefaultContentsBounds().width(), |
470 contents_bounds.height())); | 555 contents_bounds.height())); |
471 | 556 |
472 app_list_main_view_->SetBoundsRect(centered_bounds); | 557 app_list_main_view_->SetBoundsRect(centered_bounds); |
473 | 558 |
474 if (speech_view_) { | 559 if (speech_view_) { |
475 gfx::Rect speech_bounds = centered_bounds; | 560 gfx::Rect speech_bounds = centered_bounds; |
476 int preferred_height = speech_view_->GetPreferredSize().height(); | 561 int preferred_height = speech_view_->GetPreferredSize().height(); |
477 speech_bounds.Inset(kSpeechUIMargin, kSpeechUIMargin); | 562 speech_bounds.Inset(kSpeechUIMargin, kSpeechUIMargin); |
478 speech_bounds.set_height(std::min(speech_bounds.height(), | 563 speech_bounds.set_height( |
479 preferred_height)); | 564 std::min(speech_bounds.height(), preferred_height)); |
480 speech_bounds.Inset(-speech_view_->GetInsets()); | 565 speech_bounds.Inset(-speech_view_->GetInsets()); |
481 speech_view_->SetBoundsRect(speech_bounds); | 566 speech_view_->SetBoundsRect(speech_bounds); |
482 } | 567 } |
483 } | 568 } |
484 | 569 |
485 void AppListView::SchedulePaintInRect(const gfx::Rect& rect) { | 570 void AppListView::SchedulePaintInRect(const gfx::Rect& rect) { |
486 BubbleDialogDelegateView::SchedulePaintInRect(rect); | 571 BubbleDialogDelegateView::SchedulePaintInRect(rect); |
487 if (GetBubbleFrameView()) | 572 if (GetBubbleFrameView()) |
488 GetBubbleFrameView()->SchedulePaint(); | 573 GetBubbleFrameView()->SchedulePaint(); |
489 } | 574 } |
(...skipping 25 matching lines...) Expand all Loading... | |
515 new_state == SPEECH_RECOGNITION_NETWORK_ERROR); | 600 new_state == SPEECH_RECOGNITION_NETWORK_ERROR); |
516 // No change for this class. | 601 // No change for this class. |
517 if (speech_view_->visible() == will_appear) | 602 if (speech_view_->visible() == will_appear) |
518 return; | 603 return; |
519 | 604 |
520 if (will_appear) | 605 if (will_appear) |
521 speech_view_->Reset(); | 606 speech_view_->Reset(); |
522 | 607 |
523 animation_observer_->set_frame(GetBubbleFrameView()); | 608 animation_observer_->set_frame(GetBubbleFrameView()); |
524 gfx::Transform speech_transform; | 609 gfx::Transform speech_transform; |
525 speech_transform.Translate( | 610 speech_transform.Translate(0, SkFloatToMScalar(kSpeechUIAppearingPosition)); |
526 0, SkFloatToMScalar(kSpeechUIAppearingPosition)); | |
527 if (will_appear) | 611 if (will_appear) |
528 speech_view_->layer()->SetTransform(speech_transform); | 612 speech_view_->layer()->SetTransform(speech_transform); |
529 | 613 |
530 { | 614 { |
531 ui::ScopedLayerAnimationSettings main_settings( | 615 ui::ScopedLayerAnimationSettings main_settings( |
532 app_list_main_view_->layer()->GetAnimator()); | 616 app_list_main_view_->layer()->GetAnimator()); |
533 if (will_appear) { | 617 if (will_appear) { |
534 animation_observer_->SetTarget(app_list_main_view_); | 618 animation_observer_->SetTarget(app_list_main_view_); |
535 main_settings.AddObserver(animation_observer_.get()); | 619 main_settings.AddObserver(animation_observer_.get()); |
536 } | 620 } |
(...skipping 30 matching lines...) Expand all Loading... | |
567 app_list_main_view_->SetVisible(true); | 651 app_list_main_view_->SetVisible(true); |
568 // Refocus the search box. However, if the app list widget does not have | 652 // Refocus the search box. However, if the app list widget does not have |
569 // focus, it means another window has already taken focus, and we *must not* | 653 // focus, it means another window has already taken focus, and we *must not* |
570 // focus the search box (or we would steal focus back into the app list). | 654 // focus the search box (or we would steal focus back into the app list). |
571 if (GetWidget()->IsActive()) | 655 if (GetWidget()->IsActive()) |
572 search_box_view_->search_box()->RequestFocus(); | 656 search_box_view_->search_box()->RequestFocus(); |
573 } | 657 } |
574 } | 658 } |
575 | 659 |
576 } // namespace app_list | 660 } // namespace app_list |
OLD | NEW |