Index: views/controls/native_control_wayland.cc |
diff --git a/views/controls/native_control_wayland.cc b/views/controls/native_control_wayland.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2689922de4c3c21d291504bf18700feeaf821561 |
--- /dev/null |
+++ b/views/controls/native_control_wayland.cc |
@@ -0,0 +1,103 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "views/controls/native_control_wayland.h" |
+ |
+#include "base/logging.h" |
+#include "ui/base/accessibility/accessibility_types.h" |
+#include "ui/wayland/wayland_widget.h" |
+#include "views/focus/focus_manager.h" |
+#include "views/widget/widget.h" |
+ |
+ |
+namespace views { |
+ |
+#if defined(TOUCH_UI) |
+void NativeControlWayland::FakeNativeMouseEvent(const MouseEvent& mouseev) { |
+ NOTIMPLEMENTED(); |
+} |
+#endif // defined(TOUCH_UI) |
+ |
+NativeControlWayland::NativeControlWayland() { |
+} |
+ |
+NativeControlWayland::~NativeControlWayland() { |
+} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+// NativeControlWayland, View overrides: |
+ |
+void NativeControlWayland::OnEnabledChanged() { |
+ View::OnEnabledChanged(); |
+ NOTIMPLEMENTED(); |
+} |
+ |
+void NativeControlWayland::ViewHierarchyChanged(bool is_add, View* parent, |
+ View* child) { |
+ // Call the base class to hide the view if we're being removed. |
+ NativeViewHost::ViewHierarchyChanged(is_add, parent, child); |
+ |
+ if (!is_add && child == this && native_view()) { |
+ Detach(); |
+ } else if (is_add && GetWidget() && !native_view()) { |
+ // Create the widget when we're added to a valid Widget. Many |
+ // controls need a parent widget to function properly. |
+ CreateNativeControl(); |
+ } |
+} |
+ |
+void NativeControlWayland::VisibilityChanged(View* starting_from, |
+ bool is_visible) { |
+ if (!is_visible) { |
+ if (native_view()) { |
+ // We destroy the child widget when we become invisible because of the |
+ // performance cost of maintaining widgets that aren't currently needed. |
+ Detach(); |
+ // Make sure that Detach destroyed the widget. |
+ DCHECK(!native_view()); |
+ } |
+ } else if (!native_view()) { |
+ if (GetWidget()) |
+ CreateNativeControl(); |
+ } else { |
+ // The view becomes visible after native control is created. |
+ // Layout now. |
+ Layout(); |
+ } |
+} |
+ |
+void NativeControlWayland::OnFocus() { |
+ DCHECK(native_view()); |
+ NOTIMPLEMENTED(); |
+} |
+ |
+#if defined(TOUCH_UI) |
+bool NativeControlWayland::OnMousePressed(const MouseEvent& mouseev) { |
+ FakeNativeMouseEvent(mouseev); |
+ return true; |
+} |
+ |
+void NativeControlWayland::OnMouseReleased(const MouseEvent& mouseev) { |
+ FakeNativeMouseEvent(mouseev); |
+} |
+ |
+void NativeControlWayland::OnMouseMoved(const MouseEvent& mouseev) { |
+ FakeNativeMouseEvent(mouseev); |
+} |
+ |
+void NativeControlWayland::OnMouseEntered(const MouseEvent& mouseev) { |
+ FakeNativeMouseEvent(mouseev); |
+} |
+ |
+void NativeControlWayland::OnMouseExited(const MouseEvent& mouseev) { |
+ FakeNativeMouseEvent(mouseev); |
+} |
+#endif // defined(TOUCH_UI) |
+ |
+void NativeControlWayland::NativeControlCreated( |
+ ui::WaylandWidget* native_control) { |
+ NOTIMPLEMENTED(); |
+} |
+ |
+} // namespace views |