OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/shelf/shelf_widget.h" | 5 #include "ash/common/shelf/shelf_widget.h" |
6 | 6 |
7 #include "ash/common/shelf/shelf_constants.h" | 7 #include "ash/common/shelf/shelf_constants.h" |
8 #include "ash/common/shelf/shelf_layout_manager.h" | 8 #include "ash/common/shelf/shelf_layout_manager.h" |
9 #include "ash/common/shelf/shelf_view.h" | 9 #include "ash/common/shelf/shelf_view.h" |
10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 324 } |
325 | 325 |
326 namespace { | 326 namespace { |
327 | 327 |
328 // A ShellObserver that sets the shelf alignment and auto hide behavior when the | 328 // A ShellObserver that sets the shelf alignment and auto hide behavior when the |
329 // shelf is created, to simulate ChromeLauncherController's behavior. | 329 // shelf is created, to simulate ChromeLauncherController's behavior. |
330 class ShelfInitializer : public ShellObserver { | 330 class ShelfInitializer : public ShellObserver { |
331 public: | 331 public: |
332 ShelfInitializer(ShelfAlignment alignment, ShelfAutoHideBehavior auto_hide) | 332 ShelfInitializer(ShelfAlignment alignment, ShelfAutoHideBehavior auto_hide) |
333 : alignment_(alignment), auto_hide_(auto_hide) { | 333 : alignment_(alignment), auto_hide_(auto_hide) { |
334 WmShell::Get()->AddShellObserver(this); | 334 Shell::GetInstance()->AddShellObserver(this); |
335 } | 335 } |
336 ~ShelfInitializer() override { WmShell::Get()->RemoveShellObserver(this); } | 336 ~ShelfInitializer() override { |
| 337 Shell::GetInstance()->RemoveShellObserver(this); |
| 338 } |
337 | 339 |
338 // ShellObserver: | 340 // ShellObserver: |
339 void OnShelfCreatedForRootWindow(WmWindow* root_window) override { | 341 void OnShelfCreatedForRootWindow(WmWindow* root_window) override { |
340 WmShelf* shelf = root_window->GetRootWindowController()->GetShelf(); | 342 WmShelf* shelf = root_window->GetRootWindowController()->GetShelf(); |
341 shelf->SetAlignment(alignment_); | 343 shelf->SetAlignment(alignment_); |
342 shelf->SetAutoHideBehavior(auto_hide_); | 344 shelf->SetAutoHideBehavior(auto_hide_); |
343 shelf->UpdateVisibilityState(); | 345 shelf->UpdateVisibilityState(); |
344 } | 346 } |
345 | 347 |
346 private: | 348 private: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 } | 410 } |
409 | 411 |
410 TEST_F(ShelfWidgetTestWithInitializer, CreateLockedShelf) { | 412 TEST_F(ShelfWidgetTestWithInitializer, CreateLockedShelf) { |
411 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. | 413 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. |
412 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED, | 414 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED, |
413 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 415 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, |
414 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); | 416 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); |
415 } | 417 } |
416 | 418 |
417 } // namespace ash | 419 } // namespace ash |
OLD | NEW |