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

Side by Side Diff: ash/app_list/app_list_presenter_delegate.cc

Issue 2898743002: Draggable peeking/fullscreen launcher with transparent background. (Closed)
Patch Set: Created 3 years, 7 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/app_list/app_list_presenter_delegate.h" 5 #include "ash/app_list/app_list_presenter_delegate.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/public/cpp/shelf_types.h" 8 #include "ash/public/cpp/shelf_types.h"
9 #include "ash/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 WmWindow::Get(root_window), GetMinimumBoundsHeightForAppList(view))); 107 WmWindow::Get(root_window), GetMinimumBoundsHeightForAppList(view)));
108 } 108 }
109 keyboard::KeyboardController* keyboard_controller = 109 keyboard::KeyboardController* keyboard_controller =
110 keyboard::KeyboardController::GetInstance(); 110 keyboard::KeyboardController::GetInstance();
111 if (keyboard_controller) 111 if (keyboard_controller)
112 keyboard_controller->AddObserver(this); 112 keyboard_controller->AddObserver(this);
113 Shell::Get()->AddPreTargetHandler(this); 113 Shell::Get()->AddPreTargetHandler(this);
114 WmShelf* shelf = WmShelf::ForWindow(root_window); 114 WmShelf* shelf = WmShelf::ForWindow(root_window);
115 shelf->AddObserver(this); 115 shelf->AddObserver(this);
116 116
117 // Notify the shelf that the app list is active so the backgrounds do not
118 // overlap.
119 if (app_list::features::IsFullscreenAppListEnabled())
120 shelf->AppListIsActive(true);
121
117 // By setting us as DnD recipient, the app list knows that we can 122 // By setting us as DnD recipient, the app list knows that we can
118 // handle items. 123 // handle items.
119 view->SetDragAndDropHostOfCurrentAppList( 124 view->SetDragAndDropHostOfCurrentAppList(
120 shelf->shelf_widget()->GetDragAndDropHostForAppList()); 125 shelf->shelf_widget()->GetDragAndDropHostForAppList());
121 } 126 }
122 127
123 void AppListPresenterDelegate::OnShown(int64_t display_id) { 128 void AppListPresenterDelegate::OnShown(int64_t display_id) {
124 is_visible_ = true; 129 is_visible_ = true;
125 // Update applist button status when app list visibility is changed. 130 // Update applist button status when app list visibility is changed.
126 aura::Window* root_window = 131 aura::Window* root_window =
127 ShellPort::Get()->GetRootWindowForDisplayId(display_id); 132 ShellPort::Get()->GetRootWindowForDisplayId(display_id);
128 AppListButton* app_list_button = 133 AppListButton* app_list_button =
129 WmShelf::ForWindow(root_window)->shelf_widget()->GetAppListButton(); 134 WmShelf::ForWindow(root_window)->shelf_widget()->GetAppListButton();
130 if (app_list_button) 135 if (app_list_button)
131 app_list_button->OnAppListShown(); 136 app_list_button->OnAppListShown();
132 } 137 }
133 138
134 void AppListPresenterDelegate::OnDismissed() { 139 void AppListPresenterDelegate::OnDismissed() {
135 DCHECK(is_visible_); 140 DCHECK(is_visible_);
136 DCHECK(view_); 141 DCHECK(view_);
137 142
138 is_visible_ = false; 143 is_visible_ = false;
139 144
140 // Update applist button status when app list visibility is changed. 145 // Update applist button status when app list visibility is changed.
141 WmShelf* shelf = WmShelf::ForWindow(view_->GetWidget()->GetNativeWindow()); 146 WmShelf* shelf = WmShelf::ForWindow(view_->GetWidget()->GetNativeWindow());
142 AppListButton* app_list_button = shelf->shelf_widget()->GetAppListButton(); 147 AppListButton* app_list_button = shelf->shelf_widget()->GetAppListButton();
143 if (app_list_button) 148 if (app_list_button)
144 app_list_button->OnAppListDismissed(); 149 app_list_button->OnAppListDismissed();
150
151 if(app_list::features::IsFullscreenAppListEnabled())
152 // Notify the shelf that the app list is being dismissed so it can
153 // re-enable its transparent background.
154 shelf->AppListIsActive(false);
vadimt 2017/05/22 23:36:56 Just asking: isn't OnShown a counterpart of OnDism
newcomer 2017/05/25 23:10:50 You're correct! I put it in OnShown.
145 } 155 }
146 156
147 void AppListPresenterDelegate::UpdateBounds() { 157 void AppListPresenterDelegate::UpdateBounds() {
148 if (!view_ || !is_visible_) 158 if (!view_ || !is_visible_)
149 return; 159 return;
150 160
151 view_->UpdateBounds(); 161 view_->UpdateBounds();
152 view_->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( 162 view_->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow(
153 WmWindow::Get(view_->GetWidget()->GetNativeWindow()), 163 WmWindow::Get(view_->GetWidget()->GetNativeWindow()),
154 GetMinimumBoundsHeightForAppList(view_))); 164 GetMinimumBoundsHeightForAppList(view_)));
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 250 }
241 251
242 //////////////////////////////////////////////////////////////////////////////// 252 ////////////////////////////////////////////////////////////////////////////////
243 // AppListPresenterDelegate, WmShelfObserver implementation: 253 // AppListPresenterDelegate, WmShelfObserver implementation:
244 254
245 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { 255 void AppListPresenterDelegate::OnShelfIconPositionsChanged() {
246 UpdateBounds(); 256 UpdateBounds();
247 } 257 }
248 258
249 } // namespace ash 259 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698