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 "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 const void* key, | 264 const void* key, |
265 intptr_t old) { | 265 intptr_t old) { |
266 if (key == aura::client::kRootWindowActiveWindowKey) | 266 if (key == aura::client::kRootWindowActiveWindowKey) |
267 UpdateAutoHideStateNow(); | 267 UpdateAutoHideStateNow(); |
268 } | 268 } |
269 | 269 |
270 //////////////////////////////////////////////////////////////////////////////// | 270 //////////////////////////////////////////////////////////////////////////////// |
271 // ShelfLayoutManager, private: | 271 // ShelfLayoutManager, private: |
272 | 272 |
273 void ShelfLayoutManager::SetState(VisibilityState visibility_state) { | 273 void ShelfLayoutManager::SetState(VisibilityState visibility_state) { |
| 274 ShellDelegate* delegate = Shell::GetInstance()->delegate(); |
274 State state; | 275 State state; |
275 state.visibility_state = visibility_state; | 276 state.visibility_state = visibility_state; |
276 state.auto_hide_state = CalculateAutoHideState(visibility_state); | 277 state.auto_hide_state = CalculateAutoHideState(visibility_state); |
| 278 state.locked_state = delegate && delegate->IsScreenLocked(); |
277 | 279 |
278 if (state_.Equals(state)) | 280 if (state_.Equals(state)) |
279 return; // Nothing changed. | 281 return; // Nothing changed. |
280 | 282 |
281 if (state.visibility_state == AUTO_HIDE) { | 283 if (state.visibility_state == AUTO_HIDE) { |
282 // When state is AUTO_HIDE we need to track when the mouse is over the | 284 // When state is AUTO_HIDE we need to track when the mouse is over the |
283 // launcher to unhide the shelf. AutoHideEventFilter does that for us. | 285 // launcher to unhide the shelf. AutoHideEventFilter does that for us. |
284 if (!event_filter_.get()) | 286 if (!event_filter_.get()) |
285 event_filter_.reset(new AutoHideEventFilter(this)); | 287 event_filter_.reset(new AutoHideEventFilter(this)); |
286 } else { | 288 } else { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 bool launcher_paints = GetLauncherPaintsBackground(); | 378 bool launcher_paints = GetLauncherPaintsBackground(); |
377 if (launcher_) | 379 if (launcher_) |
378 launcher_->SetPaintsBackground(launcher_paints, type); | 380 launcher_->SetPaintsBackground(launcher_paints, type); |
379 // SystemTray normally draws a background, but we don't want it to draw a | 381 // SystemTray normally draws a background, but we don't want it to draw a |
380 // background when the launcher does. | 382 // background when the launcher does. |
381 if (Shell::GetInstance()->tray()) | 383 if (Shell::GetInstance()->tray()) |
382 Shell::GetInstance()->tray()->SetPaintsBackground(!launcher_paints, type); | 384 Shell::GetInstance()->tray()->SetPaintsBackground(!launcher_paints, type); |
383 } | 385 } |
384 | 386 |
385 bool ShelfLayoutManager::GetLauncherPaintsBackground() const { | 387 bool ShelfLayoutManager::GetLauncherPaintsBackground() const { |
386 return window_overlaps_shelf_ || state_.visibility_state == AUTO_HIDE; | 388 return (!state_.locked_state && window_overlaps_shelf_) || |
| 389 state_.visibility_state == AUTO_HIDE; |
387 } | 390 } |
388 | 391 |
389 void ShelfLayoutManager::UpdateAutoHideStateNow() { | 392 void ShelfLayoutManager::UpdateAutoHideStateNow() { |
390 SetState(state_.visibility_state); | 393 SetState(state_.visibility_state); |
391 } | 394 } |
392 | 395 |
393 ShelfLayoutManager::AutoHideState ShelfLayoutManager::CalculateAutoHideState( | 396 ShelfLayoutManager::AutoHideState ShelfLayoutManager::CalculateAutoHideState( |
394 VisibilityState visibility_state) const { | 397 VisibilityState visibility_state) const { |
395 if (visibility_state != AUTO_HIDE || !launcher_widget()) | 398 if (visibility_state != AUTO_HIDE || !launcher_widget()) |
396 return AUTO_HIDE_HIDDEN; | 399 return AUTO_HIDE_HIDDEN; |
(...skipping 28 matching lines...) Expand all Loading... |
425 insets.Set(kWorkspaceAreaBottomInset, 0, 0, 0); | 428 insets.Set(kWorkspaceAreaBottomInset, 0, 0, 0); |
426 } | 429 } |
427 if (launcher_widget() && launcher_widget()->GetNativeWindow()) | 430 if (launcher_widget() && launcher_widget()->GetNativeWindow()) |
428 launcher_widget()->GetNativeWindow()->set_hit_test_bounds_override_outer( | 431 launcher_widget()->GetNativeWindow()->set_hit_test_bounds_override_outer( |
429 insets); | 432 insets); |
430 status_->GetNativeWindow()->set_hit_test_bounds_override_outer(insets); | 433 status_->GetNativeWindow()->set_hit_test_bounds_override_outer(insets); |
431 } | 434 } |
432 | 435 |
433 } // namespace internal | 436 } // namespace internal |
434 } // namespace ash | 437 } // namespace ash |
OLD | NEW |