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/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/display/display_layout.h" | 9 #include "ash/display/display_layout.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 class MaximizeDelegateView : public views::WidgetDelegateView { | 44 class MaximizeDelegateView : public views::WidgetDelegateView { |
45 public: | 45 public: |
46 explicit MaximizeDelegateView(const gfx::Rect& initial_bounds) | 46 explicit MaximizeDelegateView(const gfx::Rect& initial_bounds) |
47 : initial_bounds_(initial_bounds) { | 47 : initial_bounds_(initial_bounds) { |
48 } | 48 } |
49 virtual ~MaximizeDelegateView() {} | 49 virtual ~MaximizeDelegateView() {} |
50 | 50 |
51 virtual bool GetSavedWindowPlacement( | 51 virtual bool GetSavedWindowPlacement( |
52 const views::Widget* widget, | 52 const views::Widget* widget, |
53 gfx::Rect* bounds, | 53 gfx::Rect* bounds, |
54 ui::WindowShowState* show_state) const OVERRIDE { | 54 ui::WindowShowState* show_state) const override { |
55 *bounds = initial_bounds_; | 55 *bounds = initial_bounds_; |
56 *show_state = ui::SHOW_STATE_MAXIMIZED; | 56 *show_state = ui::SHOW_STATE_MAXIMIZED; |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 private: | 60 private: |
61 const gfx::Rect initial_bounds_; | 61 const gfx::Rect initial_bounds_; |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(MaximizeDelegateView); | 63 DISALLOW_COPY_AND_ASSIGN(MaximizeDelegateView); |
64 }; | 64 }; |
65 | 65 |
66 class TestShellObserver : public ShellObserver { | 66 class TestShellObserver : public ShellObserver { |
67 public: | 67 public: |
68 TestShellObserver() : call_count_(0), | 68 TestShellObserver() : call_count_(0), |
69 is_fullscreen_(false) { | 69 is_fullscreen_(false) { |
70 Shell::GetInstance()->AddShellObserver(this); | 70 Shell::GetInstance()->AddShellObserver(this); |
71 } | 71 } |
72 | 72 |
73 virtual ~TestShellObserver() { | 73 virtual ~TestShellObserver() { |
74 Shell::GetInstance()->RemoveShellObserver(this); | 74 Shell::GetInstance()->RemoveShellObserver(this); |
75 } | 75 } |
76 | 76 |
77 virtual void OnFullscreenStateChanged(bool is_fullscreen, | 77 virtual void OnFullscreenStateChanged(bool is_fullscreen, |
78 aura::Window* root_window) OVERRIDE { | 78 aura::Window* root_window) override { |
79 call_count_++; | 79 call_count_++; |
80 is_fullscreen_ = is_fullscreen; | 80 is_fullscreen_ = is_fullscreen; |
81 } | 81 } |
82 | 82 |
83 int call_count() const { | 83 int call_count() const { |
84 return call_count_; | 84 return call_count_; |
85 } | 85 } |
86 | 86 |
87 bool is_fullscreen() const { | 87 bool is_fullscreen() const { |
88 return is_fullscreen_; | 88 return is_fullscreen_; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 // sees the window was maximized it changes the bounds of a secondary | 308 // sees the window was maximized it changes the bounds of a secondary |
309 // window. The secondary window mirrors the status window. | 309 // window. The secondary window mirrors the status window. |
310 class DontClobberRestoreBoundsWindowObserver : public aura::WindowObserver { | 310 class DontClobberRestoreBoundsWindowObserver : public aura::WindowObserver { |
311 public: | 311 public: |
312 DontClobberRestoreBoundsWindowObserver() : window_(NULL) {} | 312 DontClobberRestoreBoundsWindowObserver() : window_(NULL) {} |
313 | 313 |
314 void set_window(aura::Window* window) { window_ = window; } | 314 void set_window(aura::Window* window) { window_ = window; } |
315 | 315 |
316 virtual void OnWindowPropertyChanged(aura::Window* window, | 316 virtual void OnWindowPropertyChanged(aura::Window* window, |
317 const void* key, | 317 const void* key, |
318 intptr_t old) OVERRIDE { | 318 intptr_t old) override { |
319 if (!window_) | 319 if (!window_) |
320 return; | 320 return; |
321 | 321 |
322 if (wm::GetWindowState(window)->IsMaximized()) { | 322 if (wm::GetWindowState(window)->IsMaximized()) { |
323 aura::Window* w = window_; | 323 aura::Window* w = window_; |
324 window_ = NULL; | 324 window_ = NULL; |
325 | 325 |
326 gfx::Rect shelf_bounds(Shell::GetPrimaryRootWindowController()-> | 326 gfx::Rect shelf_bounds(Shell::GetPrimaryRootWindowController()-> |
327 GetShelfLayoutManager()->GetIdealBounds()); | 327 GetShelfLayoutManager()->GetIdealBounds()); |
328 const gfx::Rect& window_bounds(w->bounds()); | 328 const gfx::Rect& window_bounds(w->bounds()); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 public: | 572 public: |
573 FocusDelegate() | 573 FocusDelegate() |
574 : window_(NULL), | 574 : window_(NULL), |
575 show_state_(ui::SHOW_STATE_END) { | 575 show_state_(ui::SHOW_STATE_END) { |
576 } | 576 } |
577 virtual ~FocusDelegate() {} | 577 virtual ~FocusDelegate() {} |
578 | 578 |
579 void set_window(aura::Window* window) { window_ = window; } | 579 void set_window(aura::Window* window) { window_ = window; } |
580 | 580 |
581 // aura::test::TestWindowDelegate overrides: | 581 // aura::test::TestWindowDelegate overrides: |
582 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE { | 582 virtual void OnWindowTargetVisibilityChanged(bool visible) override { |
583 if (window_) { | 583 if (window_) { |
584 if (visible) | 584 if (visible) |
585 window_->Focus(); | 585 window_->Focus(); |
586 show_state_ = window_->GetProperty(aura::client::kShowStateKey); | 586 show_state_ = window_->GetProperty(aura::client::kShowStateKey); |
587 } | 587 } |
588 } | 588 } |
589 | 589 |
590 ui::WindowShowState GetShowStateAndReset() { | 590 ui::WindowShowState GetShowStateAndReset() { |
591 ui::WindowShowState ret = show_state_; | 591 ui::WindowShowState ret = show_state_; |
592 show_state_ = ui::SHOW_STATE_END; | 592 show_state_ = ui::SHOW_STATE_END; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 | 783 |
784 // Following tests are written to test the backdrop functionality. | 784 // Following tests are written to test the backdrop functionality. |
785 | 785 |
786 namespace { | 786 namespace { |
787 | 787 |
788 class WorkspaceLayoutManagerBackdropTest : public test::AshTestBase { | 788 class WorkspaceLayoutManagerBackdropTest : public test::AshTestBase { |
789 public: | 789 public: |
790 WorkspaceLayoutManagerBackdropTest() {} | 790 WorkspaceLayoutManagerBackdropTest() {} |
791 virtual ~WorkspaceLayoutManagerBackdropTest() {} | 791 virtual ~WorkspaceLayoutManagerBackdropTest() {} |
792 | 792 |
793 virtual void SetUp() OVERRIDE { | 793 virtual void SetUp() override { |
794 test::AshTestBase::SetUp(); | 794 test::AshTestBase::SetUp(); |
795 UpdateDisplay("800x600"); | 795 UpdateDisplay("800x600"); |
796 default_container_ = Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 796 default_container_ = Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
797 kShellWindowId_DefaultContainer); | 797 kShellWindowId_DefaultContainer); |
798 } | 798 } |
799 | 799 |
800 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { | 800 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { |
801 aura::Window* window = CreateTestWindowInShellWithBounds(bounds); | 801 aura::Window* window = CreateTestWindowInShellWithBounds(bounds); |
802 return window; | 802 return window; |
803 } | 803 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 | 971 |
972 EXPECT_GT(default_container()->children()[0]->bounds().height(), | 972 EXPECT_GT(default_container()->children()[0]->bounds().height(), |
973 reduced_bounds.height()); | 973 reduced_bounds.height()); |
974 } | 974 } |
975 | 975 |
976 class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase { | 976 class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase { |
977 public: | 977 public: |
978 WorkspaceLayoutManagerKeyboardTest() {} | 978 WorkspaceLayoutManagerKeyboardTest() {} |
979 virtual ~WorkspaceLayoutManagerKeyboardTest() {} | 979 virtual ~WorkspaceLayoutManagerKeyboardTest() {} |
980 | 980 |
981 virtual void SetUp() OVERRIDE { | 981 virtual void SetUp() override { |
982 test::AshTestBase::SetUp(); | 982 test::AshTestBase::SetUp(); |
983 UpdateDisplay("800x600"); | 983 UpdateDisplay("800x600"); |
984 aura::Window* default_container = Shell::GetContainer( | 984 aura::Window* default_container = Shell::GetContainer( |
985 Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer); | 985 Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer); |
986 layout_manager_ = static_cast<WorkspaceLayoutManager*>( | 986 layout_manager_ = static_cast<WorkspaceLayoutManager*>( |
987 default_container->layout_manager()); | 987 default_container->layout_manager()); |
988 } | 988 } |
989 | 989 |
990 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { | 990 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { |
991 return CreateTestWindowInShellWithBounds(bounds); | 991 return CreateTestWindowInShellWithBounds(bounds); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 WorkspaceLayoutManager* layout_manager_; | 1043 WorkspaceLayoutManager* layout_manager_; |
1044 | 1044 |
1045 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerKeyboardTest); | 1045 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerKeyboardTest); |
1046 }; | 1046 }; |
1047 | 1047 |
1048 class FakeTextInputClient : public ui::DummyTextInputClient { | 1048 class FakeTextInputClient : public ui::DummyTextInputClient { |
1049 public: | 1049 public: |
1050 explicit FakeTextInputClient(gfx::NativeWindow window) : window_(window) {} | 1050 explicit FakeTextInputClient(gfx::NativeWindow window) : window_(window) {} |
1051 virtual ~FakeTextInputClient() {} | 1051 virtual ~FakeTextInputClient() {} |
1052 | 1052 |
1053 virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE { | 1053 virtual gfx::NativeWindow GetAttachedWindow() const override { |
1054 return window_; | 1054 return window_; |
1055 } | 1055 } |
1056 | 1056 |
1057 private: | 1057 private: |
1058 gfx::NativeWindow window_; | 1058 gfx::NativeWindow window_; |
1059 | 1059 |
1060 DISALLOW_COPY_AND_ASSIGN(FakeTextInputClient); | 1060 DISALLOW_COPY_AND_ASSIGN(FakeTextInputClient); |
1061 }; | 1061 }; |
1062 | 1062 |
1063 // Tests that when a child window gains focus the top level window containing it | 1063 // Tests that when a child window gains focus the top level window containing it |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 occluded_window_bounds.width(), | 1151 occluded_window_bounds.width(), |
1152 occluded_window_bounds.height()).ToString(), | 1152 occluded_window_bounds.height()).ToString(), |
1153 window->bounds().ToString()); | 1153 window->bounds().ToString()); |
1154 HideKeyboard(); | 1154 HideKeyboard(); |
1155 EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString()); | 1155 EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString()); |
1156 | 1156 |
1157 Blur(&text_input_client); | 1157 Blur(&text_input_client); |
1158 } | 1158 } |
1159 | 1159 |
1160 } // namespace ash | 1160 } // namespace ash |
OLD | NEW |