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

Unified Diff: ash/wm/panels/panel_layout_manager.cc

Issue 1743493002: Cleanup ash shelf accessor functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert ash/shelf/shelf_widget.cc for browser_tests crash... Created 4 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
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.cc ('k') | ash/wm/panels/panel_layout_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/panels/panel_layout_manager.cc
diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc
index fdb6e0743a9e4061e62362cea2fcfda3c5cf66ea..e1bd6a70647b13be63659b4293807e3cdcdc53f8 100644
--- a/ash/wm/panels/panel_layout_manager.cc
+++ b/ash/wm/panels/panel_layout_manager.cc
@@ -311,8 +311,8 @@ void PanelLayoutManager::SetShelf(Shelf* shelf) {
DCHECK(!shelf_layout_manager_);
shelf_ = shelf;
shelf_->AddIconObserver(this);
- if (shelf_->shelf_widget()) {
- shelf_layout_manager_ = shelf_->shelf_widget()->shelf_layout_manager();
+ if (shelf_->shelf_layout_manager()) {
+ shelf_layout_manager_ = shelf_->shelf_layout_manager();
WillChangeVisibilityState(shelf_layout_manager_->visibility_state());
shelf_layout_manager_->AddObserver(this);
}
@@ -584,8 +584,7 @@ void PanelLayoutManager::MinimizePanel(aura::Window* panel) {
panel_slide_settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kPanelSlideDurationMilliseconds));
gfx::Rect bounds(panel->bounds());
- bounds.Offset(GetSlideInAnimationOffset(
- shelf_->shelf_widget()->GetAlignment()));
+ bounds.Offset(GetSlideInAnimationOffset(shelf_->alignment()));
SetChildBoundsDirect(panel, bounds);
panel->Hide();
layer->SetOpacity(0);
@@ -618,9 +617,8 @@ void PanelLayoutManager::Relayout() {
return;
base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true);
- ShelfAlignment alignment = shelf_->shelf_widget()->GetAlignment();
- bool horizontal = alignment == SHELF_ALIGNMENT_TOP ||
- alignment == SHELF_ALIGNMENT_BOTTOM;
+ const ShelfAlignment alignment = shelf_->alignment();
+ const bool horizontal = shelf_->IsHorizontalAlignment();
gfx::Rect shelf_bounds = ash::ScreenUtil::ConvertRectFromScreen(
panel_container_, shelf_->shelf_widget()->GetWindowBoundsInScreen());
int panel_start_bounds = kPanelIdealSpacing;
@@ -778,10 +776,6 @@ void PanelLayoutManager::UpdateStacking(aura::Window* active_panel) {
active_panel = last_active_panel_;
}
- ShelfAlignment alignment = shelf_->alignment();
- bool horizontal = alignment == SHELF_ALIGNMENT_TOP ||
- alignment == SHELF_ALIGNMENT_BOTTOM;
-
// We want to to stack the panels like a deck of cards:
// ,--,--,--,-------.--.--.
// | | | | | | |
@@ -792,6 +786,7 @@ void PanelLayoutManager::UpdateStacking(aura::Window* active_panel) {
// the titlebar--even though it doesn't update the shelf icon positions, we
// still want the visual effect.
std::map<int, aura::Window*> window_ordering;
+ const bool horizontal = shelf_->IsHorizontalAlignment();
for (PanelList::const_iterator it = panel_windows_.begin();
it != panel_windows_.end(); ++it) {
gfx::Rect bounds = it->window->bounds();
@@ -826,10 +821,7 @@ void PanelLayoutManager::UpdateStacking(aura::Window* active_panel) {
}
void PanelLayoutManager::UpdateCallouts() {
- ShelfAlignment alignment = shelf_->alignment();
- bool horizontal = alignment == SHELF_ALIGNMENT_TOP ||
- alignment == SHELF_ALIGNMENT_BOTTOM;
-
+ const bool horizontal = shelf_->IsHorizontalAlignment();
for (PanelList::iterator iter = panel_windows_.begin();
iter != panel_windows_.end(); ++iter) {
aura::Window* panel = iter->window;
@@ -865,7 +857,7 @@ void PanelLayoutManager::UpdateCallouts() {
current_bounds.y() - callout_bounds.y(),
callout_bounds.bottom() - current_bounds.bottom());
}
- switch (alignment) {
+ switch (shelf_->alignment()) {
case SHELF_ALIGNMENT_BOTTOM:
callout_bounds.set_y(bounds.bottom());
break;
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.cc ('k') | ash/wm/panels/panel_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698