| 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/wm/panels/panel_layout_manager.h" | 5 #include "ash/wm/panels/panel_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
| 9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_button.h" | 10 #include "ash/shelf/shelf_button.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { | 73 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { |
| 74 return CreatePanelWindowWithDelegate(NULL, bounds); | 74 return CreatePanelWindowWithDelegate(NULL, bounds); |
| 75 } | 75 } |
| 76 | 76 |
| 77 aura::Window* GetPanelContainer(aura::Window* panel) { | 77 aura::Window* GetPanelContainer(aura::Window* panel) { |
| 78 return Shell::GetContainer(panel->GetRootWindow(), | 78 return Shell::GetContainer(panel->GetRootWindow(), |
| 79 kShellWindowId_PanelContainer); | 79 kShellWindowId_PanelContainer); |
| 80 } | 80 } |
| 81 | 81 |
| 82 views::Widget* GetCalloutWidgetForPanel(aura::Window* panel) { | 82 views::Widget* GetCalloutWidgetForPanel(aura::Window* panel) { |
| 83 PanelLayoutManager* manager = | 83 wm::WmWindow* wm_panel = wm::WmWindowAura::Get(panel); |
| 84 static_cast<PanelLayoutManager*>(GetPanelContainer(panel)-> | 84 PanelLayoutManager* manager = PanelLayoutManager::Get(wm_panel); |
| 85 layout_manager()); | |
| 86 DCHECK(manager); | 85 DCHECK(manager); |
| 87 PanelLayoutManager::PanelList::iterator found = std::find( | 86 PanelLayoutManager::PanelList::iterator found = |
| 88 manager->panel_windows_.begin(), manager->panel_windows_.end(), | 87 std::find(manager->panel_windows_.begin(), |
| 89 panel); | 88 manager->panel_windows_.end(), wm_panel); |
| 90 DCHECK(found != manager->panel_windows_.end()); | 89 DCHECK(found != manager->panel_windows_.end()); |
| 91 DCHECK(found->callout_widget); | 90 DCHECK(found->callout_widget); |
| 92 return reinterpret_cast<views::Widget*>(found->callout_widget); | 91 return found->CalloutWidget(); |
| 93 } | 92 } |
| 94 | 93 |
| 95 void PanelInScreen(aura::Window* panel) { | 94 void PanelInScreen(aura::Window* panel) { |
| 96 gfx::Rect panel_bounds = panel->GetBoundsInRootWindow(); | 95 gfx::Rect panel_bounds = panel->GetBoundsInRootWindow(); |
| 97 gfx::Point root_point = gfx::Point(panel_bounds.x(), panel_bounds.y()); | 96 gfx::Point root_point = gfx::Point(panel_bounds.x(), panel_bounds.y()); |
| 98 gfx::Display display = ScreenUtil::FindDisplayContainingPoint(root_point); | 97 gfx::Display display = ScreenUtil::FindDisplayContainingPoint(root_point); |
| 99 | 98 |
| 100 gfx::Rect panel_bounds_in_screen = panel->GetBoundsInScreen(); | 99 gfx::Rect panel_bounds_in_screen = panel->GetBoundsInScreen(); |
| 101 gfx::Point screen_bottom_right = gfx::Point( | 100 gfx::Point screen_bottom_right = gfx::Point( |
| 102 panel_bounds_in_screen.right(), | 101 panel_bounds_in_screen.right(), |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 // Hit test outside the left edge with a left-aligned shelf. | 811 // Hit test outside the left edge with a left-aligned shelf. |
| 813 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5)); | 812 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5)); |
| 814 target = targeter->FindTargetForEvent(root, &touch); | 813 target = targeter->FindTargetForEvent(root, &touch); |
| 815 EXPECT_NE(w.get(), target); | 814 EXPECT_NE(w.get(), target); |
| 816 } | 815 } |
| 817 | 816 |
| 818 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, | 817 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, |
| 819 testing::Bool()); | 818 testing::Bool()); |
| 820 | 819 |
| 821 } // namespace ash | 820 } // namespace ash |
| OLD | NEW |