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

Side by Side Diff: chrome/browser/ui/views/message_center/message_center_widget_delegate.h

Issue 18003003: Message center re-organized (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments applied Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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/message_center/message_center.h"
15 #include "ui/message_center/message_center_tray.h"
16 #include "ui/message_center/message_center_tray_delegate.h"
17 #include "ui/message_center/views/message_center_view.h"
18 #include "ui/views/widget/widget_delegate.h"
19 #include "ui/views/widget/widget_observer.h"
20
21 namespace gfx {
22 class Rect;
dewittj 2013/07/02 18:43:32 I suspect that you can remove this and should add
sidharthms 2013/07/02 21:01:16 Done.
23 }
24
25 namespace ui {
26 class SlideAnimation;
27 class AnimationDelegate;
28 }
29
30 class StatusIcon;
dewittj 2013/07/02 18:43:32 I don't think this is necessary.
sidharthms 2013/07/02 21:01:16 Done.
31
32 namespace message_center {
33
34 enum Alignment {
35 ALIGNMENT_TOP = 1,
36 ALIGNMENT_LEFT = 2,
37 ALIGNMENT_BOTTOM = 4,
38 ALIGNMENT_RIGHT = 8,
39 ALIGNMENT_NONE = 16
dewittj 2013/07/02 18:43:32 It is more idiomatic to describe these as 1 << x r
sidharthms 2013/07/02 21:01:16 Done.
40 };
41
42 struct PositionInfo {
43 int max_height;
44
45 // Alignment of the message center relative to the center of the screen.
46 Alignment bubble_alignment;
dewittj 2013/07/02 18:43:32 Please rename this since this class is not related
sidharthms 2013/07/02 21:01:16 Done.
47
48 // Alignment of the systray and taskbar relative to the center of the screen.
49 Alignment systray_alignment;
50
51 // The anchor point must fall somewhere along one of the edge of the message
52 // center. But since we don't know the size until
dewittj 2013/07/02 18:43:32 This comment is not complete!
sidharthms 2013/07/02 21:01:16 Done.
53 gfx::Point inital_anchor_point;
54 };
55
56 class WebNotificationTray;
57 class MessageCenterFrameView;
58
59 class MessageCenterWidgetDelegate : public views::WidgetDelegate,
dewittj 2013/07/02 18:43:32 Please provide a class comment.
sidharthms 2013/07/02 21:01:16 Done.
60 public message_center::MessageCenterView,
61 public views::WidgetObserver {
62 public:
63 // AnchorAlignment determines to which side of the anchor the bubble will
64 // align itself.
dewittj 2013/07/02 18:43:32 Don't refer to bubble here either.
sidharthms 2013/07/02 21:01:16 Done.
65
66 MessageCenterWidgetDelegate(WebNotificationTray* tray,
67 MessageCenterTray* mc_tray,
68 bool initially_settings_visible,
69 PositionInfo pos_info);
dewittj 2013/07/02 18:43:32 probably should pass this in as a const PositionIn
sidharthms 2013/07/02 21:01:16 So you mean the private instance (pos_info_) shoul
70 virtual ~MessageCenterWidgetDelegate();
71
72 // WidgetDelegate overrides:
73 virtual View* GetContentsView() OVERRIDE;
74 virtual views::NonClientFrameView* CreateNonClientFrameView(
75 views::Widget* widget) OVERRIDE;
76 virtual views::Widget* GetWidget() OVERRIDE;
77 virtual const views::Widget* GetWidget() const OVERRIDE;
78
79 // WidgetObserver overrides:
80 virtual void OnWidgetActivationChanged(views::Widget* widget, bool active)
81 OVERRIDE;
82
83 // View overrides:
84 virtual void PreferredSizeChanged() OVERRIDE;
85 virtual gfx::Size GetPreferredSize() OVERRIDE;
86 virtual gfx::Size GetMaximumSize() OVERRIDE;
87 virtual int GetHeightForWidth(int width) OVERRIDE;
88 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
89 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
90
91 void InitWidget();
dewittj 2013/07/02 18:43:32 Move this to private.
sidharthms 2013/07/02 21:01:16 Done.
92 void CloseWidget();
93
94 // Called after the bubble view has been constructed. Creates and initializes
95 // the bubble contents.
dewittj 2013/07/02 18:43:32 Don't refer to bubble here either.
sidharthms 2013/07/02 21:01:16 Done.
96 void InitializeContents();
97
98 // Update the bubble color from |theme|, unless it was explicitly set.
dewittj 2013/07/02 18:43:32 Don't refer to bubble here either.
sidharthms 2013/07/02 21:01:16 Done.
99 void UpdateColorsFromTheme(const ui::NativeTheme* theme);
100
101 void UpdateNotifications();
102 MessageCenterFrameView* GetBubbleFrameView() const;
dewittj 2013/07/02 18:43:32 I don't think anyone calls this function.
sidharthms 2013/07/02 21:01:16 Done.
103 gfx::Rect GetBubbleBounds();
dewittj 2013/07/02 18:43:32 Move to private. Also, rename since this isn't re
sidharthms 2013/07/02 21:01:16 Done.
104
105 protected:
106
107 private:
108 gfx::Point GetCorrectedAnchor(gfx::Size calculated_size);
109 void PositionAnchor();
110
111 // The background color of the bubble; and flag for when it's explicitly set.
dewittj 2013/07/02 18:43:32 Don't refer to bubble here either. Remove referen
sidharthms 2013/07/02 21:01:16 Done.
112 SkColor color_;
113
114 // Preferred width of message center.
115 int preferred_width_;
116
117 PositionInfo pos_info_;
118
119 WebNotificationTray* tray_;
120 };
121
122 } // namespace message_center
123
124 #endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_MESSAGE_CENTER_WIDGET_DELEGATE _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698