OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/aura/wm_shelf_aura.h" | 5 #include "ash/aura/wm_shelf_aura.h" |
6 | 6 |
7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/shelf/shelf_layout_manager.h" | 8 #include "ash/common/shelf/shelf_layout_manager.h" |
9 #include "ash/shelf/dimmer_view.h" | |
10 #include "ash/shelf/shelf_bezel_event_handler.h" | 9 #include "ash/shelf/shelf_bezel_event_handler.h" |
11 #include "ash/shell.h" | 10 #include "ash/shell.h" |
12 | 11 |
13 namespace ash { | 12 namespace ash { |
14 | 13 |
15 // WmShelfAura::AutoHideEventHandler ------------------------------------------- | 14 // WmShelfAura::AutoHideEventHandler ------------------------------------------- |
16 | 15 |
17 // Forwards mouse and gesture events to ShelfLayoutManager for auto-hide. | 16 // Forwards mouse and gesture events to ShelfLayoutManager for auto-hide. |
18 // TODO(mash): Add similar event handling support for mash. | 17 // TODO(mash): Add similar event handling support for mash. |
19 class WmShelfAura::AutoHideEventHandler : public ui::EventHandler { | 18 class WmShelfAura::AutoHideEventHandler : public ui::EventHandler { |
(...skipping 20 matching lines...) Expand all Loading... |
40 ShelfLayoutManager* shelf_layout_manager_; | 39 ShelfLayoutManager* shelf_layout_manager_; |
41 DISALLOW_COPY_AND_ASSIGN(AutoHideEventHandler); | 40 DISALLOW_COPY_AND_ASSIGN(AutoHideEventHandler); |
42 }; | 41 }; |
43 | 42 |
44 // WmShelfAura ----------------------------------------------------------------- | 43 // WmShelfAura ----------------------------------------------------------------- |
45 | 44 |
46 WmShelfAura::WmShelfAura() {} | 45 WmShelfAura::WmShelfAura() {} |
47 | 46 |
48 WmShelfAura::~WmShelfAura() {} | 47 WmShelfAura::~WmShelfAura() {} |
49 | 48 |
50 WmDimmerView* WmShelfAura::CreateDimmerView(bool disable_animations_for_test) { | |
51 return DimmerView::Create(this, disable_animations_for_test); | |
52 } | |
53 | |
54 void WmShelfAura::CreateShelfWidget(WmWindow* root) { | 49 void WmShelfAura::CreateShelfWidget(WmWindow* root) { |
55 WmShelf::CreateShelfWidget(root); | 50 WmShelf::CreateShelfWidget(root); |
56 bezel_event_handler_.reset(new ShelfBezelEventHandler(this)); | 51 bezel_event_handler_.reset(new ShelfBezelEventHandler(this)); |
57 } | 52 } |
58 | 53 |
59 void WmShelfAura::WillDeleteShelfLayoutManager() { | 54 void WmShelfAura::WillDeleteShelfLayoutManager() { |
60 // Clear event handlers that might forward events to the destroyed instance. | 55 // Clear event handlers that might forward events to the destroyed instance. |
61 auto_hide_event_handler_.reset(); | 56 auto_hide_event_handler_.reset(); |
62 bezel_event_handler_.reset(); | 57 bezel_event_handler_.reset(); |
63 WmShelf::WillDeleteShelfLayoutManager(); | 58 WmShelf::WillDeleteShelfLayoutManager(); |
64 } | 59 } |
65 | 60 |
66 void WmShelfAura::WillChangeVisibilityState(ShelfVisibilityState new_state) { | 61 void WmShelfAura::WillChangeVisibilityState(ShelfVisibilityState new_state) { |
67 WmShelf::WillChangeVisibilityState(new_state); | 62 WmShelf::WillChangeVisibilityState(new_state); |
68 if (new_state != SHELF_AUTO_HIDE) { | 63 if (new_state != SHELF_AUTO_HIDE) { |
69 auto_hide_event_handler_.reset(); | 64 auto_hide_event_handler_.reset(); |
70 } else if (!auto_hide_event_handler_) { | 65 } else if (!auto_hide_event_handler_) { |
71 auto_hide_event_handler_.reset( | 66 auto_hide_event_handler_.reset( |
72 new AutoHideEventHandler(shelf_layout_manager())); | 67 new AutoHideEventHandler(shelf_layout_manager())); |
73 } | 68 } |
74 } | 69 } |
75 | 70 |
76 } // namespace ash | 71 } // namespace ash |
OLD | NEW |