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

Unified Diff: ui/app_list/views/app_list_view.cc

Issue 276833002: Make the App Info Dialog appear modal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a GetAppListBounds method and moved the bounds logic into the controller Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/app_list_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a7f607da5e433d6c42f89ad864613cc947c1310c..0d74acf9ed8ed459f6e77c276c732a2cfbf6fbf4 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,26 @@ bool SupportsShadow() {
return true;
}
+// An background for a view that appears as a colored rounded rectangle with the
+// given radius and the same size as the target view.
+class ColoredRoundRectBackground : public views::Background {
+ public:
+ ColoredRoundRectBackground(int corner_radius, SkColor color)
+ : corner_radius_(corner_radius), color_(color) {};
+ virtual ~ColoredRoundRectBackground() {};
+
+ virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
+ SkPaint paint;
+ paint.setStyle(SkPaint::kFill_Style);
+ paint.setColor(color_);
+ canvas->DrawRoundRect(view->GetContentsBounds(), corner_radius_, paint);
+ }
+
+ private:
+ const int corner_radius_;
+ const SkColor color_;
+};
+
} // namespace
// An animation observer to hide the view at the end of the animation.
@@ -127,6 +148,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 +216,11 @@ void AppListView::UpdateBounds() {
SizeToContents();
}
+void AppListView::ShowAppListOverlay(bool visible) {
+ DCHECK(overlay_view_);
+ overlay_view_->SetVisible(visible);
+}
+
bool AppListView::ShouldCenterWindow() const {
return delegate_->ShouldCenterWindow();
}
@@ -334,6 +361,24 @@ void AppListView::InitAsBubbleInternal(gfx::NativeView parent,
GetWidget()->Hide();
#endif
+ // The contents corner radius is 1px smaller than border corner radius.
calamity 2014/05/20 08:42:06 Mention that this is needed for platforms where th
+ const int kOverlayCornerRadius =
+ GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius() - 1;
+ const float kOverlayOpacity = 0.75f;
+
+ // To make the overlay view, construct a regular view with a solid white
+ // background, rather than a white rectangle on it. This is because we need
+ // overlay_view_ to be drawn to its own layer (so it appears correctly in the
+ // foreground).
+ overlay_view_ = new views::View();
+ overlay_view_->SetPaintToLayer(true);
+ overlay_view_->set_background(
+ new ColoredRoundRectBackground(kOverlayCornerRadius, SK_ColorWHITE));
+ overlay_view_->layer()->SetOpacity(kOverlayOpacity);
+ overlay_view_->SetBoundsRect(bounds());
+ overlay_view_->SetVisible(false);
+ AddChildView(overlay_view_);
+
if (delegate_)
delegate_->ViewInitialized();
}
« no previous file with comments | « ui/app_list/views/app_list_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698