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

Unified Diff: ash/shelf/shelf_widget.cc

Issue 1914093002: Refactors DockedWindowLayoutManager in terms of ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nuke_aura_window
Patch Set: merge 2 trunk Created 4 years, 8 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/shelf/shelf_widget.cc
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc
index 01e6cbf632d37867eb78555d85822ee341ed0d90..2bb1015ffa30f8f855b2d12954f341e6a07bb279 100644
--- a/ash/shelf/shelf_widget.cc
+++ b/ash/shelf/shelf_widget.cc
@@ -19,6 +19,7 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/system/tray/system_tray_delegate.h"
+#include "ash/wm/common/shelf/wm_shelf_constants.h"
#include "ash/wm/status_area_layout_manager.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/workspace_controller.h"
@@ -182,7 +183,7 @@ void DimmerView::OnPaintBackground(gfx::Canvas* canvas) {
if (!IsHorizontalAlignment(shelf_->GetAlignment())) {
shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage(
- shelf_background, shelf_->GetAlignment() == SHELF_ALIGNMENT_LEFT
+ shelf_background, shelf_->GetAlignment() == wm::SHELF_ALIGNMENT_LEFT
? SkBitmapOperations::ROTATION_90_CW
: SkBitmapOperations::ROTATION_270_CW);
}
@@ -252,10 +253,11 @@ class ShelfWindowTargeter : public ::wm::EasyResizeWindowTargeter,
}
private:
- gfx::Insets GetInsetsForAlignment(int distance, ShelfAlignment alignment) {
- if (alignment == SHELF_ALIGNMENT_LEFT)
+ gfx::Insets GetInsetsForAlignment(int distance,
+ wm::ShelfAlignment alignment) {
+ if (alignment == wm::SHELF_ALIGNMENT_LEFT)
return gfx::Insets(0, 0, 0, distance);
- if (alignment == SHELF_ALIGNMENT_RIGHT)
+ if (alignment == wm::SHELF_ALIGNMENT_RIGHT)
return gfx::Insets(0, distance, 0, 0);
return gfx::Insets(distance, 0, 0, 0);
}
@@ -452,7 +454,7 @@ void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) {
const bool horizontal = IsHorizontalAlignment(shelf_->GetAlignment());
if (!horizontal) {
shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage(
- shelf_background, shelf_->GetAlignment() == SHELF_ALIGNMENT_LEFT
+ shelf_background, shelf_->GetAlignment() == wm::SHELF_ALIGNMENT_LEFT
? SkBitmapOperations::ROTATION_90_CW
: SkBitmapOperations::ROTATION_270_CW);
}
@@ -557,7 +559,7 @@ ShelfWidget::ShelfWidget(aura::Window* shelf_container,
aura::Window* status_container,
WorkspaceController* workspace_controller)
: delegate_view_(new DelegateView(this)),
- background_animator_(delegate_view_, 0, kShelfBackgroundAlpha),
+ background_animator_(delegate_view_, 0, wm::kShelfBackgroundAlpha),
activating_as_fallback_(false),
window_container_(shelf_container) {
views::Widget::InitParams params(
@@ -605,17 +607,17 @@ ShelfWidget::~ShelfWidget() {
}
void ShelfWidget::SetPaintsBackground(
- ShelfBackgroundType background_type,
+ wm::ShelfBackgroundType background_type,
BackgroundAnimatorChangeType change_type) {
ui::Layer* opaque_background = delegate_view_->opaque_background();
float target_opacity =
- (background_type == SHELF_BACKGROUND_MAXIMIZED) ? 1.0f : 0.0f;
+ (background_type == wm::SHELF_BACKGROUND_MAXIMIZED) ? 1.0f : 0.0f;
std::unique_ptr<ui::ScopedLayerAnimationSettings> opaque_background_animation;
if (change_type != BACKGROUND_CHANGE_IMMEDIATE) {
opaque_background_animation.reset(new ui::ScopedLayerAnimationSettings(
opaque_background->GetAnimator()));
opaque_background_animation->SetTransitionDuration(
- base::TimeDelta::FromMilliseconds(kTimeToSwitchBackgroundMs));
+ base::TimeDelta::FromMilliseconds(wm::kTimeToSwitchBackgroundMs));
}
opaque_background->SetOpacity(target_opacity);
@@ -623,18 +625,17 @@ void ShelfWidget::SetPaintsBackground(
// retire background_animator_ at all. It would be simpler.
// See also DockedBackgroundWidget::SetPaintsBackground.
background_animator_.SetPaintsBackground(
- background_type != SHELF_BACKGROUND_DEFAULT,
- change_type);
+ background_type != wm::SHELF_BACKGROUND_DEFAULT, change_type);
delegate_view_->SchedulePaint();
}
-ShelfBackgroundType ShelfWidget::GetBackgroundType() const {
+wm::ShelfBackgroundType ShelfWidget::GetBackgroundType() const {
if (delegate_view_->opaque_background()->GetTargetOpacity() == 1.0f)
- return SHELF_BACKGROUND_MAXIMIZED;
+ return wm::SHELF_BACKGROUND_MAXIMIZED;
if (background_animator_.paints_background())
- return SHELF_BACKGROUND_OVERLAP;
+ return wm::SHELF_BACKGROUND_OVERLAP;
- return SHELF_BACKGROUND_DEFAULT;
+ return wm::SHELF_BACKGROUND_DEFAULT;
}
void ShelfWidget::HideShelfBehindBlackBar(bool hide, int animation_time_ms) {
@@ -685,9 +686,9 @@ bool ShelfWidget::ShelfAlignmentAllowed() {
return false;
}
-ShelfAlignment ShelfWidget::GetAlignment() const {
+wm::ShelfAlignment ShelfWidget::GetAlignment() const {
// TODO(msw): This should not be called before |shelf_| is created.
- return shelf_ ? shelf_->alignment() : SHELF_ALIGNMENT_BOTTOM_LOCKED;
+ return shelf_ ? shelf_->alignment() : wm::SHELF_ALIGNMENT_BOTTOM_LOCKED;
}
void ShelfWidget::OnShelfAlignmentChanged() {

Powered by Google App Engine
This is Rietveld 408576698