Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_MESSAGE_CENTER_WIDGET_DELEGATE_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_MESSAGE_CENTER_WIDGET_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/weak_ptr.h" | |
| 11 #include "chrome/browser/ui/views/message_center/web_notification_tray.h" | |
| 12 #include "ui/base/animation/animation_delegate.h" | |
| 13 #include "ui/base/animation/slide_animation.h" | |
| 14 #include "ui/gfx/point.h" | |
| 15 #include "ui/gfx/rect.h" | |
| 16 #include "ui/message_center/message_center.h" | |
| 17 #include "ui/message_center/message_center_tray.h" | |
| 18 #include "ui/message_center/message_center_tray_delegate.h" | |
| 19 #include "ui/message_center/views/message_center_view.h" | |
| 20 #include "ui/views/widget/widget_delegate.h" | |
| 21 #include "ui/views/widget/widget_observer.h" | |
| 22 | |
| 23 namespace ui { | |
| 24 class SlideAnimation; | |
| 25 class AnimationDelegate; | |
| 26 } | |
| 27 | |
| 28 namespace message_center { | |
| 29 | |
| 30 enum Alignment { | |
| 31 ALIGNMENT_TOP = 1 << 0, | |
| 32 ALIGNMENT_LEFT = 1 << 1, | |
| 33 ALIGNMENT_BOTTOM = 1 << 2, | |
| 34 ALIGNMENT_RIGHT = 1 << 3, | |
| 35 ALIGNMENT_NONE = 1 << 4, | |
| 36 }; | |
| 37 | |
| 38 struct PositionInfo { | |
| 39 int max_height; | |
| 40 | |
| 41 // Alignment of the message center relative to the center of the screen. | |
| 42 Alignment message_center_alignment; | |
| 43 | |
| 44 // Alignment of the systray and taskbar relative to the center of the screen. | |
| 45 Alignment systray_alignment; | |
| 46 | |
| 47 // Point relative to which message center is positioned. | |
| 48 gfx::Point inital_anchor_point; | |
| 49 }; | |
| 50 | |
| 51 class WebNotificationTray; | |
| 52 class MessageCenterFrameView; | |
| 53 | |
| 54 // MessageCenterWidgetDelegate is the message center's client view. It also | |
| 55 // creates the message center widget and sets the notifications. | |
| 56 // | |
| 57 //////////////////////////////////////////////////////////////////////////////// | |
| 58 class MessageCenterWidgetDelegate : public views::WidgetDelegate, | |
|
dewittj
2013/07/15 18:38:58
Since this is a WidgetDelegate and a View, I wonde
sidharthms
2013/07/15 23:16:37
Done.
| |
| 59 public message_center::MessageCenterView, | |
| 60 public views::WidgetObserver { | |
| 61 public: | |
| 62 MessageCenterWidgetDelegate(WebNotificationTray* tray, | |
| 63 MessageCenterTray* mc_tray, | |
| 64 bool initially_settings_visible, | |
| 65 const PositionInfo& pos_info); | |
| 66 virtual ~MessageCenterWidgetDelegate(); | |
| 67 | |
| 68 // WidgetDelegate overrides: | |
| 69 virtual View* GetContentsView() OVERRIDE; | |
| 70 virtual views::NonClientFrameView* CreateNonClientFrameView( | |
| 71 views::Widget* widget) OVERRIDE; | |
| 72 virtual views::Widget* GetWidget() OVERRIDE; | |
| 73 virtual const views::Widget* GetWidget() const OVERRIDE; | |
| 74 | |
| 75 // WidgetObserver overrides: | |
| 76 virtual void OnWidgetActivationChanged(views::Widget* widget, bool active) | |
| 77 OVERRIDE; | |
| 78 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | |
| 79 | |
| 80 // View overrides: | |
| 81 virtual void PreferredSizeChanged() OVERRIDE; | |
| 82 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 83 virtual gfx::Size GetMaximumSize() OVERRIDE; | |
| 84 virtual int GetHeightForWidth(int width) OVERRIDE; | |
| 85 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | |
| 86 | |
| 87 protected: | |
|
dewittj
2013/07/15 18:38:58
Remove this empty section.
sidharthms
2013/07/15 23:16:37
Done.
| |
| 88 | |
| 89 private: | |
| 90 void InitWidget(); | |
| 91 gfx::Point GetCorrectedAnchor(gfx::Size calculated_size); | |
| 92 gfx::Rect GetBubbleBounds(); | |
|
dewittj
2013/07/15 18:38:58
I know they're not public but we should have some
sidharthms
2013/07/15 23:16:37
Done.
| |
| 93 | |
| 94 // Preferred width of message center. | |
| 95 int preferred_width_; | |
| 96 | |
| 97 PositionInfo pos_info_; | |
| 98 | |
| 99 WebNotificationTray* tray_; | |
| 100 }; | |
| 101 | |
| 102 } // namespace message_center | |
| 103 | |
| 104 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_MESSAGE_CENTER_WIDGET_DELEGATE _H_ | |
| OLD | NEW |