OLD | NEW |
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 <queue> | 7 #include <queue> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 container->SetProperty(kStayInSameRootWindowKey, true); | 211 container->SetProperty(kStayInSameRootWindowKey, true); |
212 } | 212 } |
213 | 213 |
214 void SetUsesEasyResizeTargeter(aura::Window* container) { | 214 void SetUsesEasyResizeTargeter(aura::Window* container) { |
215 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, | 215 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, |
216 -kResizeOutsideBoundsSize, | 216 -kResizeOutsideBoundsSize, |
217 -kResizeOutsideBoundsSize, | 217 -kResizeOutsideBoundsSize, |
218 -kResizeOutsideBoundsSize); | 218 -kResizeOutsideBoundsSize); |
219 gfx::Insets touch_extend = mouse_extend.Scale( | 219 gfx::Insets touch_extend = mouse_extend.Scale( |
220 kResizeOutsideBoundsScaleForTouch); | 220 kResizeOutsideBoundsScaleForTouch); |
221 container->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | 221 container->SetEventTargeter( |
222 new ::wm::EasyResizeWindowTargeter(container, mouse_extend, | 222 std::unique_ptr<ui::EventTargeter>(new ::wm::EasyResizeWindowTargeter( |
223 touch_extend))); | 223 container, mouse_extend, touch_extend))); |
224 } | 224 } |
225 | 225 |
226 // A window delegate which does nothing. Used to create a window that | 226 // A window delegate which does nothing. Used to create a window that |
227 // is a event target, but do nothing. | 227 // is a event target, but do nothing. |
228 class EmptyWindowDelegate : public aura::WindowDelegate { | 228 class EmptyWindowDelegate : public aura::WindowDelegate { |
229 public: | 229 public: |
230 EmptyWindowDelegate() {} | 230 EmptyWindowDelegate() {} |
231 ~EmptyWindowDelegate() override {} | 231 ~EmptyWindowDelegate() override {} |
232 | 232 |
233 // aura::WindowDelegate overrides: | 233 // aura::WindowDelegate overrides: |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 // We assume in throughout the code that this will not return NULL. If code | 553 // We assume in throughout the code that this will not return NULL. If code |
554 // triggers this for valid reasons, it should test status_area_widget first. | 554 // triggers this for valid reasons, it should test status_area_widget first. |
555 CHECK(shelf_->status_area_widget()); | 555 CHECK(shelf_->status_area_widget()); |
556 return shelf_->status_area_widget()->system_tray(); | 556 return shelf_->status_area_widget()->system_tray(); |
557 } | 557 } |
558 | 558 |
559 void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen, | 559 void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen, |
560 ui::MenuSourceType source_type) { | 560 ui::MenuSourceType source_type) { |
561 ShellDelegate* delegate = Shell::GetInstance()->delegate(); | 561 ShellDelegate* delegate = Shell::GetInstance()->delegate(); |
562 DCHECK(delegate); | 562 DCHECK(delegate); |
563 scoped_ptr<ui::MenuModel> menu_model( | 563 std::unique_ptr<ui::MenuModel> menu_model( |
564 delegate->CreateContextMenu(shelf_->shelf(), nullptr)); | 564 delegate->CreateContextMenu(shelf_->shelf(), nullptr)); |
565 if (!menu_model) | 565 if (!menu_model) |
566 return; | 566 return; |
567 | 567 |
568 // Background controller may not be set yet if user clicked on status are | 568 // Background controller may not be set yet if user clicked on status are |
569 // before initial animation completion. See crbug.com/222218 | 569 // before initial animation completion. See crbug.com/222218 |
570 if (!wallpaper_controller_.get()) | 570 if (!wallpaper_controller_.get()) |
571 return; | 571 return; |
572 | 572 |
573 views::MenuRunner menu_runner(menu_model.get(), | 573 views::MenuRunner menu_runner(menu_model.get(), |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 panel_container->AddPreTargetHandler(panel_container_handler_.get()); | 789 panel_container->AddPreTargetHandler(panel_container_handler_.get()); |
790 | 790 |
791 // Install an AttachedPanelWindowTargeter on the panel container to make it | 791 // Install an AttachedPanelWindowTargeter on the panel container to make it |
792 // easier to correctly target shelf buttons with touch. | 792 // easier to correctly target shelf buttons with touch. |
793 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, | 793 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, |
794 -kResizeOutsideBoundsSize, | 794 -kResizeOutsideBoundsSize, |
795 -kResizeOutsideBoundsSize, | 795 -kResizeOutsideBoundsSize, |
796 -kResizeOutsideBoundsSize); | 796 -kResizeOutsideBoundsSize); |
797 gfx::Insets touch_extend = mouse_extend.Scale( | 797 gfx::Insets touch_extend = mouse_extend.Scale( |
798 kResizeOutsideBoundsScaleForTouch); | 798 kResizeOutsideBoundsScaleForTouch); |
799 panel_container->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | 799 panel_container->SetEventTargeter( |
800 new AttachedPanelWindowTargeter(panel_container, | 800 std::unique_ptr<ui::EventTargeter>(new AttachedPanelWindowTargeter( |
801 mouse_extend, | 801 panel_container, mouse_extend, touch_extend, panel_layout_manager_))); |
802 touch_extend, | |
803 panel_layout_manager_))); | |
804 } | 802 } |
805 | 803 |
806 void RootWindowController::InitTouchHuds() { | 804 void RootWindowController::InitTouchHuds() { |
807 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 805 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
808 if (command_line->HasSwitch(switches::kAshTouchHud)) | 806 if (command_line->HasSwitch(switches::kAshTouchHud)) |
809 set_touch_hud_debug(new TouchHudDebug(GetRootWindow())); | 807 set_touch_hud_debug(new TouchHudDebug(GetRootWindow())); |
810 if (Shell::GetInstance()->is_touch_hud_projection_enabled()) | 808 if (Shell::GetInstance()->is_touch_hud_projection_enabled()) |
811 EnableTouchHudProjection(); | 809 EnableTouchHudProjection(); |
812 } | 810 } |
813 | 811 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 else | 1047 else |
1050 DisableTouchHudProjection(); | 1048 DisableTouchHudProjection(); |
1051 } | 1049 } |
1052 | 1050 |
1053 RootWindowController* GetRootWindowController( | 1051 RootWindowController* GetRootWindowController( |
1054 const aura::Window* root_window) { | 1052 const aura::Window* root_window) { |
1055 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 1053 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
1056 } | 1054 } |
1057 | 1055 |
1058 } // namespace ash | 1056 } // namespace ash |
OLD | NEW |