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

Side by Side Diff: ui/views/widget/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: Do StopPropagation() in DNWA/NWA. 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/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | no next file » | 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/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "third_party/skia/include/core/SkRegion.h" 10 #include "third_party/skia/include/core/SkRegion.h"
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 868
869 void NativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) { 869 void NativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) {
870 DCHECK(window_); 870 DCHECK(window_);
871 // Renderer may send a key event back to us if the key event wasn't handled, 871 // Renderer may send a key event back to us if the key event wasn't handled,
872 // and the window may be invisible by that time. 872 // and the window may be invisible by that time.
873 if (!window_->IsVisible()) 873 if (!window_->IsVisible())
874 return; 874 return;
875 875
876 FocusManager* focus_manager = GetWidget()->GetFocusManager(); 876 FocusManager* focus_manager = GetWidget()->GetFocusManager();
877 delegate_->OnKeyEvent(event); 877 delegate_->OnKeyEvent(event);
878 if (!event->handled() && focus_manager) 878 if (!event->handled() && focus_manager) {
879 focus_manager->OnKeyEvent(*event); 879 if (!focus_manager->OnKeyEvent(*event))
880 event->StopPropagation();
881 }
sadrul 2016/02/17 21:17:55 Should this code just move into Widget::OnKeyEvent
Shu Chen 2016/02/18 00:29:54 Done. Good idea.
880 event->SetHandled(); 882 event->SetHandled();
881 } 883 }
882 884
883 void NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { 885 void NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) {
884 DCHECK(window_); 886 DCHECK(window_);
885 DCHECK(window_->IsVisible()); 887 DCHECK(window_->IsVisible());
886 if (event->type() == ui::ET_MOUSEWHEEL) { 888 if (event->type() == ui::ET_MOUSEWHEEL) {
887 delegate_->OnMouseEvent(event); 889 delegate_->OnMouseEvent(event);
888 if (event->handled()) 890 if (event->handled())
889 return; 891 return;
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 1172 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
1171 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 1173 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
1172 return gfx::FontList(gfx::Font(caption_font.get())); 1174 return gfx::FontList(gfx::Font(caption_font.get()));
1173 #else 1175 #else
1174 return gfx::FontList(); 1176 return gfx::FontList();
1175 #endif 1177 #endif
1176 } 1178 }
1177 1179
1178 } // namespace internal 1180 } // namespace internal
1179 } // namespace views 1181 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698