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

Side by Side Diff: ash/root_window_controller.cc

Issue 17063013: Separate projection mode from rest of touch HUD (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed TouchHudDebug and applied some more reviews Created 7 years, 6 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/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/desktop_background/desktop_background_widget_controller.h" 11 #include "ash/desktop_background/desktop_background_widget_controller.h"
12 #include "ash/display/display_controller.h" 12 #include "ash/display/display_controller.h"
13 #include "ash/display/display_manager.h" 13 #include "ash/display/display_manager.h"
14 #include "ash/focus_cycler.h" 14 #include "ash/focus_cycler.h"
15 #include "ash/session_state_delegate.h" 15 #include "ash/session_state_delegate.h"
16 #include "ash/shelf/shelf_layout_manager.h" 16 #include "ash/shelf/shelf_layout_manager.h"
17 #include "ash/shelf/shelf_types.h" 17 #include "ash/shelf/shelf_types.h"
18 #include "ash/shelf/shelf_widget.h" 18 #include "ash/shelf/shelf_widget.h"
19 #include "ash/shell.h" 19 #include "ash/shell.h"
20 #include "ash/shell_delegate.h" 20 #include "ash/shell_delegate.h"
21 #include "ash/shell_factory.h" 21 #include "ash/shell_factory.h"
22 #include "ash/shell_window_ids.h" 22 #include "ash/shell_window_ids.h"
23 #include "ash/system/status_area_widget.h" 23 #include "ash/system/status_area_widget.h"
24 #include "ash/system/tray/system_tray_delegate.h" 24 #include "ash/system/tray/system_tray_delegate.h"
25 #include "ash/touch/touch_observer_hud.h" 25 #include "ash/touch/touch_hud_debug.h"
26 #include "ash/touch/touch_hud_projection.h"
26 #include "ash/wm/base_layout_manager.h" 27 #include "ash/wm/base_layout_manager.h"
27 #include "ash/wm/boot_splash_screen.h" 28 #include "ash/wm/boot_splash_screen.h"
28 #include "ash/wm/dock/docked_window_layout_manager.h" 29 #include "ash/wm/dock/docked_window_layout_manager.h"
29 #include "ash/wm/panels/panel_layout_manager.h" 30 #include "ash/wm/panels/panel_layout_manager.h"
30 #include "ash/wm/property_util.h" 31 #include "ash/wm/property_util.h"
31 #include "ash/wm/root_window_layout_manager.h" 32 #include "ash/wm/root_window_layout_manager.h"
32 #include "ash/wm/screen_dimmer.h" 33 #include "ash/wm/screen_dimmer.h"
33 #include "ash/wm/stacking_controller.h" 34 #include "ash/wm/stacking_controller.h"
34 #include "ash/wm/status_area_layout_manager.h" 35 #include "ash/wm/status_area_layout_manager.h"
35 #include "ash/wm/system_background_controller.h" 36 #include "ash/wm/system_background_controller.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 164
164 } // namespace 165 } // namespace
165 166
166 namespace internal { 167 namespace internal {
167 168
168 RootWindowController::RootWindowController(aura::RootWindow* root_window) 169 RootWindowController::RootWindowController(aura::RootWindow* root_window)
169 : root_window_(root_window), 170 : root_window_(root_window),
170 root_window_layout_(NULL), 171 root_window_layout_(NULL),
171 docked_layout_manager_(NULL), 172 docked_layout_manager_(NULL),
172 panel_layout_manager_(NULL), 173 panel_layout_manager_(NULL),
173 touch_observer_hud_(NULL) { 174 touch_hud_debug_(NULL),
175 touch_hud_projection_(NULL) {
174 SetRootWindowController(root_window, this); 176 SetRootWindowController(root_window, this);
175 screen_dimmer_.reset(new ScreenDimmer(root_window)); 177 screen_dimmer_.reset(new ScreenDimmer(root_window));
176 178
177 stacking_controller_.reset(new ash::StackingController); 179 stacking_controller_.reset(new ash::StackingController);
178 aura::client::SetStackingClient(root_window, stacking_controller_.get()); 180 aura::client::SetStackingClient(root_window, stacking_controller_.get());
179 } 181 }
180 182
181 RootWindowController::~RootWindowController() { 183 RootWindowController::~RootWindowController() {
182 Shutdown(); 184 Shutdown();
183 root_window_.reset(); 185 root_window_.reset();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // so that the behavior and construction order is consistent betwheen Ash 299 // so that the behavior and construction order is consistent betwheen Ash
298 // and Chrome. 300 // and Chrome.
299 if (Shell::GetInstance()->session_state_delegate()->NumberOfLoggedInUsers()) 301 if (Shell::GetInstance()->session_state_delegate()->NumberOfLoggedInUsers())
300 shelf_->CreateLauncher(); 302 shelf_->CreateLauncher();
301 303
302 InitKeyboard(); 304 InitKeyboard();
303 } 305 }
304 306
305 void RootWindowController::CreateContainers() { 307 void RootWindowController::CreateContainers() {
306 CreateContainersInRootWindow(root_window_.get()); 308 CreateContainersInRootWindow(root_window_.get());
307
308 // Create touch observer HUD if needed. HUD should be created after the
309 // containers have been created, so that its widget can be added to them.
310 CommandLine* command_line = CommandLine::ForCurrentProcess();
311 if (command_line->HasSwitch(switches::kAshTouchHud))
312 touch_observer_hud_ = new TouchObserverHUD(root_window_.get());
313 } 309 }
314 310
315 void RootWindowController::CreateSystemBackground( 311 void RootWindowController::CreateSystemBackground(
316 bool is_first_run_after_boot) { 312 bool is_first_run_after_boot) {
317 SkColor color = SK_ColorBLACK; 313 SkColor color = SK_ColorBLACK;
318 #if defined(OS_CHROMEOS) 314 #if defined(OS_CHROMEOS)
319 if (is_first_run_after_boot) 315 if (is_first_run_after_boot)
320 color = kChromeOsBootColor; 316 color = kChromeOsBootColor;
321 #endif 317 #endif
322 system_background_.reset( 318 system_background_.reset(
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 shelf_.reset(NULL); 404 shelf_.reset(NULL);
409 } 405 }
410 406
411 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { 407 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) {
412 // Forget the shelf early so that shelf don't update itself using wrong 408 // Forget the shelf early so that shelf don't update itself using wrong
413 // display info. 409 // display info.
414 workspace_controller_->SetShelf(NULL); 410 workspace_controller_->SetShelf(NULL);
415 ReparentAllWindows(root_window_.get(), dst); 411 ReparentAllWindows(root_window_.get(), dst);
416 } 412 }
417 413
414 void RootWindowController::EnableTouchHudProjection() {
415 if (touch_hud_projection_)
416 return;
417 set_touch_hud_projection(new TouchHudProjection(root_window_.get()));
418 }
419
420 void RootWindowController::DisableTouchHudProjection() {
421 if (!touch_hud_projection_)
422 return;
423 touch_hud_projection_->Remove();
424 }
425
418 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { 426 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() {
419 return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; 427 return shelf_.get() ? shelf_->shelf_layout_manager() : NULL;
420 } 428 }
421 429
422 SystemTray* RootWindowController::GetSystemTray() { 430 SystemTray* RootWindowController::GetSystemTray() {
423 // We assume in throughout the code that this will not return NULL. If code 431 // We assume in throughout the code that this will not return NULL. If code
424 // triggers this for valid reasons, it should test status_area_widget first. 432 // triggers this for valid reasons, it should test status_area_widget first.
425 CHECK(shelf_.get() && shelf_->status_area_widget()); 433 CHECK(shelf_.get() && shelf_->status_area_widget());
426 return shelf_->status_area_widget()->system_tray(); 434 return shelf_->status_area_widget()->system_tray();
427 } 435 }
(...skipping 22 matching lines...) Expand all
450 return; 458 return;
451 } 459 }
452 460
453 Shell::GetInstance()->UpdateShelfVisibility(); 461 Shell::GetInstance()->UpdateShelfVisibility();
454 } 462 }
455 463
456 void RootWindowController::UpdateShelfVisibility() { 464 void RootWindowController::UpdateShelfVisibility() {
457 shelf_->shelf_layout_manager()->UpdateVisibilityState(); 465 shelf_->shelf_layout_manager()->UpdateVisibilityState();
458 } 466 }
459 467
468 void RootWindowController::InitTouchHuds() {
469 CommandLine* command_line = CommandLine::ForCurrentProcess();
470 if (command_line->HasSwitch(switches::kAshTouchHud))
471 set_touch_hud_debug(new TouchHudDebug(root_window_.get()));
472 if (Shell::GetInstance()->is_touch_hud_projection_enabled())
473 EnableTouchHudProjection();
474 }
475
460 aura::Window* RootWindowController::GetFullscreenWindow() const { 476 aura::Window* RootWindowController::GetFullscreenWindow() const {
461 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); 477 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow();
462 for (size_t i = 0; i < container->children().size(); ++i) { 478 for (size_t i = 0; i < container->children().size(); ++i) {
463 aura::Window* child = container->children()[i]; 479 aura::Window* child = container->children()[i];
464 if (ash::wm::IsWindowFullscreen(child)) 480 if (ash::wm::IsWindowFullscreen(child))
465 return child; 481 return child;
466 } 482 }
467 return NULL; 483 return NULL;
468 } 484 }
469 485
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 "OverlayContainer", 663 "OverlayContainer",
648 lock_screen_related_containers); 664 lock_screen_related_containers);
649 SetUsesScreenCoordinates(overlay_container); 665 SetUsesScreenCoordinates(overlay_container);
650 666
651 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, 667 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
652 "PowerButtonAnimationContainer", root_window) ; 668 "PowerButtonAnimationContainer", root_window) ;
653 } 669 }
654 670
655 } // namespace internal 671 } // namespace internal
656 } // namespace ash 672 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698