Chromium Code Reviews| Index: chrome/browser/ui/views/message_center/message_center_widget_delegate.h |
| diff --git a/chrome/browser/ui/views/message_center/message_center_widget_delegate.h b/chrome/browser/ui/views/message_center/message_center_widget_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1bb3e372ce50a7e72cfaf3258e09e71ed516cafc |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/message_center/message_center_widget_delegate.h |
| @@ -0,0 +1,104 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_MESSAGE_CENTER_WIDGET_DELEGATE_H_ |
| +#define CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_MESSAGE_CENTER_WIDGET_DELEGATE_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "chrome/browser/ui/views/message_center/web_notification_tray.h" |
| +#include "ui/base/animation/animation_delegate.h" |
| +#include "ui/base/animation/slide_animation.h" |
| +#include "ui/gfx/point.h" |
| +#include "ui/gfx/rect.h" |
| +#include "ui/message_center/message_center.h" |
| +#include "ui/message_center/message_center_tray.h" |
| +#include "ui/message_center/message_center_tray_delegate.h" |
| +#include "ui/message_center/views/message_center_view.h" |
| +#include "ui/views/widget/widget_delegate.h" |
| +#include "ui/views/widget/widget_observer.h" |
| + |
| +namespace ui { |
| +class SlideAnimation; |
| +class AnimationDelegate; |
| +} |
| + |
| +namespace message_center { |
| + |
| +enum Alignment { |
| + ALIGNMENT_TOP = 1 << 0, |
| + ALIGNMENT_LEFT = 1 << 1, |
| + ALIGNMENT_BOTTOM = 1 << 2, |
| + ALIGNMENT_RIGHT = 1 << 3, |
| + ALIGNMENT_NONE = 1 << 4, |
| +}; |
| + |
| +struct PositionInfo { |
| + int max_height; |
| + |
| + // Alignment of the message center relative to the center of the screen. |
| + Alignment message_center_alignment; |
| + |
| + // Alignment of the systray and taskbar relative to the center of the screen. |
| + Alignment systray_alignment; |
| + |
| + // Point relative to which message center is positioned. |
| + gfx::Point inital_anchor_point; |
| +}; |
| + |
| +class WebNotificationTray; |
| +class MessageCenterFrameView; |
| + |
| +// MessageCenterWidgetDelegate is the message center's client view. It also |
| +// creates the message center widget and sets the notifications. |
| +// |
| +//////////////////////////////////////////////////////////////////////////////// |
| +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.
|
| + public message_center::MessageCenterView, |
| + public views::WidgetObserver { |
| + public: |
| + MessageCenterWidgetDelegate(WebNotificationTray* tray, |
| + MessageCenterTray* mc_tray, |
| + bool initially_settings_visible, |
| + const PositionInfo& pos_info); |
| + virtual ~MessageCenterWidgetDelegate(); |
| + |
| + // WidgetDelegate overrides: |
| + virtual View* GetContentsView() OVERRIDE; |
| + virtual views::NonClientFrameView* CreateNonClientFrameView( |
| + views::Widget* widget) OVERRIDE; |
| + virtual views::Widget* GetWidget() OVERRIDE; |
| + virtual const views::Widget* GetWidget() const OVERRIDE; |
| + |
| + // WidgetObserver overrides: |
| + virtual void OnWidgetActivationChanged(views::Widget* widget, bool active) |
| + OVERRIDE; |
| + virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
| + |
| + // View overrides: |
| + virtual void PreferredSizeChanged() OVERRIDE; |
| + virtual gfx::Size GetPreferredSize() OVERRIDE; |
| + virtual gfx::Size GetMaximumSize() OVERRIDE; |
| + virtual int GetHeightForWidth(int width) OVERRIDE; |
| + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| + |
| + protected: |
|
dewittj
2013/07/15 18:38:58
Remove this empty section.
sidharthms
2013/07/15 23:16:37
Done.
|
| + |
| + private: |
| + void InitWidget(); |
| + gfx::Point GetCorrectedAnchor(gfx::Size calculated_size); |
| + 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.
|
| + |
| + // Preferred width of message center. |
| + int preferred_width_; |
| + |
| + PositionInfo pos_info_; |
| + |
| + WebNotificationTray* tray_; |
| +}; |
| + |
| +} // namespace message_center |
| + |
| +#endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_MESSAGE_CENTER_WIDGET_DELEGATE_H_ |