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

Unified Diff: ui/aura_shell/shadow.cc

Issue 8555025: aura: Draw drop shadows under browsers and menus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor changes 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
« no previous file with comments | « ui/aura_shell/shadow.h ('k') | ui/aura_shell/shadow_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_shell/shadow.cc
diff --git a/ui/aura_shell/shadow.cc b/ui/aura_shell/shadow.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2963dd5af75ffed77ef08aafd9edc94770c763a0
--- /dev/null
+++ b/ui/aura_shell/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_shell/shadow.h"
+
+#include "grit/ui_resources.h"
+#include "ui/aura_shell/image_grid.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace aura_shell {
+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_shell
« no previous file with comments | « ui/aura_shell/shadow.h ('k') | ui/aura_shell/shadow_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698