Bluetooth: don't connect to unconnectable devices or disconnect
[chromium-blink-merge.git] / ash / system / tray / tray_notification_view.h
blob84ee9ac3be8a04a020504d7944fda1c35aa9ce57
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
3 // found in the LICENSE file.
5 #ifndef ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEW_H_
6 #define ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEWS_H_
8 #include "ui/views/controls/button/image_button.h"
9 #include "ui/views/controls/slide_out_view.h"
11 namespace gfx {
12 class ImageSkia;
15 namespace views {
16 class ImageView;
19 namespace ash {
21 class SystemTrayItem;
23 namespace internal {
25 // A view for closable notification views, laid out like:
26 // -------------------
27 // | icon contents x |
28 // ----------------v--
29 // The close button will call OnClose() when clicked.
30 class TrayNotificationView : public views::SlideOutView,
31 public views::ButtonListener {
32 public:
33 // If icon_id is 0, no icon image will be set. SetIconImage can be called
34 // to later set the icon image.
35 TrayNotificationView(SystemTrayItem* owner, int icon_id);
36 virtual ~TrayNotificationView();
38 // InitView must be called once with the contents to be displayed.
39 void InitView(views::View* contents);
41 // Sets/updates the icon image.
42 void SetIconImage(const gfx::ImageSkia& image);
44 // Gets the icons image.
45 const gfx::ImageSkia& GetIconImage() const;
47 // Replaces the contents view.
48 void UpdateView(views::View* new_contents);
50 // Replaces the contents view and updates the icon image.
51 void UpdateViewAndImage(views::View* new_contents,
52 const gfx::ImageSkia& image);
54 // Overridden from ButtonListener.
55 virtual void ButtonPressed(views::Button* sender,
56 const ui::Event& event) OVERRIDE;
58 // Overridden from views::View.
59 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
61 // Overridden from ui::EventHandler.
62 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
64 protected:
65 // Called when the close button is pressed. Does nothing by default.
66 virtual void OnClose();
67 // Called when the notification is clicked on. Does nothing by default.
68 virtual void OnClickAction();
70 // Overridden from views::SlideOutView.
71 virtual void OnSlideOut() OVERRIDE;
73 SystemTrayItem* owner() { return owner_; }
75 private:
76 void HandleClose();
77 void HandleClickAction();
79 SystemTrayItem* owner_;
80 int icon_id_;
81 views::ImageView* icon_;
83 DISALLOW_COPY_AND_ASSIGN(TrayNotificationView);
86 } // namespace internal
87 } // namespace ash
89 #endif // ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEWS_H_