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

Side by Side Diff: ui/message_center/views/message_center_bubble.cc

Issue 2491033006: Adjust positioning of cros tray bubbles. (Closed)
Patch Set: rebase and update bug link Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/message_center/views/message_center_bubble.h" 5 #include "ui/message_center/views/message_center_bubble.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "ui/base/l10n/l10n_util.h" 8 #include "ui/base/l10n/l10n_util.h"
9 #include "ui/message_center/message_center_style.h" 9 #include "ui/message_center/message_center_style.h"
10 #include "ui/message_center/views/message_center_view.h" 10 #include "ui/message_center/views/message_center_view.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 void ContentsView::ChildPreferredSizeChanged(View* child) { 54 void ContentsView::ChildPreferredSizeChanged(View* child) {
55 // TODO(dharcourt): Reduce the amount of updating this requires. 55 // TODO(dharcourt): Reduce the amount of updating this requires.
56 if (bubble_.get()) 56 if (bubble_.get())
57 bubble_->bubble_view()->UpdateBubble(); 57 bubble_->bubble_view()->UpdateBubble();
58 } 58 }
59 59
60 // MessageCenterBubble ///////////////////////////////////////////////////////// 60 // MessageCenterBubble /////////////////////////////////////////////////////////
61 61
62 MessageCenterBubble::MessageCenterBubble(MessageCenter* message_center, 62 MessageCenterBubble::MessageCenterBubble(MessageCenter* message_center,
63 MessageCenterTray* tray, 63 MessageCenterTray* tray)
64 bool first_item_has_no_margin)
65 : MessageBubbleBase(message_center, tray), 64 : MessageBubbleBase(message_center, tray),
66 message_center_view_(NULL), 65 message_center_view_(NULL),
67 initially_settings_visible_(false), 66 initially_settings_visible_(false) {}
68 first_item_has_no_margin_(first_item_has_no_margin) {}
69 67
70 MessageCenterBubble::~MessageCenterBubble() { 68 MessageCenterBubble::~MessageCenterBubble() {
71 // Removs this from the widget observers just in case. MessageCenterBubble 69 // Removs this from the widget observers just in case. MessageCenterBubble
72 // might be destoryed without calling its Widget's Close/CloseNow. 70 // might be destoryed without calling its Widget's Close/CloseNow.
73 if (bubble_view() && bubble_view()->GetWidget()) 71 if (bubble_view() && bubble_view()->GetWidget())
74 bubble_view()->GetWidget()->RemoveObserver(this); 72 bubble_view()->GetWidget()->RemoveObserver(this);
75 } 73 }
76 74
77 void MessageCenterBubble::SetSettingsVisible() { 75 void MessageCenterBubble::SetSettingsVisible() {
78 if (message_center_view_) 76 if (message_center_view_)
79 message_center_view_->SetSettingsVisible(true); 77 message_center_view_->SetSettingsVisible(true);
80 else 78 else
81 initially_settings_visible_ = true; 79 initially_settings_visible_ = true;
82 } 80 }
83 81
84 views::TrayBubbleView::InitParams MessageCenterBubble::GetInitParams( 82 views::TrayBubbleView::InitParams MessageCenterBubble::GetInitParams(
85 views::TrayBubbleView::AnchorAlignment anchor_alignment) { 83 views::TrayBubbleView::AnchorAlignment anchor_alignment) {
86 views::TrayBubbleView::InitParams init_params = 84 views::TrayBubbleView::InitParams init_params =
87 GetDefaultInitParams(anchor_alignment); 85 GetDefaultInitParams(anchor_alignment);
88 init_params.min_width += kMarginBetweenItems * 2; 86 init_params.min_width += kMarginBetweenItems * 2;
89 init_params.max_width += kMarginBetweenItems * 2; 87 init_params.max_width += kMarginBetweenItems * 2;
90 init_params.max_height = max_height(); 88 init_params.max_height = max_height();
91 init_params.can_activate = true; 89 init_params.can_activate = true;
92 init_params.first_item_has_no_margin = first_item_has_no_margin_;
93 return init_params; 90 return init_params;
94 } 91 }
95 92
96 void MessageCenterBubble::InitializeContents( 93 void MessageCenterBubble::InitializeContents(
97 views::TrayBubbleView* new_bubble_view) { 94 views::TrayBubbleView* new_bubble_view) {
98 set_bubble_view(new_bubble_view); 95 set_bubble_view(new_bubble_view);
99 bubble_view()->GetWidget()->AddObserver(this); 96 bubble_view()->GetWidget()->AddObserver(this);
100 message_center_view_ = new MessageCenterView( 97 message_center_view_ = new MessageCenterView(
101 message_center(), tray(), max_height(), initially_settings_visible_, 98 message_center(), tray(), max_height(), initially_settings_visible_,
102 false); /* MessageCenterBubble should be used only on ChromeOS. 99 false); /* MessageCenterBubble should be used only on ChromeOS.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 131 }
135 132
136 void MessageCenterBubble::OnMouseExitedView() { 133 void MessageCenterBubble::OnMouseExitedView() {
137 } 134 }
138 135
139 size_t MessageCenterBubble::NumMessageViewsForTest() const { 136 size_t MessageCenterBubble::NumMessageViewsForTest() const {
140 return message_center_view_->NumMessageViewsForTest(); 137 return message_center_view_->NumMessageViewsForTest();
141 } 138 }
142 139
143 } // namespace message_center 140 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698