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

Unified Diff: ash/system/tray/system_tray_bubble_view.h

Issue 10514008: Add WebNotificationTray (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 6 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
« no previous file with comments | « ash/system/tray/system_tray_bubble.cc ('k') | ash/system/tray/system_tray_bubble_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/system_tray_bubble_view.h
diff --git a/ash/system/tray/system_tray_bubble_view.h b/ash/system/tray/system_tray_bubble_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..1cab19e88ffa6db1d36bbdc5cc50e86ec43d4568
--- /dev/null
+++ b/ash/system/tray/system_tray_bubble_view.h
@@ -0,0 +1,77 @@
+#ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_VIEW_H_
+#define ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_VIEW_H_
+#pragma once
+
+#include "ui/views/bubble/bubble_delegate.h"
+
+namespace views {
+class View;
+}
+
+namespace ash {
+namespace internal {
+
+// Specialized bubble view for system and web notification bubbles.
+// Mostly this handles custom anchor location and arrow and border rendering.
+class SystemTrayBubbleView : public views::BubbleDelegateView {
+ public:
+ class Host {
+ public:
+ Host() {}
+ virtual ~Host() {}
+
+ virtual void BubbleViewDestroyed() = 0;
+ virtual gfx::Rect GetAnchorRect() const = 0;
+ virtual void OnMouseEnteredView() = 0;
+ virtual void OnMouseExitedView() = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Host);
+ };
+
+ SystemTrayBubbleView(views::View* anchor,
+ views::BubbleBorder::ArrowLocation arrow_location,
+ Host* host,
+ bool can_activate);
+ virtual ~SystemTrayBubbleView();
+
+ void SetBubbleBorder(int arrow_offset);
+ void UpdateAnchor();
+ void SetMaxHeight(int height);
+
+ // Called when the host is destroyed.
+ void reset_host() { host_ = NULL; }
+
+ void set_bubble_width(int width) { bubble_width_ = width; }
+
+ protected:
+ // Overridden from views::WidgetDelegate.
+ virtual bool CanActivate() const OVERRIDE;
+
+ // Overridden from views::BubbleDelegateView.
+ virtual void Init() OVERRIDE;
+ virtual gfx::Rect GetAnchorRect() OVERRIDE;
+ virtual gfx::Rect GetBubbleBounds() OVERRIDE;
+
+ // Overridden from views::View.
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE;
+ virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
+ virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
+ virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child) OVERRIDE;
+
+ Host* host_;
+ bool can_activate_;
+ int max_height_;
+ int bubble_width_;
+
+ DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleView);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_VIEW_H_
« no previous file with comments | « ash/system/tray/system_tray_bubble.cc ('k') | ash/system/tray/system_tray_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698