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

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

Issue 12077055: Made launcher hidden when kicking off chrome in app mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
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/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
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::CalculateShelfVisibility() {
251 switch(auto_hide_behavior_) {
252 case SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS:
253 return SHELF_AUTO_HIDE;
254 case SHELF_AUTO_HIDE_BEHAVIOR_NEVER:
255 return SHELF_VISIBLE;
256 case SHELF_AUTO_HIDE_ALWAYS_HIDDEN:
257 return SHELF_HIDDEN;
258 }
259 return SHELF_VISIBLE;
260 }
261
262 ShelfVisibilityState
263 ShelfLayoutManager::CalculateShelfVisibilityWhileDragging() {
264 switch(auto_hide_behavior_) {
265 case SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS:
266 case SHELF_AUTO_HIDE_BEHAVIOR_NEVER:
267 return SHELF_AUTO_HIDE;
268 case SHELF_AUTO_HIDE_ALWAYS_HIDDEN:
269 return SHELF_HIDDEN;
270 }
271 return SHELF_VISIBLE;
272 }
273
250 void ShelfLayoutManager::UpdateVisibilityState() { 274 void ShelfLayoutManager::UpdateVisibilityState() {
251 ShellDelegate* delegate = Shell::GetInstance()->delegate(); 275 ShellDelegate* delegate = Shell::GetInstance()->delegate();
252 if (delegate && delegate->IsScreenLocked()) { 276 if (delegate && delegate->IsScreenLocked()) {
253 SetState(SHELF_VISIBLE); 277 SetState(SHELF_VISIBLE);
254 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) { 278 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) {
255 SetState(SHELF_AUTO_HIDE); 279 SetState(CalculateShelfVisibilityWhileDragging());
sky 2013/01/31 00:58:13 Should we instead ignore gestures when hidden.
zel 2013/01/31 01:07:27 I've added TODO here, there will me many quirks li
256 } else if (GetRootWindowController(root_window_)->IsImmersiveMode()) { 280 } else if (GetRootWindowController(root_window_)->IsImmersiveMode()) {
257 // The user choosing immersive mode indicates he or she wants to maximize 281 // The user choosing immersive mode indicates he or she wants to maximize
258 // screen real-estate for content, so always auto-hide the shelf. 282 // screen real-estate for content, so always auto-hide the shelf.
283 DCHECK_NE(auto_hide_behavior_, SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
259 SetState(SHELF_AUTO_HIDE); 284 SetState(SHELF_AUTO_HIDE);
260 } else { 285 } else {
261 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); 286 WorkspaceWindowState window_state(workspace_controller_->GetWindowState());
262 switch (window_state) { 287 switch (window_state) {
263 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: 288 case WORKSPACE_WINDOW_STATE_FULL_SCREEN:
264 SetState(SHELF_HIDDEN); 289 SetState(SHELF_HIDDEN);
265 break; 290 break;
266 291
267 case WORKSPACE_WINDOW_STATE_MAXIMIZED: 292 case WORKSPACE_WINDOW_STATE_MAXIMIZED:
268 SetState(auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? 293 SetState(CalculateShelfVisibility());
269 SHELF_AUTO_HIDE : SHELF_VISIBLE);
270 break; 294 break;
271 295
272 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF: 296 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF:
273 case WORKSPACE_WINDOW_STATE_DEFAULT: 297 case WORKSPACE_WINDOW_STATE_DEFAULT:
274 SetState(auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? 298 SetState(CalculateShelfVisibility());
275 SHELF_AUTO_HIDE : SHELF_VISIBLE);
276 SetWindowOverlapsShelf(window_state == 299 SetWindowOverlapsShelf(window_state ==
277 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF); 300 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF);
278 break; 301 break;
279 } 302 }
280 } 303 }
281 } 304 }
282 305
283 void ShelfLayoutManager::UpdateAutoHideState() { 306 void ShelfLayoutManager::UpdateAutoHideState() {
284 ShelfAutoHideState auto_hide_state = 307 ShelfAutoHideState auto_hide_state =
285 CalculateAutoHideState(state_.visibility_state); 308 CalculateAutoHideState(state_.visibility_state);
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { 942 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const {
920 if (state.visibility_state == SHELF_VISIBLE) 943 if (state.visibility_state == SHELF_VISIBLE)
921 return size; 944 return size;
922 if (state.visibility_state == SHELF_AUTO_HIDE) 945 if (state.visibility_state == SHELF_AUTO_HIDE)
923 return kAutoHideSize; 946 return kAutoHideSize;
924 return 0; 947 return 0;
925 } 948 }
926 949
927 } // namespace internal 950 } // namespace internal
928 } // namespace ash 951 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698