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

Side by Side Diff: ash/accelerators/accelerator_dispatcher_linux.cc

Issue 9348113: Fix two crash and potential leak&crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert unnecessary file, updated comment Created 8 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 | Annotate | Revision Log
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/accelerators/accelerator_dispatcher.h" 5 #include "ash/accelerators/accelerator_dispatcher.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 8
9 // Xlib defines RootWindow 9 // Xlib defines RootWindow
10 #ifdef RootWindow 10 #ifdef RootWindow
(...skipping 10 matching lines...) Expand all
21 21
22 namespace { 22 namespace {
23 23
24 const int kModifierMask = (ui::EF_SHIFT_DOWN | 24 const int kModifierMask = (ui::EF_SHIFT_DOWN |
25 ui::EF_CONTROL_DOWN | 25 ui::EF_CONTROL_DOWN |
26 ui::EF_ALT_DOWN); 26 ui::EF_ALT_DOWN);
27 } // namespace 27 } // namespace
28 28
29 base::MessagePumpDispatcher::DispatchStatus AcceleratorDispatcher::Dispatch( 29 base::MessagePumpDispatcher::DispatchStatus AcceleratorDispatcher::Dispatch(
30 XEvent* xev) { 30 XEvent* xev) {
31 if (!associated_window_)
32 return EVENT_QUIT;
31 if (!associated_window_->CanReceiveEvents()) 33 if (!associated_window_->CanReceiveEvents())
32 return aura::RootWindow::GetInstance()->GetDispatcher()->Dispatch(xev); 34 return aura::RootWindow::GetInstance()->GetDispatcher()->Dispatch(xev);
33 35
34 if (xev->type == KeyPress) { 36 if (xev->type == KeyPress) {
35 ash::AcceleratorController* accelerator_controller = 37 ash::AcceleratorController* accelerator_controller =
36 ash::Shell::GetInstance()->accelerator_controller(); 38 ash::Shell::GetInstance()->accelerator_controller();
37 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(xev), 39 ui::Accelerator accelerator(ui::KeyboardCodeFromNative(xev),
38 ui::EventFlagsFromNative(xev) & kModifierMask); 40 ui::EventFlagsFromNative(xev) & kModifierMask);
39 if (accelerator_controller && accelerator_controller->Process(accelerator)) 41 if (accelerator_controller && accelerator_controller->Process(accelerator))
40 return EVENT_PROCESSED; 42 return EVENT_PROCESSED;
41 } 43 }
42 return nested_dispatcher_->Dispatch(xev); 44 return nested_dispatcher_->Dispatch(xev);
43 } 45 }
44 46
45 } // namespace ash 47 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_dispatcher.cc ('k') | ash/accelerators/accelerator_dispatcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698