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

Unified Diff: ui/aura/shadow.cc

Issue 8555025: aura: Draw drop shadows under browsers and menus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
Index: ui/aura/shadow.cc
diff --git a/ui/aura/shadow.cc b/ui/aura/shadow.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f7f5852ba4834e29ce157cf8c63d26a2e4e25caa
--- /dev/null
+++ b/ui/aura/shadow.cc
@@ -0,0 +1,54 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/aura/shadow.h"
+
+#include "grit/ui_resources.h"
+#include "ui/aura/image_grid.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace aura {
+namespace internal {
+
+Shadow::Shadow() {
+}
+
+Shadow::~Shadow() {
+}
+
+ui::Layer* Shadow::layer() const { return image_grid_->layer(); }
+
+void Shadow::Init() {
+ image_grid_.reset(new ImageGrid);
+
+ ResourceBundle& res = ResourceBundle::GetSharedInstance();
+ image_grid_->Init(&res.GetImageNamed(IDR_AURA_SHADOW_RECT_TOP_LEFT),
+ &res.GetImageNamed(IDR_AURA_SHADOW_RECT_TOP),
+ &res.GetImageNamed(IDR_AURA_SHADOW_RECT_TOP_RIGHT),
+ &res.GetImageNamed(IDR_AURA_SHADOW_RECT_LEFT),
+ NULL,
+ &res.GetImageNamed(IDR_AURA_SHADOW_RECT_RIGHT),
+ &res.GetImageNamed(IDR_AURA_SHADOW_RECT_BOTTOM_LEFT),
+ &res.GetImageNamed(IDR_AURA_SHADOW_RECT_BOTTOM),
+ &res.GetImageNamed(IDR_AURA_SHADOW_RECT_BOTTOM_RIGHT));
+}
+
+void Shadow::SetContentBounds(const gfx::Rect& content_bounds) {
+ content_bounds_ = content_bounds;
+ image_grid_->SetSize(
+ gfx::Size(content_bounds.width() +
+ image_grid_->left_image_width() +
+ image_grid_->right_image_width(),
+ content_bounds.height() +
+ image_grid_->top_image_height() +
+ image_grid_->bottom_image_height()));
+ image_grid_->layer()->SetBounds(
+ gfx::Rect(content_bounds.x() - image_grid_->left_image_width(),
+ content_bounds.y() - image_grid_->top_image_height(),
+ image_grid_->layer()->bounds().width(),
+ image_grid_->layer()->bounds().height()));
+}
+
+} // namespace internal
+} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698