cc: Add more eviction categories to picture layer impl.
[chromium-blink-merge.git] / ui / message_center / views / message_bubble_base.h
blob27d2e51911513f36a8e4a93f66680ee167073753
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 UI_MESSAGE_CENTER_VIEWS_MESSAGE_BUBBLE_BASE_H_
6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_BUBBLE_BASE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/message_center/message_center.h"
10 #include "ui/message_center/message_center_export.h"
11 #include "ui/views/bubble/tray_bubble_view.h"
13 namespace message_center {
14 class MessageCenterTray;
16 class MESSAGE_CENTER_EXPORT MessageBubbleBase {
17 public:
18 MessageBubbleBase(MessageCenter* message_center, MessageCenterTray* tray);
20 virtual ~MessageBubbleBase();
22 // Gets called when the bubble view associated with this bubble is
23 // destroyed. Clears |bubble_view_| and calls OnBubbleViewDestroyed.
24 void BubbleViewDestroyed();
26 // Sets/Gets the maximum height of the bubble view. Setting 0 changes the
27 // bubble to the default size. max_height() will return the default size
28 // if SetMaxHeight() has not been called yet.
29 void SetMaxHeight(int height);
30 int max_height() const { return max_height_; }
32 // Gets the init params for the implementation.
33 virtual views::TrayBubbleView::InitParams GetInitParams(
34 views::TrayBubbleView::AnchorAlignment anchor_alignment) = 0;
36 // Called after the bubble view has been constructed. Creates and initializes
37 // the bubble contents.
38 virtual void InitializeContents(views::TrayBubbleView* bubble_view) = 0;
40 // Called from BubbleViewDestroyed for implementation specific details.
41 virtual void OnBubbleViewDestroyed() = 0;
43 // Updates the bubble; implementation dependent.
44 virtual void UpdateBubbleView() = 0;
46 // Called when the mouse enters/exists the view.
47 virtual void OnMouseEnteredView() = 0;
48 virtual void OnMouseExitedView() = 0;
50 // Schedules bubble for layout after all notifications have been
51 // added and icons have had a chance to load.
52 void ScheduleUpdate();
54 bool IsVisible() const;
56 views::TrayBubbleView* bubble_view() const { return bubble_view_; }
58 static const SkColor kBackgroundColor;
60 protected:
61 views::TrayBubbleView::InitParams GetDefaultInitParams(
62 views::TrayBubbleView::AnchorAlignment anchor_alignment);
63 MessageCenter* message_center() { return message_center_; }
64 MessageCenterTray* tray() { return tray_; }
65 void set_bubble_view(views::TrayBubbleView* bubble_view) {
66 bubble_view_ = bubble_view;
69 private:
70 MessageCenter* message_center_;
71 MessageCenterTray* tray_;
72 views::TrayBubbleView* bubble_view_;
73 base::WeakPtrFactory<MessageBubbleBase> weak_ptr_factory_;
74 int max_height_;
76 DISALLOW_COPY_AND_ASSIGN(MessageBubbleBase);
79 } // namespace message_center
81 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_BUBBLE_BASE_H_