| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/common/shelf/shelf_widget.h" | 5 #include "ash/common/shelf/shelf_widget.h" |
| 6 | 6 |
| 7 #include "ash/common/focus_cycler.h" | 7 #include "ash/common/focus_cycler.h" |
| 8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shelf/app_list_button.h" | 10 #include "ash/common/shelf/app_list_button.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 *rb->GetImageSkiaNamed(IDR_ASH_SHELF_BACKGROUND); | 133 *rb->GetImageSkiaNamed(IDR_ASH_SHELF_BACKGROUND); |
| 134 const bool horizontal = wm_shelf_->IsHorizontalAlignment(); | 134 const bool horizontal = wm_shelf_->IsHorizontalAlignment(); |
| 135 if (!horizontal) { | 135 if (!horizontal) { |
| 136 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( | 136 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( |
| 137 shelf_background, wm_shelf_->GetAlignment() == SHELF_ALIGNMENT_LEFT | 137 shelf_background, wm_shelf_->GetAlignment() == SHELF_ALIGNMENT_LEFT |
| 138 ? SkBitmapOperations::ROTATION_90_CW | 138 ? SkBitmapOperations::ROTATION_90_CW |
| 139 : SkBitmapOperations::ROTATION_270_CW); | 139 : SkBitmapOperations::ROTATION_270_CW); |
| 140 } | 140 } |
| 141 const gfx::Rect dock_bounds( | 141 const gfx::Rect dock_bounds( |
| 142 shelf_widget_->shelf_layout_manager()->dock_bounds()); | 142 shelf_widget_->shelf_layout_manager()->dock_bounds()); |
| 143 cc::PaintFlags paint; | 143 cc::PaintFlags flags; |
| 144 paint.setAlpha(asset_background_alpha_); | 144 flags.setAlpha(asset_background_alpha_); |
| 145 canvas->DrawImageInt( | 145 canvas->DrawImageInt( |
| 146 shelf_background, 0, 0, shelf_background.width(), | 146 shelf_background, 0, 0, shelf_background.width(), |
| 147 shelf_background.height(), | 147 shelf_background.height(), |
| 148 (horizontal && dock_bounds.x() == 0 && dock_bounds.width() > 0) | 148 (horizontal && dock_bounds.x() == 0 && dock_bounds.width() > 0) |
| 149 ? dock_bounds.width() | 149 ? dock_bounds.width() |
| 150 : 0, | 150 : 0, |
| 151 0, horizontal ? width() - dock_bounds.width() : width(), height(), false, | 151 0, horizontal ? width() - dock_bounds.width() : width(), height(), false, |
| 152 paint); | 152 flags); |
| 153 if (horizontal && dock_bounds.width() > 0) { | 153 if (horizontal && dock_bounds.width() > 0) { |
| 154 // The part of the shelf background that is in the corner below the docked | 154 // The part of the shelf background that is in the corner below the docked |
| 155 // windows close to the work area is an arched gradient that blends | 155 // windows close to the work area is an arched gradient that blends |
| 156 // vertically oriented docked background and horizontal shelf. | 156 // vertically oriented docked background and horizontal shelf. |
| 157 gfx::ImageSkia shelf_corner = *rb->GetImageSkiaNamed(IDR_ASH_SHELF_CORNER); | 157 gfx::ImageSkia shelf_corner = *rb->GetImageSkiaNamed(IDR_ASH_SHELF_CORNER); |
| 158 if (dock_bounds.x() == 0) { | 158 if (dock_bounds.x() == 0) { |
| 159 shelf_corner = gfx::ImageSkiaOperations::CreateRotatedImage( | 159 shelf_corner = gfx::ImageSkiaOperations::CreateRotatedImage( |
| 160 shelf_corner, SkBitmapOperations::ROTATION_90_CW); | 160 shelf_corner, SkBitmapOperations::ROTATION_90_CW); |
| 161 } | 161 } |
| 162 canvas->DrawImageInt( | 162 canvas->DrawImageInt( |
| 163 shelf_corner, 0, 0, shelf_corner.width(), shelf_corner.height(), | 163 shelf_corner, 0, 0, shelf_corner.width(), shelf_corner.height(), |
| 164 dock_bounds.x() > 0 ? dock_bounds.x() : dock_bounds.width() - height(), | 164 dock_bounds.x() > 0 ? dock_bounds.x() : dock_bounds.width() - height(), |
| 165 0, height(), height(), false, paint); | 165 0, height(), height(), false, flags); |
| 166 // The part of the shelf background that is just below the docked windows | 166 // The part of the shelf background that is just below the docked windows |
| 167 // is drawn using the last (lowest) 1-pixel tall strip of the image asset. | 167 // is drawn using the last (lowest) 1-pixel tall strip of the image asset. |
| 168 // This avoids showing the border 3D shadow between the shelf and the | 168 // This avoids showing the border 3D shadow between the shelf and the |
| 169 // dock. | 169 // dock. |
| 170 canvas->DrawImageInt(shelf_background, 0, shelf_background.height() - 1, | 170 canvas->DrawImageInt(shelf_background, 0, shelf_background.height() - 1, |
| 171 shelf_background.width(), 1, | 171 shelf_background.width(), 1, |
| 172 dock_bounds.x() > 0 ? dock_bounds.x() + height() : 0, | 172 dock_bounds.x() > 0 ? dock_bounds.x() + height() : 0, |
| 173 0, dock_bounds.width() - height(), height(), false, | 173 0, dock_bounds.width() - height(), height(), false, |
| 174 paint); | 174 flags); |
| 175 } | 175 } |
| 176 gfx::Rect black_rect = | 176 gfx::Rect black_rect = |
| 177 shelf_widget_->shelf_layout_manager()->SelectValueForShelfAlignment( | 177 shelf_widget_->shelf_layout_manager()->SelectValueForShelfAlignment( |
| 178 gfx::Rect(0, height() - kNumBlackPixels, width(), kNumBlackPixels), | 178 gfx::Rect(0, height() - kNumBlackPixels, width(), kNumBlackPixels), |
| 179 gfx::Rect(0, 0, kNumBlackPixels, height()), | 179 gfx::Rect(0, 0, kNumBlackPixels, height()), |
| 180 gfx::Rect(width() - kNumBlackPixels, 0, kNumBlackPixels, height())); | 180 gfx::Rect(width() - kNumBlackPixels, 0, kNumBlackPixels, height())); |
| 181 canvas->FillRect(black_rect, SK_ColorBLACK); | 181 canvas->FillRect(black_rect, SK_ColorBLACK); |
| 182 } | 182 } |
| 183 | 183 |
| 184 bool ShelfWidget::DelegateView::CanActivate() const { | 184 bool ShelfWidget::DelegateView::CanActivate() const { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 if (shelf_view_) | 434 if (shelf_view_) |
| 435 shelf_view_->UpdateShelfItemBackground(alpha); | 435 shelf_view_->UpdateShelfItemBackground(alpha); |
| 436 } | 436 } |
| 437 | 437 |
| 438 void ShelfWidget::WillDeleteShelfLayoutManager() { | 438 void ShelfWidget::WillDeleteShelfLayoutManager() { |
| 439 shelf_layout_manager_->RemoveObserver(this); | 439 shelf_layout_manager_->RemoveObserver(this); |
| 440 shelf_layout_manager_ = nullptr; | 440 shelf_layout_manager_ = nullptr; |
| 441 } | 441 } |
| 442 | 442 |
| 443 } // namespace ash | 443 } // namespace ash |
| OLD | NEW |