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

Side by Side Diff: ash/shell.cc

Issue 460933002: Split Shell::ToggleAppList() into ShowAppList and DismissAppList. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 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 | Annotate | Revision Log
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/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "ash/accelerators/accelerator_controller.h" 10 #include "ash/accelerators/accelerator_controller.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // No context menus when screen is locked. 285 // No context menus when screen is locked.
286 if (session_state_delegate_->IsScreenLocked()) 286 if (session_state_delegate_->IsScreenLocked())
287 return; 287 return;
288 288
289 aura::Window* root = 289 aura::Window* root =
290 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size())); 290 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size()));
291 GetRootWindowController(root) 291 GetRootWindowController(root)
292 ->ShowContextMenu(location_in_screen, source_type); 292 ->ShowContextMenu(location_in_screen, source_type);
293 } 293 }
294 294
295 void Shell::ToggleAppList(aura::Window* window) { 295 void Shell::ShowAppList(aura::Window* window) {
296 // If the context window is not given, show it on the target root window. 296 // If the context window is not given, show it on the target root window.
297 if (!window) 297 if (!window)
298 window = GetTargetRootWindow(); 298 window = GetTargetRootWindow();
299 if (!app_list_controller_) 299 if (!app_list_controller_)
300 app_list_controller_.reset(new AppListController); 300 app_list_controller_.reset(new AppListController);
301 app_list_controller_->SetVisible(!app_list_controller_->IsVisible(), window); 301 app_list_controller_->SetVisible(true, window);
302 }
303
304 void Shell::DismissAppList() {
305 if (!app_list_controller_)
306 return;
307 app_list_controller_->SetVisible(false, GetTargetRootWindow());
308 }
309
310 void Shell::ToggleAppList(aura::Window* window) {
311 if (GetAppListTargetVisibility()) {
312 DismissAppList();
313 return;
314 }
315
316 ShowAppList(window);
302 } 317 }
303 318
304 bool Shell::GetAppListTargetVisibility() const { 319 bool Shell::GetAppListTargetVisibility() const {
305 return app_list_controller_.get() && 320 return app_list_controller_.get() &&
306 app_list_controller_->GetTargetVisibility(); 321 app_list_controller_->GetTargetVisibility();
307 } 322 }
308 323
309 aura::Window* Shell::GetAppListWindow() { 324 aura::Window* Shell::GetAppListWindow() {
310 return app_list_controller_.get() ? app_list_controller_->GetWindow() : NULL; 325 return app_list_controller_.get() ? app_list_controller_->GetWindow() : NULL;
311 } 326 }
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 //////////////////////////////////////////////////////////////////////////////// 1151 ////////////////////////////////////////////////////////////////////////////////
1137 // Shell, aura::client::ActivationChangeObserver implementation: 1152 // Shell, aura::client::ActivationChangeObserver implementation:
1138 1153
1139 void Shell::OnWindowActivated(aura::Window* gained_active, 1154 void Shell::OnWindowActivated(aura::Window* gained_active,
1140 aura::Window* lost_active) { 1155 aura::Window* lost_active) {
1141 if (gained_active) 1156 if (gained_active)
1142 target_root_window_ = gained_active->GetRootWindow(); 1157 target_root_window_ = gained_active->GetRootWindow();
1143 } 1158 }
1144 1159
1145 } // namespace ash 1160 } // namespace ash
OLDNEW
« ash/shell.h ('K') | « ash/shell.h ('k') | ash/shell/app_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698