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/test/test_shell_delegate.h" | 5 #include "ash/test/test_shell_delegate.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "ash/gpu_support_stub.h" | 9 #include "ash/gpu_support_stub.h" |
10 #include "ash/palette_delegate.h" | 10 #include "ash/palette_delegate.h" |
11 #include "ash/public/cpp/shell_window_ids.h" | 11 #include "ash/public/cpp/shell_window_ids.h" |
12 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
13 #include "ash/session/session_state_delegate.h" | 13 #include "ash/session/session_state_delegate.h" |
14 #include "ash/shelf/wm_shelf.h" | 14 #include "ash/shelf/shelf.h" |
15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
16 #include "ash/shell_observer.h" | 16 #include "ash/shell_observer.h" |
17 #include "ash/system/tray/system_tray_notifier.h" | 17 #include "ash/system/tray/system_tray_notifier.h" |
18 #include "ash/test/test_accessibility_delegate.h" | 18 #include "ash/test/test_accessibility_delegate.h" |
19 #include "ash/test/test_keyboard_ui.h" | 19 #include "ash/test/test_keyboard_ui.h" |
20 #include "ash/test/test_session_state_delegate.h" | 20 #include "ash/test/test_session_state_delegate.h" |
21 #include "ash/test/test_system_tray_delegate.h" | 21 #include "ash/test/test_system_tray_delegate.h" |
22 #include "ash/test/test_wallpaper_delegate.h" | 22 #include "ash/test/test_wallpaper_delegate.h" |
23 #include "ash/wm/window_state.h" | 23 #include "ash/wm/window_state.h" |
24 #include "ash/wm/window_util.h" | 24 #include "ash/wm/window_util.h" |
25 #include "ash/wm_window.h" | 25 #include "ash/wm_window.h" |
26 #include "base/logging.h" | 26 #include "base/logging.h" |
27 #include "base/memory/ptr_util.h" | 27 #include "base/memory/ptr_util.h" |
28 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
29 #include "ui/gfx/image/image.h" | 29 #include "ui/gfx/image/image.h" |
30 | 30 |
31 namespace ash { | 31 namespace ash { |
32 namespace test { | 32 namespace test { |
33 | 33 |
34 // A ShellObserver that sets the shelf alignment and auto hide behavior when the | 34 // A ShellObserver that sets the shelf alignment and auto hide behavior when the |
35 // shelf is created, to simulate ChromeLauncherController's behavior. | 35 // shelf is created, to simulate ChromeLauncherController's behavior. |
36 class ShelfInitializer : public ShellObserver { | 36 class ShelfInitializer : public ShellObserver { |
37 public: | 37 public: |
38 ShelfInitializer() { Shell::Get()->AddShellObserver(this); } | 38 ShelfInitializer() { Shell::Get()->AddShellObserver(this); } |
39 ~ShelfInitializer() override { Shell::Get()->RemoveShellObserver(this); } | 39 ~ShelfInitializer() override { Shell::Get()->RemoveShellObserver(this); } |
40 | 40 |
41 // ShellObserver: | 41 // ShellObserver: |
42 void OnShelfCreatedForRootWindow(WmWindow* root_window) override { | 42 void OnShelfCreatedForRootWindow(WmWindow* root_window) override { |
43 WmShelf* shelf = root_window->GetRootWindowController()->GetShelf(); | 43 Shelf* shelf = root_window->GetRootWindowController()->GetShelf(); |
44 // Do not override the custom initialization performed by some unit tests. | 44 // Do not override the custom initialization performed by some unit tests. |
45 if (shelf->alignment() == SHELF_ALIGNMENT_BOTTOM_LOCKED && | 45 if (shelf->alignment() == SHELF_ALIGNMENT_BOTTOM_LOCKED && |
46 shelf->auto_hide_behavior() == SHELF_AUTO_HIDE_ALWAYS_HIDDEN) { | 46 shelf->auto_hide_behavior() == SHELF_AUTO_HIDE_ALWAYS_HIDDEN) { |
47 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 47 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
48 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 48 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
49 shelf->UpdateVisibilityState(); | 49 shelf->UpdateVisibilityState(); |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 private: | 53 private: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 AccessibilityDelegate* TestShellDelegate::CreateAccessibilityDelegate() { | 125 AccessibilityDelegate* TestShellDelegate::CreateAccessibilityDelegate() { |
126 return new TestAccessibilityDelegate(); | 126 return new TestAccessibilityDelegate(); |
127 } | 127 } |
128 | 128 |
129 std::unique_ptr<PaletteDelegate> TestShellDelegate::CreatePaletteDelegate() { | 129 std::unique_ptr<PaletteDelegate> TestShellDelegate::CreatePaletteDelegate() { |
130 return nullptr; | 130 return nullptr; |
131 } | 131 } |
132 | 132 |
133 ui::MenuModel* TestShellDelegate::CreateContextMenu(WmShelf* wm_shelf, | 133 ui::MenuModel* TestShellDelegate::CreateContextMenu(Shelf* shelf, |
134 const ShelfItem* item) { | 134 const ShelfItem* item) { |
135 return nullptr; | 135 return nullptr; |
136 } | 136 } |
137 | 137 |
138 GPUSupport* TestShellDelegate::CreateGPUSupport() { | 138 GPUSupport* TestShellDelegate::CreateGPUSupport() { |
139 // Real GPU support depends on src/content, so just use a stub. | 139 // Real GPU support depends on src/content, so just use a stub. |
140 return new GPUSupportStub; | 140 return new GPUSupportStub; |
141 } | 141 } |
142 | 142 |
143 base::string16 TestShellDelegate::GetProductName() const { | 143 base::string16 TestShellDelegate::GetProductName() const { |
(...skipping 16 matching lines...) Expand all Loading... |
160 void TestShellDelegate::SetTouchscreenEnabledInPrefs(bool enabled, | 160 void TestShellDelegate::SetTouchscreenEnabledInPrefs(bool enabled, |
161 bool use_local_state) { | 161 bool use_local_state) { |
162 if (use_local_state) | 162 if (use_local_state) |
163 touchscreen_enabled_in_local_pref_ = enabled; | 163 touchscreen_enabled_in_local_pref_ = enabled; |
164 } | 164 } |
165 | 165 |
166 void TestShellDelegate::UpdateTouchscreenStatusFromPrefs() {} | 166 void TestShellDelegate::UpdateTouchscreenStatusFromPrefs() {} |
167 | 167 |
168 } // namespace test | 168 } // namespace test |
169 } // namespace ash | 169 } // namespace ash |
OLD | NEW |