Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/wm/shelf_layout_manager.h" | 5 #include "ash/wm/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 GetLayer(status_area_widget_)->SetOpacity(target_bounds.opacity); | 240 GetLayer(status_area_widget_)->SetOpacity(target_bounds.opacity); |
| 241 status_area_widget_->SetBounds( | 241 status_area_widget_->SetBounds( |
| 242 ScreenAsh::ConvertRectToScreen( | 242 ScreenAsh::ConvertRectToScreen( |
| 243 status_area_widget_->GetNativeView()->parent(), | 243 status_area_widget_->GetNativeView()->parent(), |
| 244 target_bounds.status_bounds_in_root)); | 244 target_bounds.status_bounds_in_root)); |
| 245 Shell::GetInstance()->SetDisplayWorkAreaInsets( | 245 Shell::GetInstance()->SetDisplayWorkAreaInsets( |
| 246 root_window_, target_bounds.work_area_insets); | 246 root_window_, target_bounds.work_area_insets); |
| 247 UpdateHitTestBounds(); | 247 UpdateHitTestBounds(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 ShelfVisibilityState ShelfLayoutManager::GetShelfVisibilityState() { | |
| 251 switch(auto_hide_behavior_) { | |
| 252 case SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: | |
| 253 return SHELF_AUTO_HIDE; | |
| 254 case SHELF_AUTO_HIDE_ALWAYS_HIDDEN: | |
| 255 return SHELF_HIDDEN; | |
| 256 default: | |
|
oshima
2013/01/30 00:28:31
case SHELF_AUTO_HIDE_BEHAVIOR_NEVER:
and no defau
zel
2013/01/30 01:01:34
Done.
| |
| 257 return SHELF_VISIBLE; | |
| 258 } | |
| 259 } | |
| 260 | |
| 250 void ShelfLayoutManager::UpdateVisibilityState() { | 261 void ShelfLayoutManager::UpdateVisibilityState() { |
| 251 ShellDelegate* delegate = Shell::GetInstance()->delegate(); | 262 ShellDelegate* delegate = Shell::GetInstance()->delegate(); |
| 252 if (delegate && delegate->IsScreenLocked()) { | 263 if (delegate && delegate->IsScreenLocked()) { |
| 253 SetState(SHELF_VISIBLE); | 264 SetState(SHELF_VISIBLE); |
| 254 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) { | 265 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) { |
| 255 SetState(SHELF_AUTO_HIDE); | 266 SetState(SHELF_AUTO_HIDE); |
| 256 } else if (GetRootWindowController(root_window_)->IsImmersiveMode()) { | 267 } else if (GetRootWindowController(root_window_)->IsImmersiveMode()) { |
| 257 // The user choosing immersive mode indicates he or she wants to maximize | 268 // The user choosing immersive mode indicates he or she wants to maximize |
| 258 // screen real-estate for content, so always auto-hide the shelf. | 269 // screen real-estate for content, so always auto-hide the shelf. |
| 259 SetState(SHELF_AUTO_HIDE); | 270 SetState(SHELF_AUTO_HIDE); |
| 260 } else { | 271 } else { |
| 261 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); | 272 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); |
| 262 switch (window_state) { | 273 switch (window_state) { |
| 263 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: | 274 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: |
| 264 SetState(SHELF_HIDDEN); | 275 SetState(SHELF_HIDDEN); |
| 265 break; | 276 break; |
| 266 | 277 |
| 267 case WORKSPACE_WINDOW_STATE_MAXIMIZED: | 278 case WORKSPACE_WINDOW_STATE_MAXIMIZED: |
| 268 SetState(auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? | 279 SetState(GetShelfVisibilityState()); |
| 269 SHELF_AUTO_HIDE : SHELF_VISIBLE); | |
| 270 break; | 280 break; |
| 271 | 281 |
| 272 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF: | 282 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF: |
| 273 case WORKSPACE_WINDOW_STATE_DEFAULT: | 283 case WORKSPACE_WINDOW_STATE_DEFAULT: |
| 274 SetState(auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? | 284 SetState(GetShelfVisibilityState()); |
| 275 SHELF_AUTO_HIDE : SHELF_VISIBLE); | |
| 276 SetWindowOverlapsShelf(window_state == | 285 SetWindowOverlapsShelf(window_state == |
| 277 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF); | 286 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF); |
| 278 break; | 287 break; |
| 279 } | 288 } |
| 280 } | 289 } |
| 281 } | 290 } |
| 282 | 291 |
| 283 void ShelfLayoutManager::UpdateAutoHideState() { | 292 void ShelfLayoutManager::UpdateAutoHideState() { |
| 284 ShelfAutoHideState auto_hide_state = | 293 ShelfAutoHideState auto_hide_state = |
| 285 CalculateAutoHideState(state_.visibility_state); | 294 CalculateAutoHideState(state_.visibility_state); |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 919 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { | 928 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { |
| 920 if (state.visibility_state == SHELF_VISIBLE) | 929 if (state.visibility_state == SHELF_VISIBLE) |
| 921 return size; | 930 return size; |
| 922 if (state.visibility_state == SHELF_AUTO_HIDE) | 931 if (state.visibility_state == SHELF_AUTO_HIDE) |
| 923 return kAutoHideSize; | 932 return kAutoHideSize; |
| 924 return 0; | 933 return 0; |
| 925 } | 934 } |
| 926 | 935 |
| 927 } // namespace internal | 936 } // namespace internal |
| 928 } // namespace ash | 937 } // namespace ash |
| OLD | NEW |