OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/common/wm/dock/docked_window_layout_manager.h" | 5 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
6 | 6 |
7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
8 #include "ash/common/shelf/shelf_constants.h" | 8 #include "ash/common/shelf/shelf_constants.h" |
9 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
10 #include "ash/common/shelf/wm_shelf_observer.h" | 10 #include "ash/common/shelf/wm_shelf_observer.h" |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 dock_container_->GetBounds().y(), dock_inset, work_area.height()); | 1293 dock_container_->GetBounds().y(), dock_inset, work_area.height()); |
1294 docked_bounds_ = | 1294 docked_bounds_ = |
1295 bounds + dock_container_->GetBoundsInScreen().OffsetFromOrigin(); | 1295 bounds + dock_container_->GetBoundsInScreen().OffsetFromOrigin(); |
1296 FOR_EACH_OBSERVER(DockedWindowLayoutManagerObserver, observer_list_, | 1296 FOR_EACH_OBSERVER(DockedWindowLayoutManagerObserver, observer_list_, |
1297 OnDockBoundsChanging(bounds, reason)); | 1297 OnDockBoundsChanging(bounds, reason)); |
1298 // Show or hide background for docked area. | 1298 // Show or hide background for docked area. |
1299 gfx::Rect background_bounds(docked_bounds_); | 1299 gfx::Rect background_bounds(docked_bounds_); |
1300 if (shelf_observer_) | 1300 if (shelf_observer_) |
1301 background_bounds.Subtract(shelf_observer_->shelf_bounds_in_screen()); | 1301 background_bounds.Subtract(shelf_observer_->shelf_bounds_in_screen()); |
1302 if (docked_width > 0) { | 1302 if (docked_width > 0) { |
1303 if (!background_widget_) | 1303 // TODO: |shelf_| should not be null by the time we get here, but it may |
1304 background_widget_.reset(new DockedBackgroundWidget(this)); | 1304 // be in mash as startup sequence doesn't yet match that of ash. Once |
1305 background_widget_->SetBackgroundBounds(background_bounds, alignment_); | 1305 // |shelf_| is created at same time as ash we can remove conditional. |
1306 background_widget_->Show(); | 1306 // http://crbug.com/632099 |
| 1307 if (shelf_) { |
| 1308 if (!background_widget_) |
| 1309 background_widget_.reset(new DockedBackgroundWidget(this)); |
| 1310 background_widget_->SetBackgroundBounds(background_bounds, alignment_); |
| 1311 background_widget_->Show(); |
| 1312 } |
1307 } else if (background_widget_) { | 1313 } else if (background_widget_) { |
1308 background_widget_->Hide(); | 1314 background_widget_->Hide(); |
1309 } | 1315 } |
1310 } | 1316 } |
1311 | 1317 |
1312 void DockedWindowLayoutManager::UpdateStacking(WmWindow* active_window) { | 1318 void DockedWindowLayoutManager::UpdateStacking(WmWindow* active_window) { |
1313 if (!active_window) { | 1319 if (!active_window) { |
1314 if (!last_active_window_) | 1320 if (!last_active_window_) |
1315 return; | 1321 return; |
1316 active_window = last_active_window_; | 1322 active_window = last_active_window_; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 | 1372 |
1367 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1373 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
1368 const gfx::Rect& keyboard_bounds) { | 1374 const gfx::Rect& keyboard_bounds) { |
1369 // This bounds change will have caused a change to the Shelf which does not | 1375 // This bounds change will have caused a change to the Shelf which does not |
1370 // propagate automatically to this class, so manually recalculate bounds. | 1376 // propagate automatically to this class, so manually recalculate bounds. |
1371 Relayout(); | 1377 Relayout(); |
1372 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1378 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
1373 } | 1379 } |
1374 | 1380 |
1375 } // namespace ash | 1381 } // namespace ash |
OLD | NEW |