OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/common/shelf/shelf_widget.h" | 5 #include "ash/common/shelf/shelf_widget.h" |
6 | 6 |
7 #include "ash/common/focus_cycler.h" | 7 #include "ash/common/focus_cycler.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
10 #include "ash/common/shelf/shelf_background_animator_observer.h" | 10 #include "ash/common/shelf/shelf_background_animator_observer.h" |
11 #include "ash/common/shelf/shelf_constants.h" | 11 #include "ash/common/shelf/shelf_constants.h" |
12 #include "ash/common/shelf/shelf_delegate.h" | 12 #include "ash/common/shelf/shelf_delegate.h" |
13 #include "ash/common/shelf/shelf_layout_manager.h" | 13 #include "ash/common/shelf/shelf_layout_manager.h" |
14 #include "ash/common/shelf/shelf_view.h" | 14 #include "ash/common/shelf/shelf_view.h" |
15 #include "ash/common/shelf/wm_dimmer_view.h" | 15 #include "ash/common/shelf/wm_dimmer_view.h" |
16 #include "ash/common/shelf/wm_shelf.h" | 16 #include "ash/common/shelf/wm_shelf.h" |
17 #include "ash/common/shelf/wm_shelf_util.h" | 17 #include "ash/common/shelf/wm_shelf_util.h" |
18 #include "ash/common/system/status_area_layout_manager.h" | 18 #include "ash/common/system/status_area_layout_manager.h" |
19 #include "ash/common/system/status_area_widget.h" | 19 #include "ash/common/system/status_area_widget.h" |
20 #include "ash/common/system/tray/system_tray_delegate.h" | |
21 #include "ash/common/wm_lookup.h" | 20 #include "ash/common/wm_lookup.h" |
22 #include "ash/common/wm_root_window_controller.h" | 21 #include "ash/common/wm_root_window_controller.h" |
23 #include "ash/common/wm_shell.h" | 22 #include "ash/common/wm_shell.h" |
24 #include "ash/common/wm_window.h" | 23 #include "ash/common/wm_window.h" |
25 #include "ash/common/wm_window_property.h" | 24 #include "ash/common/wm_window_property.h" |
26 #include "base/memory/ptr_util.h" | 25 #include "base/memory/ptr_util.h" |
27 #include "grit/ash_resources.h" | 26 #include "grit/ash_resources.h" |
28 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
29 #include "ui/compositor/layer.h" | 28 #include "ui/compositor/layer.h" |
30 #include "ui/compositor/scoped_layer_animation_settings.h" | 29 #include "ui/compositor/scoped_layer_animation_settings.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 opaque_foreground_animation->SetPreemptionStrategy( | 370 opaque_foreground_animation->SetPreemptionStrategy( |
372 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 371 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
373 | 372 |
374 opaque_foreground->SetOpacity(target_opacity); | 373 opaque_foreground->SetOpacity(target_opacity); |
375 } | 374 } |
376 | 375 |
377 bool ShelfWidget::IsShelfHiddenBehindBlackBar() const { | 376 bool ShelfWidget::IsShelfHiddenBehindBlackBar() const { |
378 return delegate_view_->opaque_foreground()->GetTargetOpacity() != 0.0f; | 377 return delegate_view_->opaque_foreground()->GetTargetOpacity() != 0.0f; |
379 } | 378 } |
380 | 379 |
381 // static | |
382 bool ShelfWidget::ShelfAlignmentAllowed() { | |
383 if (WmShell::Get()->system_tray_delegate()->IsUserSupervised()) | |
384 return false; | |
385 | |
386 LoginStatus login_status = | |
387 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus(); | |
388 | |
389 switch (login_status) { | |
390 case LoginStatus::LOCKED: | |
391 // Shelf alignment changes can be requested while being locked, but will | |
392 // be applied upon unlock. | |
393 case LoginStatus::USER: | |
394 case LoginStatus::OWNER: | |
395 return true; | |
396 case LoginStatus::PUBLIC: | |
397 case LoginStatus::SUPERVISED: | |
398 case LoginStatus::GUEST: | |
399 case LoginStatus::KIOSK_APP: | |
400 case LoginStatus::NOT_LOGGED_IN: | |
401 return false; | |
402 } | |
403 | |
404 NOTREACHED(); | |
405 return false; | |
406 } | |
407 | |
408 ShelfAlignment ShelfWidget::GetAlignment() const { | 380 ShelfAlignment ShelfWidget::GetAlignment() const { |
409 return wm_shelf_->GetAlignment(); | 381 return wm_shelf_->GetAlignment(); |
410 } | 382 } |
411 | 383 |
412 void ShelfWidget::OnShelfAlignmentChanged() { | 384 void ShelfWidget::OnShelfAlignmentChanged() { |
413 shelf_view_->OnShelfAlignmentChanged(); | 385 shelf_view_->OnShelfAlignmentChanged(); |
414 status_area_widget_->SetShelfAlignment(GetAlignment()); | 386 status_area_widget_->SetShelfAlignment(GetAlignment()); |
415 delegate_view_->SchedulePaint(); | 387 delegate_view_->SchedulePaint(); |
416 } | 388 } |
417 | 389 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 if (shelf_view_) | 534 if (shelf_view_) |
563 shelf_view_->UpdateShelfItemBackground(alpha); | 535 shelf_view_->UpdateShelfItemBackground(alpha); |
564 } | 536 } |
565 | 537 |
566 void ShelfWidget::WillDeleteShelfLayoutManager() { | 538 void ShelfWidget::WillDeleteShelfLayoutManager() { |
567 shelf_layout_manager_->RemoveObserver(this); | 539 shelf_layout_manager_->RemoveObserver(this); |
568 shelf_layout_manager_ = nullptr; | 540 shelf_layout_manager_ = nullptr; |
569 } | 541 } |
570 | 542 |
571 } // namespace ash | 543 } // namespace ash |
OLD | NEW |