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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 1703683003: The key event should be stopped propagation when it's been processed as an accelerator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CQ green. Created 4 years, 10 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 | « ui/views/mus/native_widget_mus.cc ('k') | ui/views/widget/native_widget_aura.cc » ('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/widget/desktop_aura/desktop_native_widget_aura.h" 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 public: 213 public:
214 explicit FocusManagerEventHandler( 214 explicit FocusManagerEventHandler(
215 DesktopNativeWidgetAura* desktop_native_widget_aura) 215 DesktopNativeWidgetAura* desktop_native_widget_aura)
216 : desktop_native_widget_aura_(desktop_native_widget_aura) {} 216 : desktop_native_widget_aura_(desktop_native_widget_aura) {}
217 217
218 // Implementation of ui::EventHandler: 218 // Implementation of ui::EventHandler:
219 void OnKeyEvent(ui::KeyEvent* event) override { 219 void OnKeyEvent(ui::KeyEvent* event) override {
220 Widget* widget = desktop_native_widget_aura_->GetWidget(); 220 Widget* widget = desktop_native_widget_aura_->GetWidget();
221 if (widget && widget->GetFocusManager()->GetFocusedView() && 221 if (widget && widget->GetFocusManager()->GetFocusedView() &&
222 !widget->GetFocusManager()->OnKeyEvent(*event)) { 222 !widget->GetFocusManager()->OnKeyEvent(*event)) {
223 event->SetHandled(); 223 event->StopPropagation();
224 } 224 }
225 } 225 }
226 226
227 private: 227 private:
228 DesktopNativeWidgetAura* desktop_native_widget_aura_; 228 DesktopNativeWidgetAura* desktop_native_widget_aura_;
229 229
230 DISALLOW_COPY_AND_ASSIGN(FocusManagerEventHandler); 230 DISALLOW_COPY_AND_ASSIGN(FocusManagerEventHandler);
231 }; 231 };
232 232
233 class RootWindowDestructionObserver : public aura::WindowObserver { 233 class RootWindowDestructionObserver : public aura::WindowObserver {
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 // If such object is not attached, character events might be sent (e.g. on 1024 // If such object is not attached, character events might be sent (e.g. on
1025 // Windows). In this case, we just skip these. 1025 // Windows). In this case, we just skip these.
1026 return; 1026 return;
1027 } 1027 }
1028 // Renderer may send a key event back to us if the key event wasn't handled, 1028 // Renderer may send a key event back to us if the key event wasn't handled,
1029 // and the window may be invisible by that time. 1029 // and the window may be invisible by that time.
1030 if (!content_window_->IsVisible()) 1030 if (!content_window_->IsVisible())
1031 return; 1031 return;
1032 1032
1033 native_widget_delegate_->OnKeyEvent(event); 1033 native_widget_delegate_->OnKeyEvent(event);
1034 if (event->handled())
1035 return;
1036
1037 if (GetWidget()->HasFocusManager() &&
1038 !GetWidget()->GetFocusManager()->OnKeyEvent(*event))
1039 event->SetHandled();
1040 } 1034 }
1041 1035
1042 void DesktopNativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { 1036 void DesktopNativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) {
1043 DCHECK(content_window_->IsVisible()); 1037 DCHECK(content_window_->IsVisible());
1044 if (tooltip_manager_.get()) 1038 if (tooltip_manager_.get())
1045 tooltip_manager_->UpdateTooltip(); 1039 tooltip_manager_->UpdateTooltip();
1046 TooltipManagerAura::UpdateTooltipManagerForCapture(GetWidget()); 1040 TooltipManagerAura::UpdateTooltipManagerForCapture(GetWidget());
1047 native_widget_delegate_->OnMouseEvent(event); 1041 native_widget_delegate_->OnMouseEvent(event);
1048 // WARNING: we may have been deleted. 1042 // WARNING: we may have been deleted.
1049 } 1043 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 if (cursor_reference_count_ == 0) { 1180 if (cursor_reference_count_ == 0) {
1187 // We are the last DesktopNativeWidgetAura instance, and we are responsible 1181 // We are the last DesktopNativeWidgetAura instance, and we are responsible
1188 // for cleaning up |cursor_manager_|. 1182 // for cleaning up |cursor_manager_|.
1189 delete cursor_manager_; 1183 delete cursor_manager_;
1190 native_cursor_manager_ = NULL; 1184 native_cursor_manager_ = NULL;
1191 cursor_manager_ = NULL; 1185 cursor_manager_ = NULL;
1192 } 1186 }
1193 } 1187 }
1194 1188
1195 } // namespace views 1189 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/native_widget_mus.cc ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698