Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: ash/aura/wm_shelf_aura.cc

Issue 2626483002: Removes WmShelfAura and WmShelfMus (Closed)
Patch Set: merge Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/aura/wm_shelf_aura.h ('k') | ash/common/shelf/wm_shelf.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/aura/wm_shelf_aura.h"
6
7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/shelf/shelf_layout_manager.h"
9 #include "ash/shelf/shelf_bezel_event_handler.h"
10 #include "ash/shell.h"
11
12 namespace ash {
13
14 // WmShelfAura::AutoHideEventHandler -------------------------------------------
15
16 // Forwards mouse and gesture events to ShelfLayoutManager for auto-hide.
17 // TODO(mash): Add similar event handling support for mash.
18 class WmShelfAura::AutoHideEventHandler : public ui::EventHandler {
19 public:
20 explicit AutoHideEventHandler(ShelfLayoutManager* shelf_layout_manager)
21 : shelf_layout_manager_(shelf_layout_manager) {
22 Shell::GetInstance()->AddPreTargetHandler(this);
23 }
24 ~AutoHideEventHandler() override {
25 Shell::GetInstance()->RemovePreTargetHandler(this);
26 }
27
28 // Overridden from ui::EventHandler:
29 void OnMouseEvent(ui::MouseEvent* event) override {
30 shelf_layout_manager_->UpdateAutoHideForMouseEvent(
31 event, WmWindowAura::Get(static_cast<aura::Window*>(event->target())));
32 }
33 void OnGestureEvent(ui::GestureEvent* event) override {
34 shelf_layout_manager_->UpdateAutoHideForGestureEvent(
35 event, WmWindowAura::Get(static_cast<aura::Window*>(event->target())));
36 }
37
38 private:
39 ShelfLayoutManager* shelf_layout_manager_;
40 DISALLOW_COPY_AND_ASSIGN(AutoHideEventHandler);
41 };
42
43 // WmShelfAura -----------------------------------------------------------------
44
45 WmShelfAura::WmShelfAura() {}
46
47 WmShelfAura::~WmShelfAura() {}
48
49 void WmShelfAura::CreateShelfWidget(WmWindow* root) {
50 WmShelf::CreateShelfWidget(root);
51 bezel_event_handler_.reset(new ShelfBezelEventHandler(this));
52 }
53
54 void WmShelfAura::WillDeleteShelfLayoutManager() {
55 // Clear event handlers that might forward events to the destroyed instance.
56 auto_hide_event_handler_.reset();
57 bezel_event_handler_.reset();
58 WmShelf::WillDeleteShelfLayoutManager();
59 }
60
61 void WmShelfAura::WillChangeVisibilityState(ShelfVisibilityState new_state) {
62 WmShelf::WillChangeVisibilityState(new_state);
63 if (new_state != SHELF_AUTO_HIDE) {
64 auto_hide_event_handler_.reset();
65 } else if (!auto_hide_event_handler_) {
66 auto_hide_event_handler_.reset(
67 new AutoHideEventHandler(shelf_layout_manager()));
68 }
69 }
70
71 } // namespace ash
OLDNEW
« no previous file with comments | « ash/aura/wm_shelf_aura.h ('k') | ash/common/shelf/wm_shelf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698