OLD | NEW |
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/message_center_bubble.h" | 5 #include "ui/message_center/message_center_bubble.h" |
6 | 6 |
7 #include "grit/ui_strings.h" | 7 #include "grit/ui_strings.h" |
8 #include "third_party/skia/include/core/SkPaint.h" | 8 #include "third_party/skia/include/core/SkPaint.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 // TODO(mukai): remove the trailing '2' when the kEnableNewMessageCenterBubble | 174 // TODO(mukai): remove the trailing '2' when the kEnableNewMessageCenterBubble |
175 // flag disappears. | 175 // flag disappears. |
176 class WebNotificationButtonView2 : public WebNotificationButtonViewBase, | 176 class WebNotificationButtonView2 : public WebNotificationButtonViewBase, |
177 public views::ButtonListener { | 177 public views::ButtonListener { |
178 public: | 178 public: |
179 explicit WebNotificationButtonView2(NotificationList::Delegate* list_delegate) | 179 explicit WebNotificationButtonView2(NotificationList::Delegate* list_delegate) |
180 : WebNotificationButtonViewBase(list_delegate) { | 180 : WebNotificationButtonViewBase(list_delegate) { |
181 set_background(views::Background::CreateSolidBackground( | 181 set_background(views::Background::CreateSolidBackground( |
182 kMessageCenterBackgroundColor)); | 182 kMessageCenterBackgroundColor)); |
| 183 set_border(views::Border::CreateSolidSidedBorder( |
| 184 1, 0, 0, 0, kFooterDelimiterColor)); |
| 185 |
183 | 186 |
184 notification_label_ = new views::Label(l10n_util::GetStringUTF16( | 187 notification_label_ = new views::Label(l10n_util::GetStringUTF16( |
185 IDS_MESSAGE_CENTER_FOOTER_TITLE)); | 188 IDS_MESSAGE_CENTER_FOOTER_TITLE)); |
186 notification_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 189 notification_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
187 notification_label_->SetElideBehavior(views::Label::ELIDE_AT_END); | 190 notification_label_->SetElideBehavior(views::Label::ELIDE_AT_END); |
188 notification_label_->SetEnabledColor(kFooterTextColor); | 191 notification_label_->SetEnabledColor(kFooterTextColor); |
189 AddChildView(notification_label_); | 192 AddChildView(notification_label_); |
190 settings_button_ = new WebNotificationButton( | 193 settings_button_ = new WebNotificationButton( |
191 this, l10n_util::GetStringUTF16( | 194 this, l10n_util::GetStringUTF16( |
192 IDS_MESSAGE_CENTER_SETTINGS_BUTTON_LABEL)); | 195 IDS_MESSAGE_CENTER_SETTINGS_BUTTON_LABEL)); |
193 AddChildView(settings_button_); | 196 AddChildView(settings_button_); |
194 WebNotificationButton* close_all_button = new WebNotificationButton( | 197 WebNotificationButton* close_all_button = new WebNotificationButton( |
195 this, l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_CLEAR_ALL)); | 198 this, l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_CLEAR_ALL)); |
196 AddChildView(close_all_button); | 199 AddChildView(close_all_button); |
197 | 200 |
198 views::GridLayout* layout = new views::GridLayout(this); | 201 views::GridLayout* layout = new views::GridLayout(this); |
199 SetLayoutManager(layout); | 202 SetLayoutManager(layout); |
200 layout->SetInsets(0, kFooterMargin, kMarginBetweenItems, 0); | 203 layout->SetInsets( |
| 204 kMarginBetweenItems, kFooterMargin, kMarginBetweenItems, 0); |
201 views::ColumnSet* column = layout->AddColumnSet(0); | 205 views::ColumnSet* column = layout->AddColumnSet(0); |
202 column->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, | 206 column->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, |
203 1.0f, views::GridLayout::USE_PREF, 0, 0); | 207 1.0f, views::GridLayout::USE_PREF, 0, 0); |
204 column->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, | 208 column->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, |
205 0, views::GridLayout::FIXED, | 209 0, views::GridLayout::FIXED, |
206 settings_button_->GetPreferredSize().width(), 0); | 210 settings_button_->GetPreferredSize().width(), 0); |
207 column->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, | 211 column->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, |
208 0, views::GridLayout::USE_PREF, 0, 0); | 212 0, views::GridLayout::USE_PREF, 0, 0); |
209 layout->StartRow(0, 0); | 213 layout->StartRow(0, 0); |
210 layout->AddView(notification_label_); | 214 layout->AddView(notification_label_); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 SetLayoutManager( | 305 SetLayoutManager( |
302 new views::BoxLayout(views::BoxLayout::kVertical, | 306 new views::BoxLayout(views::BoxLayout::kVertical, |
303 0, | 307 0, |
304 0, | 308 0, |
305 kMarginBetweenItems - shadow_insets.bottom())); | 309 kMarginBetweenItems - shadow_insets.bottom())); |
306 set_background(views::Background::CreateSolidBackground( | 310 set_background(views::Background::CreateSolidBackground( |
307 kMessageCenterBackgroundColor)); | 311 kMessageCenterBackgroundColor)); |
308 set_border(views::Border::CreateEmptyBorder( | 312 set_border(views::Border::CreateEmptyBorder( |
309 kMarginBetweenItems - shadow_insets.top(), /* top */ | 313 kMarginBetweenItems - shadow_insets.top(), /* top */ |
310 kMarginBetweenItems - shadow_insets.left(), /* left */ | 314 kMarginBetweenItems - shadow_insets.left(), /* left */ |
311 kMarginBetweenItems - shadow_insets.bottom(), /* bottom */ | 315 0, /* bottom */ |
312 kMarginBetweenItems - shadow_insets.right() /* right */ )); | 316 kMarginBetweenItems - shadow_insets.right() /* right */ )); |
313 } else { | 317 } else { |
314 views::BoxLayout* layout = | 318 views::BoxLayout* layout = |
315 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1); | 319 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1); |
316 layout->set_spread_blank_space(true); | 320 layout->set_spread_blank_space(true); |
317 SetLayoutManager(layout); | 321 SetLayoutManager(layout); |
318 } | 322 } |
319 } | 323 } |
320 | 324 |
321 virtual ~ScrollContentView() { | 325 virtual ~ScrollContentView() { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 } | 520 } |
517 | 521 |
518 void MessageCenterBubble::OnMouseExitedView() { | 522 void MessageCenterBubble::OnMouseExitedView() { |
519 } | 523 } |
520 | 524 |
521 size_t MessageCenterBubble::NumMessageViewsForTest() const { | 525 size_t MessageCenterBubble::NumMessageViewsForTest() const { |
522 return contents_view_->NumMessageViews(); | 526 return contents_view_->NumMessageViews(); |
523 } | 527 } |
524 | 528 |
525 } // namespace message_center | 529 } // namespace message_center |
OLD | NEW |