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

Unified 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, 6 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: 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..9a1377519069b3e364c457896275af55f0077622
--- /dev/null
+++ b/chrome/browser/ui/views/message_center/message_center_widget_delegate.h
@@ -0,0 +1,124 @@
+// 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/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 gfx {
+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.
+}
+
+namespace ui {
+class SlideAnimation;
+class AnimationDelegate;
+}
+
+class StatusIcon;
dewittj 2013/07/02 18:43:32 I don't think this is necessary.
sidharthms 2013/07/02 21:01:16 Done.
+
+namespace message_center {
+
+enum Alignment {
+ ALIGNMENT_TOP = 1,
+ ALIGNMENT_LEFT = 2,
+ ALIGNMENT_BOTTOM = 4,
+ ALIGNMENT_RIGHT = 8,
+ 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.
+};
+
+struct PositionInfo {
+ int max_height;
+
+ // Alignment of the message center relative to the center of the screen.
+ 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.
+
+ // Alignment of the systray and taskbar relative to the center of the screen.
+ Alignment systray_alignment;
+
+ // The anchor point must fall somewhere along one of the edge of the message
+ // 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.
+ gfx::Point inital_anchor_point;
+};
+
+class WebNotificationTray;
+class MessageCenterFrameView;
+
+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.
+ public message_center::MessageCenterView,
+ public views::WidgetObserver {
+ public:
+ // AnchorAlignment determines to which side of the anchor the bubble will
+ // align itself.
dewittj 2013/07/02 18:43:32 Don't refer to bubble here either.
sidharthms 2013/07/02 21:01:16 Done.
+
+ MessageCenterWidgetDelegate(WebNotificationTray* tray,
+ MessageCenterTray* mc_tray,
+ bool initially_settings_visible,
+ 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
+ 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;
+
+ // 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;
+ virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
+
+ void InitWidget();
dewittj 2013/07/02 18:43:32 Move this to private.
sidharthms 2013/07/02 21:01:16 Done.
+ void CloseWidget();
+
+ // Called after the bubble view has been constructed. Creates and initializes
+ // 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.
+ void InitializeContents();
+
+ // 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.
+ void UpdateColorsFromTheme(const ui::NativeTheme* theme);
+
+ void UpdateNotifications();
+ 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.
+ 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.
+
+ protected:
+
+ private:
+ gfx::Point GetCorrectedAnchor(gfx::Size calculated_size);
+ void PositionAnchor();
+
+ // 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.
+ SkColor color_;
+
+ // 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_

Powered by Google App Engine
This is Rietveld 408576698