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

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: Compile issues fixed 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..ab8936af7c3349df56d5a7c7a9980b43c10bc4bd
--- /dev/null
+++ b/chrome/browser/ui/views/message_center/message_center_widget_delegate.h
@@ -0,0 +1,153 @@
+// 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;
+}
+
+namespace ui {
+class SlideAnimation;
+class AnimationDelegate;
+}
+
+class StatusIcon;
+
+namespace message_center {
+
+enum Alignment {
+ ALIGNMENT_TOP = 1,
+ ALIGNMENT_LEFT = 2,
+ ALIGNMENT_BOTTOM = 4,
+ ALIGNMENT_RIGHT = 8,
+ ALIGNMENT_NONE = 16
+};
+
+class WebNotificationTray;
+class MessageCenterFrameView;
+
+class MessageCenterWidgetDelegate : public views::WidgetDelegate,
+ public message_center::MessageCenterView,
+ public views::WidgetObserver {
+ public:
+ // AnchorAlignment determines to which side of the anchor the bubble will
+ // align itself.
+
+ MessageCenterWidgetDelegate(WebNotificationTray* tray,
+ MessageCenterTray* mc_tray,
+ bool initially_settings_visible);
+ 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();
+ void CloseWidget();
+
+ // Called after the bubble view has been constructed. Creates and initializes
+ // the bubble contents.
+ void InitializeContents();
+
+ // Update the bubble color from |theme|, unless it was explicitly set.
+ void UpdateColorsFromTheme(const ui::NativeTheme* theme);
+
+ void UpdateNotifications();
+ MessageCenterFrameView* GetBubbleFrameView() const;
+ gfx::Rect GetBubbleBounds();
+
+ int min_width() const { return min_width_; }
+ void set_min_width(int min_width) { min_width_ = min_width; }
+
+ int max_width() const { return max_width_; }
+ void set_max_width(int max_width) { max_width_ = max_width; }
+
+ int max_height() const { return max_height_; }
+ void set_max_height(int max_height) { max_height_ = max_height; }
+
+ SkColor color() const { return color_; }
dewittj 2013/06/28 01:13:18 Can this be private?
sidharthms 2013/07/02 18:09:51 Done. Actually removed
+ void set_color(SkColor color) {
dewittj 2013/06/28 01:13:18 Is this method used anywhere?
sidharthms 2013/07/02 18:09:51 Done.
+ color_ = color;
+ color_explicitly_set_ = true;
+ }
+
+ bool close_on_esc() const { return close_on_esc_; }
dewittj 2013/06/28 01:13:18 private
sidharthms 2013/07/02 18:09:51 Done.
+ void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; }
dewittj 2013/06/28 01:13:18 remove
sidharthms 2013/07/02 18:09:51 Done.
+
+ bool close_on_deactivate() const { return close_on_deactivate_; }
dewittj 2013/06/28 01:13:18 private
sidharthms 2013/07/02 18:09:51 Done.
+ void set_close_on_deactivate(bool close) { close_on_deactivate_ = close; }
dewittj 2013/06/28 01:13:18 remove
sidharthms 2013/07/02 18:09:51 Done.
+
+ protected:
+ // ui::AnimationDelegate overrides:
+ virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
dewittj 2013/06/28 01:13:18 Do you ever start an animation? If not, remove th
sidharthms 2013/07/02 18:09:51 Done.
+ virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
+
+ private:
+ gfx::Point GetCorrectedAnchor(gfx::Size calculated_size);
+ void PositionAnchor();
+
+ int min_width_;
+ int max_width_;
+ int max_height_;
+
+ // Alignment of the message center relative to the center of the screen.
+ Alignment bubble_alignment_;
+
+ // 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
+ gfx::Point inital_anchor_point_;
+
+ // Fade animation for bubble.
+ scoped_ptr<ui::SlideAnimation> fade_animation_;
+
+ // The background color of the bubble; and flag for when it's explicitly set.
+ SkColor color_;
+ bool color_explicitly_set_;
dewittj 2013/06/28 01:13:18 I suspect this is unnecessarily copied.
sidharthms 2013/07/02 18:09:51 Done.
+
+ // Flags controlling bubble closure on the escape key and deactivation.
+ bool close_on_esc_;
+ bool close_on_deactivate_;
+
+ // Preferred width of message center.
+ int preferred_width_;
+
+ 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