| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mus/shadow.h" | 5 #include "ash/mus/shadow.h" |
| 6 | 6 |
| 7 #include "ash/mus/property_util.h" | 7 #include "ash/mus/property_util.h" |
| 8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // The opacity will be reset to 1.0f when animation is completed. | 137 // The opacity will be reset to 1.0f when animation is completed. |
| 138 shadow_layer_->SetOpacity(kInactiveShadowAnimationOpacity); | 138 shadow_layer_->SetOpacity(kInactiveShadowAnimationOpacity); |
| 139 break; | 139 break; |
| 140 default: | 140 default: |
| 141 NOTREACHED() << "Unhandled style " << style_; | 141 NOTREACHED() << "Unhandled style " << style_; |
| 142 break; | 142 break; |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 void Shadow::Install(::ui::Window* window) { | 147 void Shadow::Install(ui::Window* window) { |
| 148 SetShadow(window, this); | 148 SetShadow(window, this); |
| 149 window_ = window; | 149 window_ = window; |
| 150 window_->AddObserver(this); | 150 window_->AddObserver(this); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void Shadow::OnImplicitAnimationsCompleted() { | 153 void Shadow::OnImplicitAnimationsCompleted() { |
| 154 // If we just finished going inactive, switch images. This doesn't cause | 154 // If we just finished going inactive, switch images. This doesn't cause |
| 155 // a visual pop because the inactive image opacity is so low. | 155 // a visual pop because the inactive image opacity is so low. |
| 156 if (style_ == STYLE_INACTIVE) { | 156 if (style_ == STYLE_INACTIVE) { |
| 157 UpdateImagesForStyle(); | 157 UpdateImagesForStyle(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // |interior_inset_|. The occlusion area also has to be shrinked to | 210 // |interior_inset_|. The occlusion area also has to be shrinked to |
| 211 // allow rounded corners overdrawing on top of the window's content. | 211 // allow rounded corners overdrawing on top of the window's content. |
| 212 gfx::Rect content_bounds( | 212 gfx::Rect content_bounds( |
| 213 content_bounds_.x() + interior_inset_ + kRoundedCornerRadius, | 213 content_bounds_.x() + interior_inset_ + kRoundedCornerRadius, |
| 214 content_bounds_.y() + interior_inset_ + kRoundedCornerRadius, | 214 content_bounds_.y() + interior_inset_ + kRoundedCornerRadius, |
| 215 content_bounds_.width() - 2 * kRoundedCornerRadius, | 215 content_bounds_.width() - 2 * kRoundedCornerRadius, |
| 216 content_bounds_.height() - 2 * kRoundedCornerRadius); | 216 content_bounds_.height() - 2 * kRoundedCornerRadius); |
| 217 shadow_layer_->UpdateNinePatchOcclusion(content_bounds); | 217 shadow_layer_->UpdateNinePatchOcclusion(content_bounds); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void Shadow::OnWindowDestroyed(::ui::Window* window) { | 220 void Shadow::OnWindowDestroyed(ui::Window* window) { |
| 221 DCHECK_EQ(window_, window); | 221 DCHECK_EQ(window_, window); |
| 222 window_ = nullptr; | 222 window_ = nullptr; |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace mus | 225 } // namespace mus |
| 226 } // namespace ash | 226 } // namespace ash |
| OLD | NEW |