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

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

Issue 138003007: [Cleanup] Screen cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make sure screen_for_shutdown is reset everytime Created 6 years, 11 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/touch/touch_observer_hud_unittest.cc ('k') | ash/wm/base_layout_manager.cc » ('j') | 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/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_util.h"
10 #include "ash/shelf/shelf.h" 10 #include "ash/shelf/shelf.h"
11 #include "ash/shelf/shelf_layout_manager.h" 11 #include "ash/shelf/shelf_layout_manager.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/shell_delegate.h" 13 #include "ash/shell_delegate.h"
14 #include "ash/shell_window_ids.h" 14 #include "ash/shell_window_ids.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "ui/app_list/app_list_constants.h" 16 #include "ui/app_list/app_list_constants.h"
17 #include "ui/app_list/pagination_model.h" 17 #include "ui/app_list/pagination_model.h"
18 #include "ui/app_list/views/app_list_view.h" 18 #include "ui/app_list/views/app_list_view.h"
19 #include "ui/aura/client/focus_client.h" 19 #include "ui/aura/client/focus_client.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // will be released with AppListView on close. 163 // will be released with AppListView on close.
164 app_list::AppListView* view = new app_list::AppListView( 164 app_list::AppListView* view = new app_list::AppListView(
165 Shell::GetInstance()->delegate()->CreateAppListViewDelegate()); 165 Shell::GetInstance()->delegate()->CreateAppListViewDelegate());
166 aura::Window* root_window = window->GetRootWindow(); 166 aura::Window* root_window = window->GetRootWindow();
167 aura::Window* container = GetRootWindowController(root_window)-> 167 aura::Window* container = GetRootWindowController(root_window)->
168 GetContainer(kShellWindowId_AppListContainer); 168 GetContainer(kShellWindowId_AppListContainer);
169 if (ash::switches::UseAlternateShelfLayout()) { 169 if (ash::switches::UseAlternateShelfLayout()) {
170 gfx::Rect applist_button_bounds = Shelf::ForWindow(container)-> 170 gfx::Rect applist_button_bounds = Shelf::ForWindow(container)->
171 GetAppListButtonView()->GetBoundsInScreen(); 171 GetAppListButtonView()->GetBoundsInScreen();
172 // We need the location of the button within the local screen. 172 // We need the location of the button within the local screen.
173 applist_button_bounds = ash::ScreenAsh::ConvertRectFromScreen( 173 applist_button_bounds = ScreenUtil::ConvertRectFromScreen(
174 root_window, 174 root_window,
175 applist_button_bounds); 175 applist_button_bounds);
176 view->InitAsBubbleAttachedToAnchor( 176 view->InitAsBubbleAttachedToAnchor(
177 container, 177 container,
178 pagination_model_.get(), 178 pagination_model_.get(),
179 Shelf::ForWindow(container)->GetAppListButtonView(), 179 Shelf::ForWindow(container)->GetAppListButtonView(),
180 GetAnchorPositionOffsetToShelf(applist_button_bounds, 180 GetAnchorPositionOffsetToShelf(applist_button_bounds,
181 Shelf::ForWindow(container)->GetAppListButtonView()-> 181 Shelf::ForWindow(container)->GetAppListButtonView()->
182 GetWidget()), 182 GetWidget()),
183 GetBubbleArrow(container), 183 GetBubbleArrow(container),
184 true /* border_accepts_events */); 184 true /* border_accepts_events */);
185 view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); 185 view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
186 } else { 186 } else {
187 view->InitAsBubbleAttachedToAnchor( 187 view->InitAsBubbleAttachedToAnchor(
188 container, 188 container,
189 pagination_model_.get(), 189 pagination_model_.get(),
190 Shelf::ForWindow(container)->GetAppListButtonView(), 190 Shelf::ForWindow(container)->GetAppListButtonView(),
191 gfx::Vector2d(), 191 gfx::Vector2d(),
192 GetBubbleArrow(container), 192 GetBubbleArrow(container),
193 true /* border_accepts_events */); 193 true /* border_accepts_events */);
194 } 194 }
195 SetView(view); 195 SetView(view);
196 // By setting us as DnD recipient, the app list knows that we can 196 // By setting us as DnD recipient, the app list knows that we can
197 // handle items. 197 // handle items.
198 if (!CommandLine::ForCurrentProcess()->HasSwitch( 198 if (!CommandLine::ForCurrentProcess()->HasSwitch(
199 ash::switches::kAshDisableDragAndDropAppListToLauncher)) { 199 switches::kAshDisableDragAndDropAppListToLauncher)) {
200 SetDragAndDropHostOfCurrentAppList( 200 SetDragAndDropHostOfCurrentAppList(
201 Shelf::ForWindow(window)->GetDragAndDropHostForAppList()); 201 Shelf::ForWindow(window)->GetDragAndDropHostForAppList());
202 } 202 }
203 } 203 }
204 // Update applist button status when app list visibility is changed. 204 // Update applist button status when app list visibility is changed.
205 Shelf::ForWindow(window)->GetAppListButtonView()->SchedulePaint(); 205 Shelf::ForWindow(window)->GetAppListButtonView()->SchedulePaint();
206 } 206 }
207 207
208 bool AppListController::IsVisible() const { 208 bool AppListController::IsVisible() const {
209 return view_ && view_->GetWidget()->IsVisible(); 209 return view_ && view_->GetWidget()->IsVisible();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 void AppListController::ProcessLocatedEvent(ui::LocatedEvent* event) { 281 void AppListController::ProcessLocatedEvent(ui::LocatedEvent* event) {
282 // If the event happened on a menu, then the event should not close the app 282 // If the event happened on a menu, then the event should not close the app
283 // list. 283 // list.
284 aura::Window* target = static_cast<aura::Window*>(event->target()); 284 aura::Window* target = static_cast<aura::Window*>(event->target());
285 if (target) { 285 if (target) {
286 RootWindowController* root_controller = 286 RootWindowController* root_controller =
287 GetRootWindowController(target->GetRootWindow()); 287 GetRootWindowController(target->GetRootWindow());
288 if (root_controller) { 288 if (root_controller) {
289 aura::Window* menu_container = root_controller->GetContainer( 289 aura::Window* menu_container = root_controller->GetContainer(
290 ash::internal::kShellWindowId_MenuContainer); 290 internal::kShellWindowId_MenuContainer);
291 if (menu_container->Contains(target)) 291 if (menu_container->Contains(target))
292 return; 292 return;
293 aura::Window* keyboard_container = root_controller->GetContainer( 293 aura::Window* keyboard_container = root_controller->GetContainer(
294 ash::internal::kShellWindowId_VirtualKeyboardContainer); 294 internal::kShellWindowId_VirtualKeyboardContainer);
295 if (keyboard_container->Contains(target)) 295 if (keyboard_container->Contains(target))
296 return; 296 return;
297 } 297 }
298 } 298 }
299 299
300 if (view_ && is_visible_) { 300 if (view_ && is_visible_) {
301 aura::Window* window = view_->GetWidget()->GetNativeView(); 301 aura::Window* window = view_->GetWidget()->GetNativeView();
302 gfx::Point window_local_point(event->root_location()); 302 gfx::Point window_local_point(event->root_location());
303 aura::Window::ConvertPointToTarget(window->GetRootWindow(), 303 aura::Window::ConvertPointToTarget(window->GetRootWindow(),
304 window, 304 window,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 should_snap_back_ = false; 430 should_snap_back_ = false;
431 ui::ScopedLayerAnimationSettings animation(widget_animator); 431 ui::ScopedLayerAnimationSettings animation(widget_animator);
432 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( 432 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
433 app_list::kOverscrollPageTransitionDurationMs)); 433 app_list::kOverscrollPageTransitionDurationMs));
434 widget->SetBounds(view_bounds_); 434 widget->SetBounds(view_bounds_);
435 } 435 }
436 } 436 }
437 437
438 } // namespace internal 438 } // namespace internal
439 } // namespace ash 439 } // namespace ash
OLDNEW
« no previous file with comments | « ash/touch/touch_observer_hud_unittest.cc ('k') | ash/wm/base_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698