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

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

Issue 184903003: Window ownership -> WindowTreeHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/key_hold_detector.h" 5 #include "ash/accelerators/key_hold_detector.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 8
9 #undef RootWindow 9 #undef RootWindow
10 #undef Status 10 #undef Status
11 11
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "ui/aura/window_event_dispatcher.h" 14 #include "ui/aura/window_event_dispatcher.h"
15 #include "ui/aura/window_tracker.h" 15 #include "ui/aura/window_tracker.h"
16 #include "ui/events/event_dispatcher.h" 16 #include "ui/events/event_dispatcher.h"
17 17
18 namespace ash { 18 namespace ash {
19 namespace { 19 namespace {
20 20
21 void DispatchPressedEvent(XEvent native_event, 21 void DispatchPressedEvent(XEvent native_event,
22 scoped_ptr<aura::WindowTracker> tracker) { 22 scoped_ptr<aura::WindowTracker> tracker) {
23 // The target window may be gone. 23 // The target window may be gone.
24 if (tracker->windows().empty()) 24 if (tracker->windows().empty())
25 return; 25 return;
26 aura::Window* target = *(tracker->windows().begin()); 26 aura::Window* target = *(tracker->windows().begin());
27 ui::KeyEvent event(&native_event, false); 27 ui::KeyEvent event(&native_event, false);
28 event.set_flags(event.flags() | ui::EF_IS_SYNTHESIZED); 28 event.set_flags(event.flags() | ui::EF_IS_SYNTHESIZED);
29 ui::EventDispatchDetails result ALLOW_UNUSED = 29 ui::EventDispatchDetails result ALLOW_UNUSED =
30 target->GetDispatcher()->OnEventFromSource(&event); 30 target->GetHost()->dispatcher()->OnEventFromSource(&event);
31 } 31 }
32 32
33 void PostPressedEvent(ui::KeyEvent* event) { 33 void PostPressedEvent(ui::KeyEvent* event) {
34 // Modify RELEASED event to PRESSED event. 34 // Modify RELEASED event to PRESSED event.
35 XEvent xkey = *(event->native_event()); 35 XEvent xkey = *(event->native_event());
36 xkey.xkey.type = KeyPress; 36 xkey.xkey.type = KeyPress;
37 xkey.xkey.state |= ShiftMask; 37 xkey.xkey.state |= ShiftMask;
38 scoped_ptr<aura::WindowTracker> tracker(new aura::WindowTracker); 38 scoped_ptr<aura::WindowTracker> tracker(new aura::WindowTracker);
39 tracker->Add(static_cast<aura::Window*>(event->target())); 39 tracker->Add(static_cast<aura::Window*>(event->target()));
40 40
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 delegate_->OnKeyUnhold(event); 89 delegate_->OnKeyUnhold(event);
90 event->StopPropagation(); 90 event->StopPropagation();
91 break; 91 break;
92 } 92 }
93 } 93 }
94 state_ = INITIAL; 94 state_ = INITIAL;
95 } 95 }
96 } 96 }
97 97
98 } // namespace ash 98 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller_unittest.cc ('k') | ash/accelerators/nested_dispatcher_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698