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

Side by Side Diff: ui/views/corewm/shadow.cc

Issue 11275296: Move shadow code to views\corewm (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/corewm/shadow.h ('k') | ui/views/corewm/shadow_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/wm/shadow.h" 5 #include "ui/views/corewm/shadow.h"
6 6
7 #include "ash/wm/image_grid.h"
8 #include "grit/ash_resources.h"
9 #include "grit/ui_resources.h" 7 #include "grit/ui_resources.h"
10 #include "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/compositor/scoped_layer_animation_settings.h" 9 #include "ui/compositor/scoped_layer_animation_settings.h"
10 #include "ui/views/corewm/image_grid.h"
12 11
13 namespace { 12 namespace {
14 13
15 // Shadow opacity for different styles. 14 // Shadow opacity for different styles.
16 const float kActiveShadowOpacity = 1.0f; 15 const float kActiveShadowOpacity = 1.0f;
17 const float kInactiveShadowOpacity = 0.2f; 16 const float kInactiveShadowOpacity = 0.2f;
18 const float kSmallShadowOpacity = 1.0f; 17 const float kSmallShadowOpacity = 1.0f;
19 18
20 // Duration for opacity animation in milliseconds. 19 // Duration for opacity animation in milliseconds.
21 const int kShadowAnimationDurationMs = 100; 20 const int kShadowAnimationDurationMs = 100;
22 21
23 float GetOpacityForStyle(ash::internal::Shadow::Style style) { 22 float GetOpacityForStyle(views::corewm::Shadow::Style style) {
24 switch (style) { 23 switch (style) {
25 case ash::internal::Shadow::STYLE_ACTIVE: 24 case views::corewm::Shadow::STYLE_ACTIVE:
26 return kActiveShadowOpacity; 25 return kActiveShadowOpacity;
27 case ash::internal::Shadow::STYLE_INACTIVE: 26 case views::corewm::Shadow::STYLE_INACTIVE:
28 return kInactiveShadowOpacity; 27 return kInactiveShadowOpacity;
29 case ash::internal::Shadow::STYLE_SMALL: 28 case views::corewm::Shadow::STYLE_SMALL:
30 return kSmallShadowOpacity; 29 return kSmallShadowOpacity;
31 default: 30 default:
32 NOTREACHED() << "Unhandled style " << style; 31 NOTREACHED() << "Unhandled style " << style;
33 } 32 }
34 return 1.0f; 33 return 1.0f;
35 } 34 }
36 35
37 } // namespace 36 } // namespace
38 37
39 namespace ash { 38 namespace views {
40 namespace internal { 39 namespace corewm {
41 40
42 Shadow::Shadow() : style_(STYLE_ACTIVE) { 41 Shadow::Shadow() : style_(STYLE_ACTIVE) {
43 } 42 }
44 43
45 Shadow::~Shadow() { 44 Shadow::~Shadow() {
46 } 45 }
47 46
48 void Shadow::Init(Style style) { 47 void Shadow::Init(Style style) {
49 style_ = style; 48 style_ = style;
50 image_grid_.reset(new ImageGrid); 49 image_grid_.reset(new ImageGrid);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 164
166 // Image sizes may have changed. 165 // Image sizes may have changed.
167 UpdateImageGridBounds(); 166 UpdateImageGridBounds();
168 } 167 }
169 168
170 void Shadow::UpdateImageGridBounds() { 169 void Shadow::UpdateImageGridBounds() {
171 // Update bounds based on content bounds and image sizes. 170 // Update bounds based on content bounds and image sizes.
172 image_grid_->SetContentBounds(content_bounds_); 171 image_grid_->SetContentBounds(content_bounds_);
173 } 172 }
174 173
175 } // namespace internal 174 } // namespace corewm
176 } // namespace ash 175 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/shadow.h ('k') | ui/views/corewm/shadow_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698