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

Side by Side Diff: ash/wm/shelf_layout_manager.cc

Issue 10827145: Convert Aura to use ui::Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/partial_screenshot_view.cc ('k') | ash/wm/system_gesture_event_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/wm/shelf_layout_manager.h" 5 #include "ash/wm/shelf_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/launcher/launcher.h" 9 #include "ash/launcher/launcher.h"
10 #include "ash/screen_ash.h" 10 #include "ash/screen_ash.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_delegate.h" 12 #include "ash/shell_delegate.h"
13 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
14 #include "ash/system/status_area_widget.h" 14 #include "ash/system/status_area_widget.h"
15 #include "ash/system/tray/system_tray.h" 15 #include "ash/system/tray/system_tray.h"
16 #include "ash/system/web_notification/web_notification_tray.h" 16 #include "ash/system/web_notification/web_notification_tray.h"
17 #include "ash/wm/workspace_controller.h" 17 #include "ash/wm/workspace_controller.h"
18 #include "base/auto_reset.h" 18 #include "base/auto_reset.h"
19 #include "base/i18n/rtl.h" 19 #include "base/i18n/rtl.h"
20 #include "ui/aura/client/activation_client.h" 20 #include "ui/aura/client/activation_client.h"
21 #include "ui/aura/event.h"
22 #include "ui/aura/event_filter.h" 21 #include "ui/aura/event_filter.h"
23 #include "ui/aura/root_window.h" 22 #include "ui/aura/root_window.h"
23 #include "ui/base/event.h"
24 #include "ui/compositor/layer.h" 24 #include "ui/compositor/layer.h"
25 #include "ui/compositor/layer_animation_observer.h" 25 #include "ui/compositor/layer_animation_observer.h"
26 #include "ui/compositor/layer_animator.h" 26 #include "ui/compositor/layer_animator.h"
27 #include "ui/compositor/scoped_layer_animation_settings.h" 27 #include "ui/compositor/scoped_layer_animation_settings.h"
28 #include "ui/gfx/screen.h" 28 #include "ui/gfx/screen.h"
29 #include "ui/views/widget/widget.h" 29 #include "ui/views/widget/widget.h"
30 30
31 namespace ash { 31 namespace ash {
32 namespace internal { 32 namespace internal {
33 33
(...skipping 18 matching lines...) Expand all
52 class ShelfLayoutManager::AutoHideEventFilter : public aura::EventFilter { 52 class ShelfLayoutManager::AutoHideEventFilter : public aura::EventFilter {
53 public: 53 public:
54 explicit AutoHideEventFilter(ShelfLayoutManager* shelf); 54 explicit AutoHideEventFilter(ShelfLayoutManager* shelf);
55 virtual ~AutoHideEventFilter(); 55 virtual ~AutoHideEventFilter();
56 56
57 // Returns true if the last mouse event was a mouse drag. 57 // Returns true if the last mouse event was a mouse drag.
58 bool in_mouse_drag() const { return in_mouse_drag_; } 58 bool in_mouse_drag() const { return in_mouse_drag_; }
59 59
60 // Overridden from aura::EventFilter: 60 // Overridden from aura::EventFilter:
61 virtual bool PreHandleKeyEvent(aura::Window* target, 61 virtual bool PreHandleKeyEvent(aura::Window* target,
62 aura::KeyEvent* event) OVERRIDE; 62 ui::KeyEvent* event) OVERRIDE;
63 virtual bool PreHandleMouseEvent(aura::Window* target, 63 virtual bool PreHandleMouseEvent(aura::Window* target,
64 aura::MouseEvent* event) OVERRIDE; 64 ui::MouseEvent* event) OVERRIDE;
65 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, 65 virtual ui::TouchStatus PreHandleTouchEvent(
66 aura::TouchEvent* event) OVERRIDE; 66 aura::Window* target,
67 ui::TouchEventImpl* event) OVERRIDE;
67 virtual ui::GestureStatus PreHandleGestureEvent( 68 virtual ui::GestureStatus PreHandleGestureEvent(
68 aura::Window* target, 69 aura::Window* target,
69 aura::GestureEvent* event) OVERRIDE; 70 ui::GestureEventImpl* event) OVERRIDE;
70 71
71 private: 72 private:
72 ShelfLayoutManager* shelf_; 73 ShelfLayoutManager* shelf_;
73 bool in_mouse_drag_; 74 bool in_mouse_drag_;
74 75
75 DISALLOW_COPY_AND_ASSIGN(AutoHideEventFilter); 76 DISALLOW_COPY_AND_ASSIGN(AutoHideEventFilter);
76 }; 77 };
77 78
78 ShelfLayoutManager::AutoHideEventFilter::AutoHideEventFilter( 79 ShelfLayoutManager::AutoHideEventFilter::AutoHideEventFilter(
79 ShelfLayoutManager* shelf) 80 ShelfLayoutManager* shelf)
80 : shelf_(shelf), 81 : shelf_(shelf),
81 in_mouse_drag_(false) { 82 in_mouse_drag_(false) {
82 Shell::GetInstance()->AddEnvEventFilter(this); 83 Shell::GetInstance()->AddEnvEventFilter(this);
83 } 84 }
84 85
85 ShelfLayoutManager::AutoHideEventFilter::~AutoHideEventFilter() { 86 ShelfLayoutManager::AutoHideEventFilter::~AutoHideEventFilter() {
86 Shell::GetInstance()->RemoveEnvEventFilter(this); 87 Shell::GetInstance()->RemoveEnvEventFilter(this);
87 } 88 }
88 89
89 bool ShelfLayoutManager::AutoHideEventFilter::PreHandleKeyEvent( 90 bool ShelfLayoutManager::AutoHideEventFilter::PreHandleKeyEvent(
90 aura::Window* target, 91 aura::Window* target,
91 aura::KeyEvent* event) { 92 ui::KeyEvent* event) {
92 return false; // Always let the event propagate. 93 return false; // Always let the event propagate.
93 } 94 }
94 95
95 bool ShelfLayoutManager::AutoHideEventFilter::PreHandleMouseEvent( 96 bool ShelfLayoutManager::AutoHideEventFilter::PreHandleMouseEvent(
96 aura::Window* target, 97 aura::Window* target,
97 aura::MouseEvent* event) { 98 ui::MouseEvent* event) {
98 // This also checks IsShelfWindow() to make sure we don't attempt to hide the 99 // This also checks IsShelfWindow() to make sure we don't attempt to hide the
99 // shelf if the mouse down occurs on the shelf. 100 // shelf if the mouse down occurs on the shelf.
100 in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED || 101 in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED ||
101 (in_mouse_drag_ && event->type() != ui::ET_MOUSE_RELEASED && 102 (in_mouse_drag_ && event->type() != ui::ET_MOUSE_RELEASED &&
102 event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)) && 103 event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)) &&
103 !shelf_->IsShelfWindow(target); 104 !shelf_->IsShelfWindow(target);
104 if (event->type() == ui::ET_MOUSE_MOVED) 105 if (event->type() == ui::ET_MOUSE_MOVED)
105 shelf_->UpdateAutoHideState(); 106 shelf_->UpdateAutoHideState();
106 return false; // Not handled. 107 return false; // Not handled.
107 } 108 }
108 109
109 ui::TouchStatus ShelfLayoutManager::AutoHideEventFilter::PreHandleTouchEvent( 110 ui::TouchStatus ShelfLayoutManager::AutoHideEventFilter::PreHandleTouchEvent(
110 aura::Window* target, 111 aura::Window* target,
111 aura::TouchEvent* event) { 112 ui::TouchEventImpl* event) {
112 return ui::TOUCH_STATUS_UNKNOWN; // Not handled. 113 return ui::TOUCH_STATUS_UNKNOWN; // Not handled.
113 } 114 }
114 115
115 ui::GestureStatus 116 ui::GestureStatus
116 ShelfLayoutManager::AutoHideEventFilter::PreHandleGestureEvent( 117 ShelfLayoutManager::AutoHideEventFilter::PreHandleGestureEvent(
117 aura::Window* target, 118 aura::Window* target,
118 aura::GestureEvent* event) { 119 ui::GestureEventImpl* event) {
119 return ui::GESTURE_STATUS_UNKNOWN; // Not handled. 120 return ui::GESTURE_STATUS_UNKNOWN; // Not handled.
120 } 121 }
121 122
122 //////////////////////////////////////////////////////////////////////////////// 123 ////////////////////////////////////////////////////////////////////////////////
123 // ShelfLayoutManager, public: 124 // ShelfLayoutManager, public:
124 125
125 ShelfLayoutManager::ShelfLayoutManager(views::Widget* status) 126 ShelfLayoutManager::ShelfLayoutManager(views::Widget* status)
126 : root_window_(Shell::GetPrimaryRootWindow()), 127 : root_window_(Shell::GetPrimaryRootWindow()),
127 in_layout_(false), 128 in_layout_(false),
128 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT), 129 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT),
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { 600 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const {
600 if (state.visibility_state == VISIBLE) 601 if (state.visibility_state == VISIBLE)
601 return size; 602 return size;
602 if (state.visibility_state == AUTO_HIDE) 603 if (state.visibility_state == AUTO_HIDE)
603 return kAutoHideSize; 604 return kAutoHideSize;
604 return 0; 605 return 0;
605 } 606 }
606 607
607 } // namespace internal 608 } // namespace internal
608 } // namespace ash 609 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/partial_screenshot_view.cc ('k') | ash/wm/system_gesture_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698