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

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

Issue 2190773003: [ABANDONED] Simplify ash shelf dimmer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore an EventHandler object; fix behavior tests. Created 4 years, 4 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
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 <vector> 9 #include <vector>
10 10
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 647
648 if (delay_background_change) { 648 if (delay_background_change) {
649 if (update_shelf_observer_) 649 if (update_shelf_observer_)
650 update_shelf_observer_->Detach(); 650 update_shelf_observer_->Detach();
651 // UpdateShelfBackground deletes itself when the animation is done. 651 // UpdateShelfBackground deletes itself when the animation is done.
652 update_shelf_observer_ = new UpdateShelfObserver(this); 652 update_shelf_observer_ = new UpdateShelfObserver(this);
653 } else { 653 } else {
654 UpdateShelfBackground(change_type); 654 UpdateShelfBackground(change_type);
655 } 655 }
656 656
657 shelf_widget_->SetDimsShelf(state.visibility_state == SHELF_VISIBLE &&
658 state.window_state ==
659 wm::WORKSPACE_WINDOW_STATE_MAXIMIZED);
660
661 TargetBounds target_bounds; 657 TargetBounds target_bounds;
662 CalculateTargetBounds(state_, &target_bounds); 658 CalculateTargetBounds(state_, &target_bounds);
663 UpdateBoundsAndOpacity(target_bounds, true, delay_background_change 659 UpdateBoundsAndOpacity(target_bounds, true, delay_background_change
664 ? update_shelf_observer_ 660 ? update_shelf_observer_
665 : NULL); 661 : NULL);
666 662
667 // The delegate must be notified after |state_| is updated so that it can 663 // The delegate must be notified after |state_| is updated so that it can
668 // query the new target bounds. 664 // query the new target bounds.
669 ShelfDelegate* shelf_delegate = WmShell::Get()->shelf_delegate(); 665 ShelfDelegate* shelf_delegate = WmShell::Get()->shelf_delegate();
670 DCHECK(shelf_delegate); 666 DCHECK(shelf_delegate);
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 948
953 void ShelfLayoutManager::UpdateShelfBackground( 949 void ShelfLayoutManager::UpdateShelfBackground(
954 BackgroundAnimatorChangeType type) { 950 BackgroundAnimatorChangeType type) {
955 const ShelfBackgroundType background_type(GetShelfBackgroundType()); 951 const ShelfBackgroundType background_type(GetShelfBackgroundType());
956 shelf_widget_->SetPaintsBackground(background_type, type); 952 shelf_widget_->SetPaintsBackground(background_type, type);
957 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, 953 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
958 OnBackgroundUpdated(background_type, type)); 954 OnBackgroundUpdated(background_type, type));
959 } 955 }
960 956
961 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { 957 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const {
958 LOG(ERROR) << "MSW GetShelfBackgroundType " << shelf_widget_
959 << " vis:" << (state_.visibility_state != SHELF_AUTO_HIDE)
960 << " max:" << (state_.window_state == wm::WORKSPACE_WINDOW_STATE_MA XIMIZED);
962 if (state_.visibility_state != SHELF_AUTO_HIDE && 961 if (state_.visibility_state != SHELF_AUTO_HIDE &&
963 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { 962 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) {
964 return SHELF_BACKGROUND_MAXIMIZED; 963 return SHELF_BACKGROUND_MAXIMIZED;
965 } 964 }
966 965
967 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || 966 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS ||
968 (!state_.is_screen_locked && !state_.is_adding_user_screen && 967 (!state_.is_screen_locked && !state_.is_adding_user_screen &&
969 window_overlaps_shelf_) || 968 window_overlaps_shelf_) ||
970 (state_.visibility_state == SHELF_AUTO_HIDE)) { 969 (state_.visibility_state == SHELF_AUTO_HIDE)) {
971 return SHELF_BACKGROUND_OVERLAP; 970 return SHELF_BACKGROUND_OVERLAP;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 if (ash::MaterialDesignController::IsShelfMaterial()) { 1184 if (ash::MaterialDesignController::IsShelfMaterial()) {
1186 return (state.visibility_state == SHELF_AUTO_HIDE && 1185 return (state.visibility_state == SHELF_AUTO_HIDE &&
1187 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) 1186 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN)
1188 ? 1.0f 1187 ? 1.0f
1189 : 0.0f; 1188 : 0.0f;
1190 } 1189 }
1191 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; 1190 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f;
1192 } 1191 }
1193 1192
1194 } // namespace ash 1193 } // namespace ash
OLDNEW
« no previous file with comments | « ash/resources/default_200_percent/common/shelf/shelf_dimming.png ('k') | ash/shelf/shelf_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698