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

Unified Diff: ui/views/widget/widget_deletion_observer.h

Issue 12529012: Context menu on views must show on mouse down for non-WIN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 8 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: ui/views/widget/widget_deletion_observer.h
diff --git a/ui/views/widget/widget_deletion_observer.h b/ui/views/widget/widget_deletion_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..3483388ccea102350bd906745860dfbee39bc36b
--- /dev/null
+++ b/ui/views/widget/widget_deletion_observer.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2013 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.
+
+#ifndef UI_VIEWS_WIDGET_WIDGET_DELETION_OBSERVER_H_
+#define UI_VIEWS_WIDGET_WIDGET_DELETION_OBSERVER_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ui/views/widget/widget_observer.h"
+
+namespace views {
+class Widget;
+
+// A simple WidgetObserver that can be probed for the life of a widget.
+class WidgetDeletionObserver : public WidgetObserver {
+ public:
+ explicit WidgetDeletionObserver(Widget* widget);
+ virtual ~WidgetDeletionObserver();
+
+ // Returns true if the widget passed in the constructor is still alive.
+ bool IsWidgetAlive() { return widget_; }
sky 2013/04/05 19:41:36 I suspect you may need widget_ != NULL for windows
varunjain 2013/04/05 21:58:42 Done.
+
+ // Overridden from WidgetObserver.
+ virtual void OnWidgetDestroying(Widget* widget) OVERRIDE;
+
+ private:
+ void CleanupWidget();
+
+ Widget* widget_;
+
+ DISALLOW_COPY_AND_ASSIGN(WidgetDeletionObserver);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_WIDGET_WIDGET_DELETION_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698