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/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/fixed_sized_scroll_view.h" | 8 #include "ash/system/tray/fixed_sized_scroll_view.h" |
9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
10 #include "ash/system/tray/system_tray_bubble.h" | 10 #include "ash/system/tray/system_tray_bubble.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 namespace ash { | 55 namespace ash { |
56 namespace internal { | 56 namespace internal { |
57 | 57 |
58 class TraySms::SmsDefaultView : public TrayItemMore { | 58 class TraySms::SmsDefaultView : public TrayItemMore { |
59 public: | 59 public: |
60 explicit SmsDefaultView(TraySms* owner) | 60 explicit SmsDefaultView(TraySms* owner) |
61 : TrayItemMore(owner, true) { | 61 : TrayItemMore(owner, true) { |
62 SetImage(ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 62 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
63 IDR_AURA_UBER_TRAY_SMS)); | 63 IDR_AURA_UBER_TRAY_SMS)); |
64 Update(); | 64 Update(); |
65 } | 65 } |
66 | 66 |
67 virtual ~SmsDefaultView() {} | 67 virtual ~SmsDefaultView() {} |
68 | 68 |
69 void Update() { | 69 void Update() { |
70 int message_count = static_cast<TraySms*>(owner())->messages().GetSize(); | 70 int message_count = static_cast<TraySms*>(owner())->messages().GetSize(); |
71 base::string16 label = l10n_util::GetStringFUTF16( | 71 base::string16 label = l10n_util::GetStringFUTF16( |
72 IDS_ASH_STATUS_TRAY_SMS_MESSAGES, base::IntToString16(message_count)); | 72 IDS_ASH_STATUS_TRAY_SMS_MESSAGES, base::IntToString16(message_count)); |
(...skipping 16 matching lines...) Expand all Loading... |
89 | 89 |
90 SmsMessageView(TraySms* owner, | 90 SmsMessageView(TraySms* owner, |
91 ViewType view_type, | 91 ViewType view_type, |
92 size_t index, | 92 size_t index, |
93 const std::string& number, | 93 const std::string& number, |
94 const std::string& message) | 94 const std::string& message) |
95 : owner_(owner), | 95 : owner_(owner), |
96 index_(index) { | 96 index_(index) { |
97 number_label_ = new views::Label( | 97 number_label_ = new views::Label( |
98 l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_SMS_NUMBER, | 98 l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_SMS_NUMBER, |
99 base::UTF8ToUTF16(number))); | 99 base::UTF8ToUTF16(number)), |
| 100 ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 101 ui::ResourceBundle::BoldFont)); |
100 number_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 102 number_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
101 number_label_->SetFontList( | |
102 number_label_->font_list().DeriveFontListWithSizeDeltaAndStyle( | |
103 0, gfx::Font::BOLD)); | |
104 | 103 |
105 message_label_ = new views::Label(base::UTF8ToUTF16(message)); | 104 message_label_ = new views::Label(base::UTF8ToUTF16(message)); |
106 message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 105 message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
107 message_label_->SetMultiLine(true); | 106 message_label_->SetMultiLine(true); |
108 | 107 |
109 if (view_type == VIEW_DETAILED) | 108 if (view_type == VIEW_DETAILED) |
110 LayoutDetailedView(); | 109 LayoutDetailedView(); |
111 else | 110 else |
112 LayoutNotificationView(); | 111 LayoutNotificationView(); |
113 } | 112 } |
114 | 113 |
115 virtual ~SmsMessageView() { | 114 virtual ~SmsMessageView() { |
116 } | 115 } |
117 | 116 |
118 // Overridden from ButtonListener. | 117 // Overridden from ButtonListener. |
119 virtual void ButtonPressed(views::Button* sender, | 118 virtual void ButtonPressed(views::Button* sender, |
120 const ui::Event& event) OVERRIDE { | 119 const ui::Event& event) OVERRIDE { |
121 owner_->RemoveMessage(index_); | 120 owner_->RemoveMessage(index_); |
122 owner_->Update(false); | 121 owner_->Update(false); |
123 } | 122 } |
124 | 123 |
125 private: | 124 private: |
126 void LayoutDetailedView() { | 125 void LayoutDetailedView() { |
127 views::ImageButton* close_button = new views::ImageButton(this); | 126 views::ImageButton* close_button = new views::ImageButton(this); |
128 close_button->SetImage(views::CustomButton::STATE_NORMAL, | 127 close_button->SetImage( |
129 ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 128 views::CustomButton::STATE_NORMAL, |
| 129 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
130 IDR_AURA_WINDOW_CLOSE)); | 130 IDR_AURA_WINDOW_CLOSE)); |
131 const int msg_width = owner_->system_tray()->GetSystemBubble()-> | 131 const int msg_width = owner_->system_tray()->GetSystemBubble()-> |
132 bubble_view()->GetPreferredSize().width() - | 132 bubble_view()->GetPreferredSize().width() - |
133 (kNotificationIconWidth + kTrayPopupPaddingHorizontal * 2); | 133 (kNotificationIconWidth + kTrayPopupPaddingHorizontal * 2); |
134 message_label_->SizeToFit(msg_width); | 134 message_label_->SizeToFit(msg_width); |
135 | 135 |
136 views::GridLayout* layout = new views::GridLayout(this); | 136 views::GridLayout* layout = new views::GridLayout(this); |
137 SetLayoutManager(layout); | 137 SetLayoutManager(layout); |
138 | 138 |
139 views::ColumnSet* columns = layout->AddColumnSet(0); | 139 views::ColumnSet* columns = layout->AddColumnSet(0); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 if (GetLatestMessage(&index, &number, &text)) | 412 if (GetLatestMessage(&index, &number, &text)) |
413 notification_->Update(index, number, text); | 413 notification_->Update(index, number, text); |
414 } else if (notify) { | 414 } else if (notify) { |
415 ShowNotificationView(); | 415 ShowNotificationView(); |
416 } | 416 } |
417 } | 417 } |
418 } | 418 } |
419 | 419 |
420 } // namespace internal | 420 } // namespace internal |
421 } // namespace ash | 421 } // namespace ash |
OLD | NEW |