Chromium Code Reviews| 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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 app_list_main_view_->Close(); | 214 app_list_main_view_->Close(); |
| 215 delegate_->Dismiss(); | 215 delegate_->Dismiss(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void AppListView::UpdateBounds() { | 218 void AppListView::UpdateBounds() { |
| 219 SizeToContents(); | 219 SizeToContents(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void AppListView::SetAppListOverlayVisible(bool visible) { | 222 void AppListView::SetAppListOverlayVisible(bool visible) { |
| 223 DCHECK(overlay_view_); | 223 DCHECK(overlay_view_); |
| 224 overlay_view_->SetVisible(visible); | 224 |
| 225 // Display the overlay immediately so we can begin the animation. | |
| 226 overlay_view_->SetVisible(true); | |
| 227 | |
| 228 ui::ScopedLayerAnimationSettings settings( | |
| 229 overlay_view_->layer()->GetAnimator()); | |
| 230 settings.SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); | |
| 231 | |
| 232 const float kOverlayFadeInMilliseconds = 125; | |
| 233 settings.SetTransitionDuration( | |
| 234 base::TimeDelta::FromMilliseconds(kOverlayFadeInMilliseconds)); | |
| 235 | |
| 236 if (visible == true) { | |
|
calamity
2014/07/31 07:58:11
This can just be
if (visible) {
But if you get r
sashab
2014/08/04 01:19:32
Hmm... I originally thought this might be more con
| |
| 237 const float kOverlayOpacity = 0.75f; | |
| 238 overlay_view_->layer()->SetOpacity(kOverlayOpacity); | |
| 239 } else { | |
| 240 overlay_view_->layer()->SetOpacity(0.0f); | |
| 241 overlay_view_->SetVisible(false); | |
|
calamity
2014/07/31 07:58:11
How does this work? Won't the SetVisible(false) im
sashab
2014/08/04 01:19:33
Yup, it works - no matter how long I set the delay
| |
| 242 } | |
| 225 } | 243 } |
| 226 | 244 |
| 227 bool AppListView::ShouldCenterWindow() const { | 245 bool AppListView::ShouldCenterWindow() const { |
| 228 return delegate_->ShouldCenterWindow(); | 246 return delegate_->ShouldCenterWindow(); |
| 229 } | 247 } |
| 230 | 248 |
| 231 gfx::Size AppListView::GetPreferredSize() const { | 249 gfx::Size AppListView::GetPreferredSize() const { |
| 232 return app_list_main_view_->GetPreferredSize(); | 250 return app_list_main_view_->GetPreferredSize(); |
| 233 } | 251 } |
| 234 | 252 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 // to be shown independently in odd situations. Explicitly hide the bubble | 377 // to be shown independently in odd situations. Explicitly hide the bubble |
| 360 // widget to ensure that any WM_WINDOWPOSCHANGED messages triggered by the | 378 // widget to ensure that any WM_WINDOWPOSCHANGED messages triggered by the |
| 361 // window manager do not have the SWP_SHOWWINDOW flag set which would cause | 379 // window manager do not have the SWP_SHOWWINDOW flag set which would cause |
| 362 // the border to be shown. See http://crbug.com/231687 . | 380 // the border to be shown. See http://crbug.com/231687 . |
| 363 GetWidget()->Hide(); | 381 GetWidget()->Hide(); |
| 364 #endif | 382 #endif |
| 365 | 383 |
| 366 // To make the overlay view, construct a view with a white background, rather | 384 // To make the overlay view, construct a view with a white background, rather |
| 367 // than a white rectangle in it. This is because we need overlay_view_ to be | 385 // than a white rectangle in it. This is because we need overlay_view_ to be |
| 368 // drawn to its own layer (so it appears correctly in the foreground). | 386 // drawn to its own layer (so it appears correctly in the foreground). |
| 369 const float kOverlayOpacity = 0.75f; | |
| 370 overlay_view_ = new views::View(); | 387 overlay_view_ = new views::View(); |
| 371 overlay_view_->SetPaintToLayer(true); | 388 overlay_view_->SetPaintToLayer(true); |
| 372 overlay_view_->layer()->SetOpacity(kOverlayOpacity); | |
| 373 overlay_view_->SetBoundsRect(GetContentsBounds()); | 389 overlay_view_->SetBoundsRect(GetContentsBounds()); |
| 374 overlay_view_->SetVisible(false); | 390 overlay_view_->SetVisible(false); |
| 391 overlay_view_->layer()->SetOpacity(0.0f); | |
| 375 // On platforms that don't support a shadow, the rounded border of the app | 392 // On platforms that don't support a shadow, the rounded border of the app |
| 376 // list is constructed _inside_ the view, so a rectangular background goes | 393 // list is constructed _inside_ the view, so a rectangular background goes |
| 377 // over the border in the rounded corners. To fix this, give the background a | 394 // over the border in the rounded corners. To fix this, give the background a |
| 378 // corner radius 1px smaller than the outer border, so it just reaches but | 395 // corner radius 1px smaller than the outer border, so it just reaches but |
| 379 // doesn't cover it. | 396 // doesn't cover it. |
| 380 const int kOverlayCornerRadius = | 397 const int kOverlayCornerRadius = |
| 381 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(); | 398 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(); |
| 382 overlay_view_->set_background(new AppListOverlayBackground( | 399 overlay_view_->set_background(new AppListOverlayBackground( |
| 383 kOverlayCornerRadius - (SupportsShadow() ? 0 : 1))); | 400 kOverlayCornerRadius - (SupportsShadow() ? 0 : 1))); |
| 384 AddChildView(overlay_view_); | 401 AddChildView(overlay_view_); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 562 speech_view_->layer()->SetTransform(speech_transform); | 579 speech_view_->layer()->SetTransform(speech_transform); |
| 563 } | 580 } |
| 564 | 581 |
| 565 if (will_appear) | 582 if (will_appear) |
| 566 speech_view_->SetVisible(true); | 583 speech_view_->SetVisible(true); |
| 567 else | 584 else |
| 568 app_list_main_view_->SetVisible(true); | 585 app_list_main_view_->SetVisible(true); |
| 569 } | 586 } |
| 570 | 587 |
| 571 } // namespace app_list | 588 } // namespace app_list |
| OLD | NEW |