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

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

Issue 10808066: Fix position of web notification bubble and arrow (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 5 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: ash/system/tray/tray_bubble_view.h
diff --git a/ash/system/tray/tray_bubble_view.h b/ash/system/tray/tray_bubble_view.h
index 61dfd8ecffd722e196a48e88662507bc2a872d6a..521c8b47f8b39763b4d833db86b25e60f374830f 100644
--- a/ash/system/tray/tray_bubble_view.h
+++ b/ash/system/tray/tray_bubble_view.h
@@ -5,6 +5,7 @@
#ifndef ASH_SYSTEM_TRAY_TRAY_BUBBLE_VIEW_H_
#define ASH_SYSTEM_TRAY_TRAY_BUBBLE_VIEW_H_
+#include "ash/wm/shelf_types.h"
#include "ui/aura/event_filter.h"
#include "ui/views/bubble/bubble_delegate.h"
@@ -24,15 +25,21 @@ namespace internal {
// Mostly this handles custom anchor location and arrow and border rendering.
class TrayBubbleView : public views::BubbleDelegateView {
public:
+ enum AnchorType {
+ ANCHOR_TYPE_TRAY,
+ ANCHOR_TYPE_BUBBLE
+ };
+
class Host : public aura::EventFilter {
public:
Host();
virtual ~Host();
- void InitializeHost(views::Widget* widget, views::View* tray_view);
+ void PostCreateBubble(views::Widget* widget,
+ TrayBubbleView* bubble_view,
+ views::View* tray_view);
virtual void BubbleViewDestroyed() = 0;
- virtual gfx::Rect GetAnchorRect() const = 0;
virtual void OnMouseEnteredView() = 0;
virtual void OnMouseExitedView() = 0;
virtual void OnClickedOutsideView() = 0;
@@ -58,15 +65,24 @@ class TrayBubbleView : public views::BubbleDelegateView {
DISALLOW_COPY_AND_ASSIGN(Host);
};
- TrayBubbleView(views::View* anchor,
- views::BubbleBorder::ArrowLocation arrow_location,
- Host* host,
- bool can_activate,
- int bubble_width);
- virtual ~TrayBubbleView();
+ struct InitParams {
+ static const int kArrowDefaultOffset;
+
+ InitParams(TrayBubbleView::AnchorType anchor_type,
+ ShelfAlignment shelf_alignment);
+ TrayBubbleView::AnchorType anchor_type;
+ ShelfAlignment shelf_alignment;
+ int bubble_width;
+ int max_height;
+ bool can_activate;
+ int arrow_offset;
+ };
- // Creates a bubble border with the specified arrow offset.
- void SetBubbleBorder(int arrow_offset);
+ static TrayBubbleView* Create(views::View* anchor,
+ Host* host,
+ const InitParams& init_params);
+
+ virtual ~TrayBubbleView();
// Called whenever the bubble anchor location may have moved.
void UpdateAnchor();
@@ -79,6 +95,8 @@ class TrayBubbleView : public views::BubbleDelegateView {
// Overridden from views::WidgetDelegate.
virtual bool CanActivate() const OVERRIDE;
+ virtual views::NonClientFrameView* CreateNonClientFrameView(
+ views::Widget* widget) OVERRIDE;
// Overridden from views::BubbleDelegateView.
virtual gfx::Rect GetAnchorRect() OVERRIDE;
@@ -90,6 +108,11 @@ class TrayBubbleView : public views::BubbleDelegateView {
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
protected:
+ TrayBubbleView(const InitParams& init_params,
+ views::BubbleBorder::ArrowLocation arrow_location,
+ views::View* anchor,
+ Host* host);
+
// Overridden from views::BubbleDelegateView.
virtual void Init() OVERRIDE;
virtual gfx::Rect GetBubbleBounds() OVERRIDE;
@@ -101,10 +124,8 @@ class TrayBubbleView : public views::BubbleDelegateView {
views::View* child) OVERRIDE;
private:
+ InitParams params_;
Host* host_;
- bool can_activate_;
- int max_height_;
- int bubble_width_;
DISALLOW_COPY_AND_ASSIGN(TrayBubbleView);
};

Powered by Google App Engine
This is Rietveld 408576698