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

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

Issue 1274563004: Show ChromeVox caption panel when spoken feedback is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chromevox_panel_html
Patch Set: Add hook to disable/close ChromeVox Created 5 years, 1 month 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
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/shelf/shelf_layout_manager.h" 5 #include "ash/shelf/shelf_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <cstring> 9 #include <cstring>
10 #include <string> 10 #include <string>
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 aura::Window* gained_active, 534 aura::Window* gained_active,
535 aura::Window* lost_active) { 535 aura::Window* lost_active) {
536 UpdateAutoHideStateNow(); 536 UpdateAutoHideStateNow();
537 } 537 }
538 538
539 bool ShelfLayoutManager::IsHorizontalAlignment() const { 539 bool ShelfLayoutManager::IsHorizontalAlignment() const {
540 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM || 540 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM ||
541 GetAlignment() == SHELF_ALIGNMENT_TOP; 541 GetAlignment() == SHELF_ALIGNMENT_TOP;
542 } 542 }
543 543
544 gfx::Insets ShelfLayoutManager::GetWorkAreaInsets() const {
545 return work_area_insets_;
546 }
547
544 // static 548 // static
545 ShelfLayoutManager* ShelfLayoutManager::ForShelf(aura::Window* window) { 549 ShelfLayoutManager* ShelfLayoutManager::ForShelf(aura::Window* window) {
546 ShelfWidget* shelf = RootWindowController::ForShelf(window)->shelf(); 550 ShelfWidget* shelf = RootWindowController::ForShelf(window)->shelf();
547 return shelf ? shelf->shelf_layout_manager() : NULL; 551 return shelf ? shelf->shelf_layout_manager() : NULL;
548 } 552 }
549 553
550 //////////////////////////////////////////////////////////////////////////////// 554 ////////////////////////////////////////////////////////////////////////////////
551 // ShelfLayoutManager, private: 555 // ShelfLayoutManager, private:
552 556
553 ShelfLayoutManager::TargetBounds::TargetBounds() 557 ShelfLayoutManager::TargetBounds::TargetBounds()
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; 701 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf;
698 status_bounds.set_x(status_bounds.x() + 702 status_bounds.set_x(status_bounds.x() +
699 target_bounds.shelf_bounds_in_root.x()); 703 target_bounds.shelf_bounds_in_root.x());
700 status_bounds.set_y(status_bounds.y() + 704 status_bounds.set_y(status_bounds.y() +
701 target_bounds.shelf_bounds_in_root.y()); 705 target_bounds.shelf_bounds_in_root.y());
702 shelf_->status_area_widget()->SetBounds( 706 shelf_->status_area_widget()->SetBounds(
703 ScreenUtil::ConvertRectToScreen( 707 ScreenUtil::ConvertRectToScreen(
704 shelf_->status_area_widget()->GetNativeView()->parent(), 708 shelf_->status_area_widget()->GetNativeView()->parent(),
705 status_bounds)); 709 status_bounds));
706 if (!state_.is_screen_locked) { 710 if (!state_.is_screen_locked) {
707 gfx::Insets insets;
708 // If user session is blocked (login to new user session or add user to 711 // If user session is blocked (login to new user session or add user to
709 // the existing session - multi-profile) then give 100% of work area only 712 // the existing session - multi-profile) then give 100% of work area only
710 // if keyboard is not shown. 713 // if keyboard is not shown.
711 if (!state_.is_adding_user_screen || !keyboard_bounds_.IsEmpty()) { 714 if (!state_.is_adding_user_screen || !keyboard_bounds_.IsEmpty()) {
712 insets = target_bounds.work_area_insets; 715 work_area_insets_ = target_bounds.work_area_insets;
716 } else {
717 work_area_insets_ = gfx::Insets();
713 } 718 }
714 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, insets); 719 Shell::GetInstance()->UpdateDisplayWorkAreaInsets(root_window_);
715 } 720 }
716 } 721 }
717 722
718 // Setting visibility during an animation causes the visibility property to 723 // Setting visibility during an animation causes the visibility property to
719 // animate. Set the visibility property without an animation. 724 // animate. Set the visibility property without an animation.
720 if (target_bounds.status_opacity) 725 if (target_bounds.status_opacity)
721 shelf_->status_area_widget()->Show(); 726 shelf_->status_area_widget()->Show();
722 } 727 }
723 728
724 void ShelfLayoutManager::StopAnimating() { 729 void ShelfLayoutManager::StopAnimating() {
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 OnWindowResized(); 1129 OnWindowResized();
1125 1130
1126 SessionStateDelegate* session_state_delegate = 1131 SessionStateDelegate* session_state_delegate =
1127 Shell::GetInstance()->session_state_delegate(); 1132 Shell::GetInstance()->session_state_delegate();
1128 1133
1129 // On login screen if keyboard has been just hidden, update bounds just once 1134 // On login screen if keyboard has been just hidden, update bounds just once
1130 // but ignore target_bounds.work_area_insets since shelf overlaps with login 1135 // but ignore target_bounds.work_area_insets since shelf overlaps with login
1131 // window. 1136 // window.
1132 if (session_state_delegate->IsUserSessionBlocked() && 1137 if (session_state_delegate->IsUserSessionBlocked() &&
1133 keyboard_is_about_to_hide) { 1138 keyboard_is_about_to_hide) {
1134 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); 1139 work_area_insets_ = gfx::Insets();
1140 Shell::GetInstance()->UpdateDisplayWorkAreaInsets(root_window_);
1135 } 1141 }
1136 } 1142 }
1137 1143
1138 void ShelfLayoutManager::OnDockBoundsChanging( 1144 void ShelfLayoutManager::OnDockBoundsChanging(
1139 const gfx::Rect& dock_bounds, 1145 const gfx::Rect& dock_bounds,
1140 DockedWindowLayoutManagerObserver::Reason reason) { 1146 DockedWindowLayoutManagerObserver::Reason reason) {
1141 // Skip shelf layout in case docked notification originates from this class. 1147 // Skip shelf layout in case docked notification originates from this class.
1142 if (reason == DISPLAY_INSETS_CHANGED) 1148 if (reason == DISPLAY_INSETS_CHANGED)
1143 return; 1149 return;
1144 if (dock_bounds_ != dock_bounds) { 1150 if (dock_bounds_ != dock_bounds) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 return false; 1199 return false;
1194 } 1200 }
1195 if (session_state_delegate->IsUserSessionBlocked() || 1201 if (session_state_delegate->IsUserSessionBlocked() ||
1196 state_.is_adding_user_screen) { 1202 state_.is_adding_user_screen) {
1197 return true; 1203 return true;
1198 } 1204 }
1199 return false; 1205 return false;
1200 } 1206 }
1201 1207
1202 } // namespace ash 1208 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698