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

Side by Side Diff: ui/views/corewm/window_modality_controller.cc

Issue 11570012: events: Update key-event handlers to not return EventResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-for-landing Created 8 years 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 | « ui/views/corewm/window_modality_controller.h ('k') | ui/views/view.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 "ui/views/corewm/window_modality_controller.h" 5 #include "ui/views/corewm/window_modality_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/capture_client.h" 10 #include "ui/aura/client/capture_client.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 WindowModalityController::~WindowModalityController() { 97 WindowModalityController::~WindowModalityController() {
98 aura::Env::GetInstance()->RemoveObserver(this); 98 aura::Env::GetInstance()->RemoveObserver(this);
99 for (size_t i = 0; i < windows_.size(); ++i) 99 for (size_t i = 0; i < windows_.size(); ++i)
100 windows_[i]->RemoveObserver(this); 100 windows_[i]->RemoveObserver(this);
101 } 101 }
102 102
103 //////////////////////////////////////////////////////////////////////////////// 103 ////////////////////////////////////////////////////////////////////////////////
104 // WindowModalityController, aura::EventFilter implementation: 104 // WindowModalityController, aura::EventFilter implementation:
105 105
106 ui::EventResult WindowModalityController::OnKeyEvent(ui::KeyEvent* event) { 106 void WindowModalityController::OnKeyEvent(ui::KeyEvent* event) {
107 aura::Window* target = static_cast<aura::Window*>(event->target()); 107 aura::Window* target = static_cast<aura::Window*>(event->target());
108 return GetModalTransient(target) ? ui::ER_CONSUMED : ui::ER_UNHANDLED; 108 if (GetModalTransient(target))
109 event->StopPropagation();
109 } 110 }
110 111
111 ui::EventResult WindowModalityController::OnMouseEvent(ui::MouseEvent* event) { 112 ui::EventResult WindowModalityController::OnMouseEvent(ui::MouseEvent* event) {
112 aura::Window* target = static_cast<aura::Window*>(event->target()); 113 aura::Window* target = static_cast<aura::Window*>(event->target());
113 return ProcessLocatedEvent(target, event) ? ui::ER_CONSUMED : 114 return ProcessLocatedEvent(target, event) ? ui::ER_CONSUMED :
114 ui::ER_UNHANDLED; 115 ui::ER_UNHANDLED;
115 } 116 }
116 117
117 void WindowModalityController::OnTouchEvent(ui::TouchEvent* event) { 118 void WindowModalityController::OnTouchEvent(ui::TouchEvent* event) {
118 aura::Window* target = static_cast<aura::Window*>(event->target()); 119 aura::Window* target = static_cast<aura::Window*>(event->target());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 aura::Window* modal_transient_child = GetModalTransient(target); 167 aura::Window* modal_transient_child = GetModalTransient(target);
167 if (modal_transient_child && (event->type() == ui::ET_MOUSE_PRESSED || 168 if (modal_transient_child && (event->type() == ui::ET_MOUSE_PRESSED ||
168 event->type() == ui::ET_TOUCH_PRESSED)) { 169 event->type() == ui::ET_TOUCH_PRESSED)) {
169 AnimateWindow(modal_transient_child, WINDOW_ANIMATION_TYPE_BOUNCE); 170 AnimateWindow(modal_transient_child, WINDOW_ANIMATION_TYPE_BOUNCE);
170 } 171 }
171 return !!modal_transient_child; 172 return !!modal_transient_child;
172 } 173 }
173 174
174 } // namespace corewm 175 } // namespace corewm
175 } // namespace views 176 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/window_modality_controller.h ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698