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

Unified Diff: views/controls/native_control_wayland.cc

Issue 7464027: Wayland support for views. views_desktop on Wayland. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated files to latest and fixed changes for dependent CLs Created 9 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 side-by-side diff with in-line comments
Download patch
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)
sadrul 2011/08/15 14:50:23 Let's not use any TOUCH_UI defines unless we absol
+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

Powered by Google App Engine
This is Rietveld 408576698