| Index: ui/app_list/views/app_list_view.cc
|
| diff --git a/ui/app_list/views/app_list_view.cc b/ui/app_list/views/app_list_view.cc
|
| index 7857271768cc3a70e5e547a038d37ae606946ccc..e1da9a150cde08af5f355a71d37fcc411e989f74 100644
|
| --- a/ui/app_list/views/app_list_view.cc
|
| +++ b/ui/app_list/views/app_list_view.cc
|
| @@ -28,6 +28,7 @@
|
| #include "ui/compositor/layer.h"
|
| #include "ui/compositor/layer_animation_observer.h"
|
| #include "ui/compositor/scoped_layer_animation_settings.h"
|
| +#include "ui/gfx/canvas.h"
|
| #include "ui/gfx/image/image_skia.h"
|
| #include "ui/gfx/insets.h"
|
| #include "ui/gfx/path.h"
|
| @@ -78,6 +79,28 @@ bool SupportsShadow() {
|
| return true;
|
| }
|
|
|
| +// The background for the App List overlay, which appears as a white rounded
|
| +// rectangle with the given radius and the same size as the target view.
|
| +class AppListOverlayBackground : public views::Background {
|
| + public:
|
| + AppListOverlayBackground(int corner_radius)
|
| + : corner_radius_(corner_radius) {};
|
| + virtual ~AppListOverlayBackground() {};
|
| +
|
| + // Overridden from views::Background:
|
| + virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
|
| + SkPaint paint;
|
| + paint.setStyle(SkPaint::kFill_Style);
|
| + paint.setColor(SK_ColorWHITE);
|
| + canvas->DrawRoundRect(view->GetContentsBounds(), corner_radius_, paint);
|
| + }
|
| +
|
| + private:
|
| + const int corner_radius_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(AppListOverlayBackground);
|
| +};
|
| +
|
| } // namespace
|
|
|
| // An animation observer to hide the view at the end of the animation.
|
| @@ -127,6 +150,7 @@ AppListView::AppListView(AppListViewDelegate* delegate)
|
| app_list_main_view_(NULL),
|
| signin_view_(NULL),
|
| speech_view_(NULL),
|
| + overlay_view_(NULL),
|
| animation_observer_(new HideViewAnimationObserver()) {
|
| CHECK(delegate);
|
|
|
| @@ -194,6 +218,11 @@ void AppListView::UpdateBounds() {
|
| SizeToContents();
|
| }
|
|
|
| +void AppListView::SetAppListOverlayVisible(bool visible) {
|
| + DCHECK(overlay_view_);
|
| + overlay_view_->SetVisible(visible);
|
| +}
|
| +
|
| bool AppListView::ShouldCenterWindow() const {
|
| return delegate_->ShouldCenterWindow();
|
| }
|
| @@ -334,6 +363,28 @@ void AppListView::InitAsBubbleInternal(gfx::NativeView parent,
|
| GetWidget()->Hide();
|
| #endif
|
|
|
| + // To make the overlay view, construct a view with a white background, rather
|
| + // than a white rectangle in it. This is because we need overlay_view_ to be
|
| + // drawn to its own layer (so it appears correctly in the foreground).
|
| + const float kOverlayOpacity = 0.75f;
|
| + overlay_view_ = new views::View();
|
| + overlay_view_->SetPaintToLayer(true);
|
| + overlay_view_->layer()->SetOpacity(kOverlayOpacity);
|
| + overlay_view_->SetBoundsRect(GetContentsBounds());
|
| + overlay_view_->SetVisible(false);
|
| +
|
| + // On platforms that don't support a shadow, the rounded border of the app
|
| + // list is constructed _inside_ the view, so a rectangular background goes
|
| + // over the border in the rounded corners. To fix this, give the background a
|
| + // corner radius 1px smaller than the outer border, so it just reaches but
|
| + // doesn't cover it.
|
| + const int kOverlayCornerRadius =
|
| + GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius();
|
| + overlay_view_->set_background(new AppListOverlayBackground(
|
| + kOverlayCornerRadius - (SupportsShadow() ? 0 : 1)));
|
| +
|
| + AddChildView(overlay_view_);
|
| +
|
| if (delegate_)
|
| delegate_->ViewInitialized();
|
| }
|
|
|