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

Side by Side Diff: ash/shelf/shelf_layout_manager.cc

Issue 2201323004: mash: Use wm::WmSnapToPixelLayoutManager for the shelf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also convert the StatusAreaLayoutManager. Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/shelf/shelf_widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/shelf/shelf_layout_manager.h" 5 #include "ash/shelf/shelf_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 private: 187 private:
188 ShelfLayoutManager* shelf_layout_manager_; 188 ShelfLayoutManager* shelf_layout_manager_;
189 WmRootWindowController* root_window_controller_; 189 WmRootWindowController* root_window_controller_;
190 190
191 DISALLOW_COPY_AND_ASSIGN(RootWindowControllerObserverImpl); 191 DISALLOW_COPY_AND_ASSIGN(RootWindowControllerObserverImpl);
192 }; 192 };
193 193
194 // ShelfLayoutManager ---------------------------------------------------------- 194 // ShelfLayoutManager ----------------------------------------------------------
195 195
196 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf_widget) 196 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf_widget)
197 : SnapToPixelLayoutManager(shelf_widget->GetNativeView()->parent()), 197 : root_window_(shelf_widget->GetNativeView()->GetRootWindow()),
198 root_window_(shelf_widget->GetNativeView()->GetRootWindow()),
199 updating_bounds_(false), 198 updating_bounds_(false),
200 shelf_widget_(shelf_widget), 199 shelf_widget_(shelf_widget),
201 workspace_controller_(NULL), 200 workspace_controller_(NULL),
202 window_overlaps_shelf_(false), 201 window_overlaps_shelf_(false),
203 mouse_over_shelf_when_auto_hide_timer_started_(false), 202 mouse_over_shelf_when_auto_hide_timer_started_(false),
204 bezel_event_filter_(new ShelfBezelEventFilter(this)), 203 bezel_event_filter_(new ShelfBezelEventFilter(this)),
205 gesture_drag_status_(GESTURE_DRAG_NONE), 204 gesture_drag_status_(GESTURE_DRAG_NONE),
206 gesture_drag_amount_(0.f), 205 gesture_drag_amount_(0.f),
207 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), 206 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN),
208 update_shelf_observer_(NULL), 207 update_shelf_observer_(NULL),
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 UpdateVisibilityState(); 492 UpdateVisibilityState();
494 gesture_drag_status_ = GESTURE_DRAG_NONE; 493 gesture_drag_status_ = GESTURE_DRAG_NONE;
495 } 494 }
496 495
497 void ShelfLayoutManager::SetAnimationDurationOverride( 496 void ShelfLayoutManager::SetAnimationDurationOverride(
498 int duration_override_in_ms) { 497 int duration_override_in_ms) {
499 duration_override_in_ms_ = duration_override_in_ms; 498 duration_override_in_ms_ = duration_override_in_ms;
500 } 499 }
501 500
502 //////////////////////////////////////////////////////////////////////////////// 501 ////////////////////////////////////////////////////////////////////////////////
503 // ShelfLayoutManager, aura::LayoutManager implementation: 502 // ShelfLayoutManager, wm::WmSnapToPixelLayoutManager implementation:
504 503
505 void ShelfLayoutManager::OnWindowResized() { 504 void ShelfLayoutManager::OnWindowResized() {
506 LayoutShelf(); 505 LayoutShelf();
507 } 506 }
508 507
509 void ShelfLayoutManager::SetChildBounds(aura::Window* child, 508 void ShelfLayoutManager::SetChildBounds(WmWindow* child,
510 const gfx::Rect& requested_bounds) { 509 const gfx::Rect& requested_bounds) {
511 SnapToPixelLayoutManager::SetChildBounds(child, requested_bounds); 510 wm::WmSnapToPixelLayoutManager::SetChildBounds(child, requested_bounds);
512 // We may contain other widgets (such as frame maximize bubble) but they don't 511 // We may contain other widgets (such as frame maximize bubble) but they don't
513 // effect the layout in anyway. 512 // effect the layout in anyway.
514 if (!updating_bounds_ && 513 if (!updating_bounds_ &&
515 ((shelf_widget_->GetNativeView() == child) || 514 ((WmLookup::Get()->GetWindowForWidget(shelf_widget_) == child) ||
516 (shelf_widget_->status_area_widget()->GetNativeView() == child))) { 515 (WmLookup::Get()->GetWindowForWidget(
516 shelf_widget_->status_area_widget()) == child))) {
517 LayoutShelf(); 517 LayoutShelf();
518 } 518 }
519 } 519 }
520 520
521 void ShelfLayoutManager::OnLockStateChanged(bool locked) { 521 void ShelfLayoutManager::OnLockStateChanged(bool locked) {
522 // Force the shelf to layout for alignment (bottom if locked, restore 522 // Force the shelf to layout for alignment (bottom if locked, restore
523 // the previous alignment otherwise). 523 // the previous alignment otherwise).
524 state_.is_screen_locked = locked; 524 state_.is_screen_locked = locked;
525 UpdateShelfVisibilityAfterLoginUIChange(); 525 UpdateShelfVisibilityAfterLoginUIChange();
526 } 526 }
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 if (ash::MaterialDesignController::IsShelfMaterial()) { 1185 if (ash::MaterialDesignController::IsShelfMaterial()) {
1186 return (state.visibility_state == SHELF_AUTO_HIDE && 1186 return (state.visibility_state == SHELF_AUTO_HIDE &&
1187 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) 1187 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN)
1188 ? 1.0f 1188 ? 1.0f
1189 : 0.0f; 1189 : 0.0f;
1190 } 1190 }
1191 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; 1191 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f;
1192 } 1192 }
1193 1193
1194 } // namespace ash 1194 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/shelf/shelf_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698