| Index: ash/shelf/shelf_layout_manager.cc
|
| diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
|
| index ff95424866e43eb71462d8b27f3d071040a14ef6..66aa5dac3e60334306ddabcf0debfc5ad4fb80fe 100644
|
| --- a/ash/shelf/shelf_layout_manager.cc
|
| +++ b/ash/shelf/shelf_layout_manager.cc
|
| @@ -12,6 +12,7 @@
|
|
|
| #include "ash/accelerators/accelerator_commands.h"
|
| #include "ash/ash_switches.h"
|
| +#include "ash/material_design/material_design_controller.h"
|
| #include "ash/root_window_controller.h"
|
| #include "ash/screen_util.h"
|
| #include "ash/session/session_state_delegate.h"
|
| @@ -86,18 +87,6 @@ ui::Layer* GetLayer(views::Widget* widget) {
|
|
|
| } // namespace
|
|
|
| -// static
|
| -const int ShelfLayoutManager::kWorkspaceAreaVisibleInset = 2;
|
| -
|
| -// static
|
| -const int ShelfLayoutManager::kWorkspaceAreaAutoHideInset = 5;
|
| -
|
| -// static
|
| -const int ShelfLayoutManager::kAutoHideSize = 3;
|
| -
|
| -// static
|
| -const int ShelfLayoutManager::kShelfItemInset = 3;
|
| -
|
| // ShelfLayoutManager::AutoHideEventFilter -------------------------------------
|
|
|
| // Notifies ShelfLayoutManager any time the mouse moves.
|
| @@ -283,10 +272,12 @@ bool ShelfLayoutManager::IsVisible() const {
|
| gfx::Rect ShelfLayoutManager::GetIdealBounds() {
|
| gfx::Rect rect(ScreenUtil::GetDisplayBoundsInParent(shelf_->GetNativeView()));
|
| return SelectValueForShelfAlignment(
|
| - gfx::Rect(rect.x(), rect.bottom() - kShelfSize, rect.width(), kShelfSize),
|
| - gfx::Rect(rect.x(), rect.y(), kShelfSize, rect.height()),
|
| - gfx::Rect(rect.right() - kShelfSize, rect.y(), kShelfSize,
|
| - rect.height()));
|
| + gfx::Rect(rect.x(), rect.bottom() - GetShelfLayoutConstant(SHELF_SIZE),
|
| + rect.width(), GetShelfLayoutConstant(SHELF_SIZE)),
|
| + gfx::Rect(rect.x(), rect.y(), GetShelfLayoutConstant(SHELF_SIZE),
|
| + rect.height()),
|
| + gfx::Rect(rect.right() - GetShelfLayoutConstant(SHELF_SIZE), rect.y(),
|
| + GetShelfLayoutConstant(SHELF_SIZE), rect.height()));
|
| }
|
|
|
| void ShelfLayoutManager::LayoutShelf() {
|
| @@ -546,6 +537,23 @@ void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) {
|
| LayoutShelf();
|
| }
|
|
|
| +// static
|
| +int ShelfLayoutManager::GetShelfItemInset(
|
| + ShelfLayoutManager::ShelfItemInset constant) {
|
| + const int kShelfItemInset[] = {3, 4};
|
| +
|
| + int mode = MaterialDesignController::Mode::NON_MATERIAL;
|
| + if (MaterialDesignController::IsShelfMaterial())
|
| + mode = MaterialDesignController::Mode::MATERIAL_NORMAL;
|
| +
|
| + switch (constant) {
|
| + case ShelfLayoutManager::ShelfItemInset::SHELF_ITEM_INSET:
|
| + return kShelfItemInset[mode];
|
| + }
|
| + NOTREACHED();
|
| + return 0;
|
| +}
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // ShelfLayoutManager, private:
|
|
|
| @@ -737,7 +745,7 @@ void ShelfLayoutManager::StopAnimating() {
|
|
|
| void ShelfLayoutManager::CalculateTargetBounds(const State& state,
|
| TargetBounds* target_bounds) {
|
| - int shelf_size = kShelfSize;
|
| + int shelf_size = GetShelfLayoutConstant(SHELF_SIZE);
|
| if (state.visibility_state == SHELF_AUTO_HIDE &&
|
| state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN) {
|
| // Auto-hidden shelf always starts with the default size. If a gesture-drag
|
| @@ -770,9 +778,9 @@ void ShelfLayoutManager::CalculateTargetBounds(const State& state,
|
| gfx::Size status_size(
|
| shelf_->status_area_widget()->GetWindowBoundsInScreen().size());
|
| if (IsHorizontalAlignment())
|
| - status_size.set_height(kShelfSize);
|
| + status_size.set_height(GetShelfLayoutConstant(SHELF_SIZE));
|
| else
|
| - status_size.set_width(kShelfSize);
|
| + status_size.set_width(GetShelfLayoutConstant(SHELF_SIZE));
|
|
|
| gfx::Point status_origin = SelectValueForShelfAlignment(
|
| gfx::Point(0, 0),
|
| @@ -856,7 +864,7 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
|
| // changed since then, e.g. because the tray-menu was shown because of the
|
| // drag), then allow the drag some resistance-free region at first to make
|
| // sure the shelf sticks with the finger until the shelf is visible.
|
| - resistance_free_region = kShelfSize - kAutoHideSize;
|
| + resistance_free_region = GetShelfLayoutConstant(SHELF_SIZE) - kAutoHideSize;
|
| }
|
|
|
| bool resist = SelectValueForShelfAlignment(
|
| @@ -907,7 +915,7 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
|
| else
|
| target_bounds->status_bounds_in_shelf.set_x(
|
| target_bounds->shelf_bounds_in_root.width() -
|
| - kShelfSize);
|
| + GetShelfLayoutConstant(SHELF_SIZE));
|
| }
|
| }
|
|
|
|
|