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

Side by Side Diff: ui/aura/root_window_host_x11.cc

Issue 13355002: Implement chrome.brailleDisplayPrivate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
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/aura/root_window_host_x11.h" 5 #include "ui/aura/root_window_host_x11.h"
6 6
7 #include <strings.h> 7 #include <strings.h>
8 #include <X11/cursorfont.h> 8 #include <X11/cursorfont.h>
9 #include <X11/extensions/Xfixes.h> 9 #include <X11/extensions/Xfixes.h>
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
11 #include <X11/extensions/Xrandr.h> 11 #include <X11/extensions/Xrandr.h>
12 #include <X11/Xatom.h> 12 #include <X11/Xatom.h>
13 #include <X11/Xcursor/Xcursor.h> 13 #include <X11/Xcursor/Xcursor.h>
14 #include <X11/Xlib.h> 14 #include <X11/Xlib.h>
15 15
16 #include <algorithm> 16 #include <algorithm>
17 #include <limits> 17 #include <limits>
18 #include <string> 18 #include <string>
19 19
20 #include "base/command_line.h" 20 #include "base/command_line.h"
21 #include "base/debug/trace_event.h" 21 #include "base/debug/trace_event.h"
22 #include "base/message_loop/message_loop.h" 22 #include "base/message_loop/message_loop.h"
23 #include "base/message_loop/message_pump_aurax11.h" 23 #include "base/message_loop/message_pump_aurax11.h"
24 #include "base/stl_util.h" 24 #include "base/stl_util.h"
25 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
26 #include "base/strings/string_util.h" 26 #include "base/strings/string_util.h"
27 #include "base/strings/stringprintf.h" 27 #include "base/strings/stringprintf.h"
28 // TODO(plundblad): Need something better than this dependency.
29 #include "chrome/browser/extensions/api/braille_private/braille_controller.h"
28 #include "third_party/skia/include/core/SkBitmap.h" 30 #include "third_party/skia/include/core/SkBitmap.h"
29 #include "third_party/skia/include/core/SkCanvas.h" 31 #include "third_party/skia/include/core/SkCanvas.h"
30 #include "third_party/skia/include/core/SkPostConfig.h" 32 #include "third_party/skia/include/core/SkPostConfig.h"
31 #include "ui/aura/client/capture_client.h" 33 #include "ui/aura/client/capture_client.h"
32 #include "ui/aura/client/cursor_client.h" 34 #include "ui/aura/client/cursor_client.h"
33 #include "ui/aura/client/screen_position_client.h" 35 #include "ui/aura/client/screen_position_client.h"
34 #include "ui/aura/client/user_action_client.h" 36 #include "ui/aura/client/user_action_client.h"
35 #include "ui/aura/env.h" 37 #include "ui/aura/env.h"
36 #include "ui/aura/root_window.h" 38 #include "ui/aura/root_window.h"
37 #include "ui/base/cursor/cursor.h" 39 #include "ui/base/cursor/cursor.h"
38 #include "ui/base/events/event.h" 40 #include "ui/base/events/event.h"
39 #include "ui/base/events/event_utils.h" 41 #include "ui/base/events/event_utils.h"
40 #include "ui/base/keycodes/keyboard_codes.h" 42 #include "ui/base/keycodes/keyboard_codes.h"
41 #include "ui/base/touch/touch_factory_x11.h" 43 #include "ui/base/touch/touch_factory_x11.h"
42 #include "ui/base/ui_base_switches.h" 44 #include "ui/base/ui_base_switches.h"
43 #include "ui/base/view_prop.h" 45 #include "ui/base/view_prop.h"
44 #include "ui/base/x/device_list_cache_x.h" 46 #include "ui/base/x/device_list_cache_x.h"
45 #include "ui/base/x/x11_util.h" 47 #include "ui/base/x/x11_util.h"
46 #include "ui/compositor/dip_util.h" 48 #include "ui/compositor/dip_util.h"
47 #include "ui/compositor/layer.h" 49 #include "ui/compositor/layer.h"
48 #include "ui/gfx/codec/png_codec.h" 50 #include "ui/gfx/codec/png_codec.h"
49 #include "ui/gfx/screen.h" 51 #include "ui/gfx/screen.h"
50 52
53
51 #if defined(OS_CHROMEOS) 54 #if defined(OS_CHROMEOS)
52 #include "base/chromeos/chromeos_version.h" 55 #include "base/chromeos/chromeos_version.h"
53 #endif 56 #endif
54 57
55 using std::max; 58 using std::max;
56 using std::min; 59 using std::min;
57 60
58 namespace aura { 61 namespace aura {
59 62
60 namespace { 63 namespace {
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 xwindow_, 435 xwindow_,
433 atom_cache_.GetAtom("_NET_WM_PID"), 436 atom_cache_.GetAtom("_NET_WM_PID"),
434 XA_CARDINAL, 437 XA_CARDINAL,
435 32, 438 32,
436 PropModeReplace, 439 PropModeReplace,
437 reinterpret_cast<unsigned char*>(&pid), 1); 440 reinterpret_cast<unsigned char*>(&pid), 1);
438 441
439 XRRSelectInput(xdisplay_, x_root_window_, 442 XRRSelectInput(xdisplay_, x_root_window_,
440 RRScreenChangeNotifyMask | RROutputChangeNotifyMask); 443 RRScreenChangeNotifyMask | RROutputChangeNotifyMask);
441 Env::GetInstance()->AddObserver(this); 444 Env::GetInstance()->AddObserver(this);
445 // TODO: This is not needed on chromeos, but it is currently on
446 // Linux. Need a better way to handle this.
447 extensions::api::braille_private::BrailleController::AddWindow(xwindow_);
442 } 448 }
443 449
444 RootWindowHostX11::~RootWindowHostX11() { 450 RootWindowHostX11::~RootWindowHostX11() {
445 Env::GetInstance()->RemoveObserver(this); 451 Env::GetInstance()->RemoveObserver(this);
446 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow(this); 452 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow(this);
447 base::MessagePumpAuraX11::Current()->RemoveDispatcherForWindow(xwindow_); 453 base::MessagePumpAuraX11::Current()->RemoveDispatcherForWindow(xwindow_);
448 454
449 UnConfineCursor(); 455 UnConfineCursor();
450 456
451 XDestroyWindow(xdisplay_, xwindow_); 457 XDestroyWindow(xdisplay_, xwindow_);
458 extensions::api::braille_private::BrailleController::RemoveWindow(xwindow_);
452 } 459 }
453 460
454 bool RootWindowHostX11::Dispatch(const base::NativeEvent& event) { 461 bool RootWindowHostX11::Dispatch(const base::NativeEvent& event) {
455 XEvent* xev = event; 462 XEvent* xev = event;
456 463
457 if (FindEventTarget(event) == x_root_window_) 464 if (FindEventTarget(event) == x_root_window_)
458 return DispatchEventForRootWindow(event); 465 return DispatchEventForRootWindow(event);
459 466
460 switch (xev->type) { 467 switch (xev->type) {
461 case EnterNotify: { 468 case EnterNotify: {
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 } 1143 }
1137 1144
1138 namespace test { 1145 namespace test {
1139 1146
1140 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { 1147 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) {
1141 default_override_redirect = override_redirect; 1148 default_override_redirect = override_redirect;
1142 } 1149 }
1143 1150
1144 } // namespace test 1151 } // namespace test
1145 } // namespace aura 1152 } // namespace aura
OLDNEW
« chrome/common/extensions/api/braille_private.idl ('K') | « ui/aura/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698