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

Side by Side Diff: ash/wm/app_list_controller.cc

Issue 10831024: ash: Do not close the app-list if user clicked on a menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « ash/wm/app_list_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/wm/app_list_controller.h" 5 #include "ash/wm/app_list_controller.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_delegate.h" 10 #include "ash/shell_delegate.h"
11 #include "ash/shell_window_ids.h" 11 #include "ash/shell_window_ids.h"
12 #include "ash/wm/property_util.h"
12 #include "ash/wm/shelf_layout_manager.h" 13 #include "ash/wm/shelf_layout_manager.h"
13 #include "ui/app_list/app_list_view.h" 14 #include "ui/app_list/app_list_view.h"
14 #include "ui/app_list/icon_cache.h" 15 #include "ui/app_list/icon_cache.h"
15 #include "ui/app_list/pagination_model.h" 16 #include "ui/app_list/pagination_model.h"
16 #include "ui/aura/event.h" 17 #include "ui/aura/event.h"
17 #include "ui/aura/focus_manager.h" 18 #include "ui/aura/focus_manager.h"
18 #include "ui/aura/root_window.h" 19 #include "ui/aura/root_window.h"
19 #include "ui/aura/window.h" 20 #include "ui/aura/window.h"
20 #include "ui/compositor/layer.h" 21 #include "ui/compositor/layer.h"
21 #include "ui/compositor/scoped_layer_animation_settings.h" 22 #include "ui/compositor/scoped_layer_animation_settings.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 193
193 ui::ScopedLayerAnimationSettings animation(layer->GetAnimator()); 194 ui::ScopedLayerAnimationSettings animation(layer->GetAnimator());
194 animation.SetTransitionDuration( 195 animation.SetTransitionDuration(
195 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); 196 base::TimeDelta::FromMilliseconds(kAnimationDurationMs));
196 animation.AddObserver(this); 197 animation.AddObserver(this);
197 198
198 layer->SetOpacity(is_visible_ ? 1.0 : 0.0); 199 layer->SetOpacity(is_visible_ ? 1.0 : 0.0);
199 layer->SetBounds(target_bounds); 200 layer->SetBounds(target_bounds);
200 } 201 }
201 202
202 void AppListController::ProcessLocatedEvent(const aura::LocatedEvent& event) { 203 void AppListController::ProcessLocatedEvent(aura::Window* target,
204 const aura::LocatedEvent& event) {
205 // If the event happened on a menu, then the event should not close the app
206 // list.
207 if (target) {
208 RootWindowController* root_controller =
209 GetRootWindowController(target->GetRootWindow());
210 if (root_controller) {
211 aura::Window* menu_container = root_controller->GetContainer(
212 ash::internal::kShellWindowId_MenuContainer);
213 if (menu_container->Contains(target))
214 return;
215 }
216 }
217
203 if (view_ && is_visible_) { 218 if (view_ && is_visible_) {
204 views::Widget* widget = view_->GetWidget(); 219 views::Widget* widget = view_->GetWidget();
205 if (!widget->GetNativeView()->GetBoundsInRootWindow().Contains( 220 if (!widget->GetNativeView()->GetBoundsInRootWindow().Contains(
206 event.root_location())) { 221 event.root_location())) {
207 SetVisible(false); 222 SetVisible(false);
208 } 223 }
209 } 224 }
210 } 225 }
211 226
212 void AppListController::UpdateBounds() { 227 void AppListController::UpdateBounds() {
213 if (view_ && is_visible_) 228 if (view_ && is_visible_)
214 view_->UpdateBounds(); 229 view_->UpdateBounds();
215 } 230 }
216 231
217 //////////////////////////////////////////////////////////////////////////////// 232 ////////////////////////////////////////////////////////////////////////////////
218 // AppListController, aura::EventFilter implementation: 233 // AppListController, aura::EventFilter implementation:
219 234
220 bool AppListController::PreHandleKeyEvent(aura::Window* target, 235 bool AppListController::PreHandleKeyEvent(aura::Window* target,
221 aura::KeyEvent* event) { 236 aura::KeyEvent* event) {
222 return false; 237 return false;
223 } 238 }
224 239
225 bool AppListController::PreHandleMouseEvent(aura::Window* target, 240 bool AppListController::PreHandleMouseEvent(aura::Window* target,
226 aura::MouseEvent* event) { 241 aura::MouseEvent* event) {
227 if (event->type() == ui::ET_MOUSE_PRESSED) 242 if (event->type() == ui::ET_MOUSE_PRESSED)
228 ProcessLocatedEvent(*event); 243 ProcessLocatedEvent(target, *event);
229 return false; 244 return false;
230 } 245 }
231 246
232 ui::TouchStatus AppListController::PreHandleTouchEvent( 247 ui::TouchStatus AppListController::PreHandleTouchEvent(
233 aura::Window* target, 248 aura::Window* target,
234 aura::TouchEvent* event) { 249 aura::TouchEvent* event) {
235 return ui::TOUCH_STATUS_UNKNOWN; 250 return ui::TOUCH_STATUS_UNKNOWN;
236 } 251 }
237 252
238 ui::GestureStatus AppListController::PreHandleGestureEvent( 253 ui::GestureStatus AppListController::PreHandleGestureEvent(
239 aura::Window* target, 254 aura::Window* target,
240 aura::GestureEvent* event) { 255 aura::GestureEvent* event) {
241 if (event->type() == ui::ET_GESTURE_TAP) 256 if (event->type() == ui::ET_GESTURE_TAP)
242 ProcessLocatedEvent(*event); 257 ProcessLocatedEvent(target, *event);
243 return ui::GESTURE_STATUS_UNKNOWN; 258 return ui::GESTURE_STATUS_UNKNOWN;
244 } 259 }
245 260
246 //////////////////////////////////////////////////////////////////////////////// 261 ////////////////////////////////////////////////////////////////////////////////
247 // AppListController, aura::FocusObserver implementation: 262 // AppListController, aura::FocusObserver implementation:
248 void AppListController::OnWindowFocused(aura::Window* window) { 263 void AppListController::OnWindowFocused(aura::Window* window) {
249 if (view_ && is_visible_) { 264 if (view_ && is_visible_) {
250 aura::Window* applist_container = Shell::GetContainer( 265 aura::Window* applist_container = Shell::GetContainer(
251 Shell::GetPrimaryRootWindow(), 266 Shell::GetPrimaryRootWindow(),
252 kShellWindowId_AppListContainer); 267 kShellWindowId_AppListContainer);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 306
292 //////////////////////////////////////////////////////////////////////////////// 307 ////////////////////////////////////////////////////////////////////////////////
293 // AppListController, LauncherIconObserver implementation: 308 // AppListController, LauncherIconObserver implementation:
294 309
295 void AppListController::OnLauncherIconPositionsChanged() { 310 void AppListController::OnLauncherIconPositionsChanged() {
296 UpdateBounds(); 311 UpdateBounds();
297 } 312 }
298 313
299 } // namespace internal 314 } // namespace internal
300 } // namespace ash 315 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/app_list_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698