| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/test/test_shelf_delegate.h" | 5 #include "ash/common/test/test_shelf_delegate.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/shelf/shelf_model.h" | 9 #include "ash/common/shelf/shelf_model.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/common/shell_observer.h" | 11 #include "ash/common/shell_observer.h" |
| 12 #include "ash/common/test/test_shelf_item_delegate.h" | 12 #include "ash/common/test/test_shelf_item_delegate.h" |
| 13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/common/wm_window.h" | 14 #include "ash/common/wm_window.h" |
| 15 #include "ash/root_window_controller.h" | 15 #include "ash/root_window_controller.h" |
| 16 #include "ash/shell.h" |
| 16 #include "ash/wm/window_properties.h" | 17 #include "ash/wm/window_properties.h" |
| 17 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 18 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 19 | 20 |
| 20 namespace ash { | 21 namespace ash { |
| 21 namespace test { | 22 namespace test { |
| 22 | 23 |
| 23 TestShelfDelegate* TestShelfDelegate::instance_ = nullptr; | 24 TestShelfDelegate* TestShelfDelegate::instance_ = nullptr; |
| 24 | 25 |
| 25 // A ShellObserver that sets the shelf alignment and auto hide behavior when the | 26 // A ShellObserver that sets the shelf alignment and auto hide behavior when the |
| 26 // shelf is created, to simulate ChromeLauncherController's behavior. | 27 // shelf is created, to simulate ChromeLauncherController's behavior. |
| 27 class ShelfInitializer : public ShellObserver { | 28 class ShelfInitializer : public ShellObserver { |
| 28 public: | 29 public: |
| 29 ShelfInitializer() { WmShell::Get()->AddShellObserver(this); } | 30 ShelfInitializer() { Shell::GetInstance()->AddShellObserver(this); } |
| 30 ~ShelfInitializer() override { WmShell::Get()->RemoveShellObserver(this); } | 31 ~ShelfInitializer() override { |
| 32 Shell::GetInstance()->RemoveShellObserver(this); |
| 33 } |
| 31 | 34 |
| 32 // ShellObserver: | 35 // ShellObserver: |
| 33 void OnShelfCreatedForRootWindow(WmWindow* root_window) override { | 36 void OnShelfCreatedForRootWindow(WmWindow* root_window) override { |
| 34 WmShelf* shelf = root_window->GetRootWindowController()->GetShelf(); | 37 WmShelf* shelf = root_window->GetRootWindowController()->GetShelf(); |
| 35 // Do not override the custom initialization performed by some unit tests. | 38 // Do not override the custom initialization performed by some unit tests. |
| 36 if (shelf->alignment() == SHELF_ALIGNMENT_BOTTOM_LOCKED && | 39 if (shelf->alignment() == SHELF_ALIGNMENT_BOTTOM_LOCKED && |
| 37 shelf->auto_hide_behavior() == SHELF_AUTO_HIDE_ALWAYS_HIDDEN) { | 40 shelf->auto_hide_behavior() == SHELF_AUTO_HIDE_ALWAYS_HIDDEN) { |
| 38 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 41 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
| 39 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 42 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 40 shelf->UpdateVisibilityState(); | 43 shelf->UpdateVisibilityState(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 const std::string& app_id) { | 156 const std::string& app_id) { |
| 154 shelf_id_to_app_id_map_[shelf_id] = app_id; | 157 shelf_id_to_app_id_map_[shelf_id] = app_id; |
| 155 } | 158 } |
| 156 | 159 |
| 157 void TestShelfDelegate::RemoveShelfIDToAppIDMapping(ShelfID shelf_id) { | 160 void TestShelfDelegate::RemoveShelfIDToAppIDMapping(ShelfID shelf_id) { |
| 158 shelf_id_to_app_id_map_.erase(shelf_id); | 161 shelf_id_to_app_id_map_.erase(shelf_id); |
| 159 } | 162 } |
| 160 | 163 |
| 161 } // namespace test | 164 } // namespace test |
| 162 } // namespace ash | 165 } // namespace ash |
| OLD | NEW |