| 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 "ash/system/chromeos/network/tray_sms.h" | 5 #include "ash/system/chromeos/network/tray_sms.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
| 9 #include "ash/system/tray/system_tray_bubble.h" |
| 9 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
| 10 #include "ash/system/tray/tray_details_view.h" | 11 #include "ash/system/tray/tray_details_view.h" |
| 11 #include "ash/system/tray/tray_item_more.h" | 12 #include "ash/system/tray/tray_item_more.h" |
| 12 #include "ash/system/tray/tray_item_view.h" | 13 #include "ash/system/tray/tray_item_view.h" |
| 13 #include "ash/system/tray/tray_notification_view.h" | 14 #include "ash/system/tray/tray_notification_view.h" |
| 14 #include "ash/system/tray/tray_views.h" | 15 #include "ash/system/tray/tray_views.h" |
| 15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 16 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
| 17 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 18 #include "grit/ash_resources.h" | 19 #include "grit/ash_resources.h" |
| 19 #include "grit/ash_strings.h" | 20 #include "grit/ash_strings.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
| 23 #include "ui/views/bubble/tray_bubble_view.h" |
| 22 #include "ui/views/controls/image_view.h" | 24 #include "ui/views/controls/image_view.h" |
| 23 #include "ui/views/controls/label.h" | 25 #include "ui/views/controls/label.h" |
| 24 #include "ui/views/layout/box_layout.h" | 26 #include "ui/views/layout/box_layout.h" |
| 25 #include "ui/views/layout/fill_layout.h" | 27 #include "ui/views/layout/fill_layout.h" |
| 26 #include "ui/views/layout/grid_layout.h" | 28 #include "ui/views/layout/grid_layout.h" |
| 27 #include "ui/views/view.h" | 29 #include "ui/views/view.h" |
| 28 | 30 |
| 29 namespace { | 31 namespace { |
| 30 | 32 |
| 31 // Min height of the list of messages in the popup. | 33 // Min height of the list of messages in the popup. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 owner_->RemoveMessage(index_); | 115 owner_->RemoveMessage(index_); |
| 114 owner_->Update(false); | 116 owner_->Update(false); |
| 115 } | 117 } |
| 116 | 118 |
| 117 private: | 119 private: |
| 118 void LayoutDetailedView() { | 120 void LayoutDetailedView() { |
| 119 views::ImageButton* close_button = new views::ImageButton(this); | 121 views::ImageButton* close_button = new views::ImageButton(this); |
| 120 close_button->SetImage(views::CustomButton::STATE_NORMAL, | 122 close_button->SetImage(views::CustomButton::STATE_NORMAL, |
| 121 ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 123 ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 122 IDR_AURA_WINDOW_CLOSE)); | 124 IDR_AURA_WINDOW_CLOSE)); |
| 123 | 125 const int msg_width = owner_->system_tray()->GetSystemBubble()-> |
| 124 int msg_width = kTrayPopupWidth - kNotificationIconWidth - | 126 bubble_view()->GetPreferredSize().width() - |
| 125 kTrayPopupPaddingHorizontal * 2; | 127 (kNotificationIconWidth + kTrayPopupPaddingHorizontal * 2); |
| 126 message_label_->SizeToFit(msg_width); | 128 message_label_->SizeToFit(msg_width); |
| 127 | 129 |
| 128 views::GridLayout* layout = new views::GridLayout(this); | 130 views::GridLayout* layout = new views::GridLayout(this); |
| 129 SetLayoutManager(layout); | 131 SetLayoutManager(layout); |
| 130 | 132 |
| 131 views::ColumnSet* columns = layout->AddColumnSet(0); | 133 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 132 | 134 |
| 133 // Message | 135 // Message |
| 134 columns->AddPaddingColumn(0, kTrayPopupPaddingHorizontal); | 136 columns->AddPaddingColumn(0, kTrayPopupPaddingHorizontal); |
| 135 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, | 137 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 if (GetLatestMessage(&index, &number, &text)) | 368 if (GetLatestMessage(&index, &number, &text)) |
| 367 notification_->Update(index, number, text); | 369 notification_->Update(index, number, text); |
| 368 } else if (notify) { | 370 } else if (notify) { |
| 369 ShowNotificationView(); | 371 ShowNotificationView(); |
| 370 } | 372 } |
| 371 } | 373 } |
| 372 } | 374 } |
| 373 | 375 |
| 374 } // namespace internal | 376 } // namespace internal |
| 375 } // namespace ash | 377 } // namespace ash |
| OLD | NEW |