summaryrefslogtreecommitdiffstats
path: root/ash/system
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-09 19:03:48 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-09 19:03:48 +0000
commitd538af28f7d25e5e82692599327816123439654b (patch)
tree66c6cd85f6b36e0b3e9486e73d88f34505399a21 /ash/system
parent0f5db3e2de1d01aa7a130b97850f16b8b400f492 (diff)
downloadchromium_src-d538af28f7d25e5e82692599327816123439654b.zip
chromium_src-d538af28f7d25e5e82692599327816123439654b.tar.gz
chromium_src-d538af28f7d25e5e82692599327816123439654b.tar.bz2
views: Add a new view that can be slided out using gestures.
Refactor the code for sliding out a View from the message-center into views so that it can be used more generally. Use it for both system and message-center notifications. BUG=158075 Review URL: https://codereview.chromium.org/11361178 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166944 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system')
-rw-r--r--ash/system/tray/tray_notification_view.cc6
-rw-r--r--ash/system/tray/tray_notification_view.h7
2 files changed, 11 insertions, 2 deletions
diff --git a/ash/system/tray/tray_notification_view.cc b/ash/system/tray/tray_notification_view.cc
index 85657c5..f2c8482 100644
--- a/ash/system/tray/tray_notification_view.cc
+++ b/ash/system/tray/tray_notification_view.cc
@@ -125,6 +125,8 @@ bool TrayNotificationView::OnMousePressed(const ui::MouseEvent& event) {
}
ui::EventResult TrayNotificationView::OnGestureEvent(ui::GestureEvent* event) {
+ if (SlideOutView::OnGestureEvent(event) == ui::ER_CONSUMED)
+ return ui::ER_CONSUMED;
if (event->type() != ui::ET_GESTURE_TAP)
return ui::ER_UNHANDLED;
HandleClickAction();
@@ -137,6 +139,10 @@ void TrayNotificationView::OnClose() {
void TrayNotificationView::OnClickAction() {
}
+void TrayNotificationView::OnSlideOut() {
+ tray_->HideNotificationView();
+}
+
void TrayNotificationView::HandleClose() {
OnClose();
tray_->HideNotificationView();
diff --git a/ash/system/tray/tray_notification_view.h b/ash/system/tray/tray_notification_view.h
index ee604fc..259ca8a 100644
--- a/ash/system/tray/tray_notification_view.h
+++ b/ash/system/tray/tray_notification_view.h
@@ -6,7 +6,7 @@
#define ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEWS_H_
#include "ui/views/controls/button/image_button.h"
-#include "ui/views/view.h"
+#include "ui/views/controls/slide_out_view.h"
namespace gfx {
class ImageSkia;
@@ -27,7 +27,7 @@ namespace internal {
// | icon contents x |
// ----------------v--
// The close button will call OnClose() when clicked.
-class TrayNotificationView : public views::View,
+class TrayNotificationView : public views::SlideOutView,
public views::ButtonListener {
public:
// If icon_id is 0, no icon image will be set. SetIconImage can be called
@@ -67,6 +67,9 @@ class TrayNotificationView : public views::View,
// Called when the notification is clicked on. Does nothing by default.
virtual void OnClickAction();
+ // Overridden from views::SlideOutView.
+ virtual void OnSlideOut() OVERRIDE;
+
SystemTrayItem* tray() { return tray_; }
private: