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

Unified Diff: ash/common/wm/dock/docked_window_layout_manager.cc

Issue 2680113002: [ash-md] Remove non-md code from the Shelf background animations. (Closed)
Patch Set: Created 3 years, 10 months 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: ash/common/wm/dock/docked_window_layout_manager.cc
diff --git a/ash/common/wm/dock/docked_window_layout_manager.cc b/ash/common/wm/dock/docked_window_layout_manager.cc
index 99b361319bd6d0c7c9fac665531fd7405926c115..a656bfa63256f1870ffcfab0901a5e1b4435febc 100644
--- a/ash/common/wm/dock/docked_window_layout_manager.cc
+++ b/ash/common/wm/dock/docked_window_layout_manager.cc
@@ -4,7 +4,6 @@
#include "ash/common/wm/dock/docked_window_layout_manager.h"
-#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/shelf/shelf_background_animator.h"
#include "ash/common/shelf/shelf_background_animator_observer.h"
#include "ash/common/shelf/shelf_constants.h"
@@ -25,11 +24,9 @@
#include "grit/ash_resources.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/resource/resource_bundle.h"
-#include "ui/compositor/paint_recorder.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
-#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image_skia_operations.h"
James Cook 2017/02/07 23:50:16 Can this be removed?
bruthig 2017/02/08 21:05:29 Done.
#include "ui/views/background.h"
@@ -57,7 +54,6 @@ class DockedBackgroundWidget : public views::Widget,
: manager_(manager),
alignment_(DOCKED_ALIGNMENT_NONE),
background_animator_(SHELF_BACKGROUND_DEFAULT, nullptr),
- asset_background_alpha_(0),
opaque_background_(ui::LAYER_SOLID_COLOR),
visible_background_type_(manager_->shelf()->GetBackgroundType()),
visible_background_change_type_(BACKGROUND_CHANGE_IMMEDIATE) {
@@ -86,46 +82,12 @@ class DockedBackgroundWidget : public views::Widget,
UpdateBackground();
}
- void OnNativeWidgetPaint(const ui::PaintContext& context) override {
- gfx::Rect local_window_bounds(GetWindowBoundsInScreen().size());
- ui::PaintRecorder recorder(context, local_window_bounds.size());
-
- if (!MaterialDesignController::IsShelfMaterial()) {
- const gfx::ImageSkia& shelf_background(alignment_ == DOCKED_ALIGNMENT_LEFT
- ? shelf_background_left_
- : shelf_background_right_);
- cc::PaintFlags paint;
- paint.setAlpha(asset_background_alpha_);
- recorder.canvas()->DrawImageInt(
- shelf_background, 0, 0, shelf_background.width(),
- shelf_background.height(),
- alignment_ == DOCKED_ALIGNMENT_LEFT
- ? local_window_bounds.width() - shelf_background.width()
- : 0,
- 0, shelf_background.width(), local_window_bounds.height(), false,
- paint);
- recorder.canvas()->DrawImageInt(
- shelf_background,
- alignment_ == DOCKED_ALIGNMENT_LEFT ? 0
- : shelf_background.width() - 1,
- 0, 1, shelf_background.height(),
- alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(), 0,
- local_window_bounds.width() - shelf_background.width(),
- local_window_bounds.height(), false, paint);
- }
- }
-
// ShelfBackgroundAnimatorObserver:
void UpdateShelfOpaqueBackground(int alpha) override {
const float kMaxAlpha = 255.0f;
opaque_background_.SetOpacity(alpha / kMaxAlpha);
}
- void UpdateShelfAssetBackground(int alpha) override {
- asset_background_alpha_ = alpha;
- SchedulePaintInRect(gfx::Rect(GetWindowBoundsInScreen().size()));
- }
-
// WmShelfObserver:
void OnBackgroundTypeChanged(
ShelfBackgroundType background_type,
@@ -158,16 +120,6 @@ class DockedBackgroundWidget : public views::Widget,
opaque_background_.SetOpacity(0.0f);
wm_window->GetLayer()->Add(&opaque_background_);
- if (!MaterialDesignController::IsShelfMaterial()) {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- gfx::ImageSkia shelf_background =
- *rb.GetImageSkiaNamed(IDR_ASH_SHELF_BACKGROUND);
- shelf_background_left_ = gfx::ImageSkiaOperations::CreateRotatedImage(
- shelf_background, SkBitmapOperations::ROTATION_90_CW);
- shelf_background_right_ = gfx::ImageSkiaOperations::CreateRotatedImage(
- shelf_background, SkBitmapOperations::ROTATION_270_CW);
- }
-
// This background should be explicitly stacked below any windows already in
// the dock, otherwise the z-order is set by the order in which windows were
// added to the container, and UpdateStacking only manages user windows, not
@@ -194,19 +146,9 @@ class DockedBackgroundWidget : public views::Widget,
// The animator for the background transitions.
ShelfBackgroundAnimator background_animator_;
- // The alpha to use for drawing image assets covering the docked background.
- int asset_background_alpha_;
-
- // TODO(bruthig): Remove opaque_background_ (see https://crbug.com/621551).
James Cook 2017/02/07 23:50:16 ditto. It seems like the bug needs an update and t
bruthig 2017/02/08 21:05:29 Originally I was planning to update issue 621551 a
// Solid black background that can be made fully opaque.
ui::Layer opaque_background_;
- // Backgrounds created from shelf background by 90 or 270 degree rotation.
- // TODO(tdanderson): These members can be removed once the material design
- // shelf is enabled by default. See crbug.com/614453.
- gfx::ImageSkia shelf_background_left_;
- gfx::ImageSkia shelf_background_right_;
-
// The background type to use when the widget is visible. When not visible,
// the widget uses SHELF_BACKGROUND_DEFAULT.
ShelfBackgroundType visible_background_type_;

Powered by Google App Engine
This is Rietveld 408576698