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/common/system/chromeos/network/tray_sms.h" | 5 #include "ash/common/system/chromeos/network/tray_sms.h" |
6 | 6 |
7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
8 #include "ash/common/metrics/user_metrics_action.h" | 8 #include "ash/common/metrics/user_metrics_action.h" |
9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" | 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" |
10 #include "ash/common/system/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
11 #include "ash/common/system/tray/system_tray_bubble.h" | 11 #include "ash/common/system/tray/system_tray_bubble.h" |
12 #include "ash/common/system/tray/tray_constants.h" | 12 #include "ash/common/system/tray/tray_constants.h" |
13 #include "ash/common/system/tray/tray_details_view.h" | 13 #include "ash/common/system/tray/tray_details_view.h" |
14 #include "ash/common/system/tray/tray_item_more.h" | 14 #include "ash/common/system/tray/tray_item_more.h" |
15 #include "ash/common/system/tray/tray_item_view.h" | 15 #include "ash/common/system/tray/tray_item_view.h" |
16 #include "ash/common/system/tray/tray_notification_view.h" | 16 #include "ash/common/system/tray/tray_notification_view.h" |
17 #include "ash/common/system/tray/view_click_listener.h" | |
18 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
19 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
21 #include "chromeos/network/network_event_log.h" | 20 #include "chromeos/network/network_event_log.h" |
22 #include "chromeos/network/network_handler.h" | 21 #include "chromeos/network/network_handler.h" |
23 #include "grit/ash_resources.h" | 22 #include "grit/ash_resources.h" |
24 #include "grit/ash_strings.h" | 23 #include "grit/ash_strings.h" |
25 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
27 #include "ui/gfx/paint_vector_icon.h" | 26 #include "ui/gfx/paint_vector_icon.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 182 } |
184 | 183 |
185 TraySms* owner_; | 184 TraySms* owner_; |
186 size_t index_; | 185 size_t index_; |
187 views::Label* number_label_; | 186 views::Label* number_label_; |
188 views::Label* message_label_; | 187 views::Label* message_label_; |
189 | 188 |
190 DISALLOW_COPY_AND_ASSIGN(SmsMessageView); | 189 DISALLOW_COPY_AND_ASSIGN(SmsMessageView); |
191 }; | 190 }; |
192 | 191 |
193 class TraySms::SmsDetailedView : public TrayDetailsView, | 192 class TraySms::SmsDetailedView : public TrayDetailsView { |
194 public ViewClickListener { | |
195 public: | 193 public: |
196 explicit SmsDetailedView(TraySms* owner) : TrayDetailsView(owner) { | 194 explicit SmsDetailedView(TraySms* owner) : TrayDetailsView(owner) { |
197 Init(); | 195 Init(); |
198 Update(); | 196 Update(); |
199 } | 197 } |
200 | 198 |
201 ~SmsDetailedView() override {} | 199 ~SmsDetailedView() override {} |
202 | 200 |
203 void Init() { | 201 void Init() { |
204 CreateScrollableList(); | 202 CreateScrollableList(); |
205 CreateSpecialRow(IDS_ASH_STATUS_TRAY_SMS, this); | 203 CreateTitleRow(IDS_ASH_STATUS_TRAY_SMS); |
206 } | 204 } |
207 | 205 |
208 void Update() { | 206 void Update() { |
209 UpdateMessageList(); | 207 UpdateMessageList(); |
210 Layout(); | 208 Layout(); |
211 SchedulePaint(); | 209 SchedulePaint(); |
212 } | 210 } |
213 | 211 |
214 // Overridden from views::View. | 212 // Overridden from views::View. |
215 gfx::Size GetPreferredSize() const override { | 213 gfx::Size GetPreferredSize() const override { |
(...skipping 20 matching lines...) Expand all Loading... |
236 continue; | 234 continue; |
237 } | 235 } |
238 SmsMessageView* msgview = new SmsMessageView( | 236 SmsMessageView* msgview = new SmsMessageView( |
239 static_cast<TraySms*>(owner()), SmsMessageView::VIEW_DETAILED, index, | 237 static_cast<TraySms*>(owner()), SmsMessageView::VIEW_DETAILED, index, |
240 number, text); | 238 number, text); |
241 scroll_content()->AddChildView(msgview); | 239 scroll_content()->AddChildView(msgview); |
242 } | 240 } |
243 scroller()->Layout(); | 241 scroller()->Layout(); |
244 } | 242 } |
245 | 243 |
246 // Overridden from ViewClickListener. | |
247 void OnViewClicked(views::View* sender) override { | |
248 if (sender == footer()->content()) | |
249 TransitionToDefaultView(); | |
250 } | |
251 | |
252 DISALLOW_COPY_AND_ASSIGN(SmsDetailedView); | 244 DISALLOW_COPY_AND_ASSIGN(SmsDetailedView); |
253 }; | 245 }; |
254 | 246 |
255 class TraySms::SmsNotificationView : public TrayNotificationView { | 247 class TraySms::SmsNotificationView : public TrayNotificationView { |
256 public: | 248 public: |
257 SmsNotificationView(TraySms* owner, | 249 SmsNotificationView(TraySms* owner, |
258 size_t message_index, | 250 size_t message_index, |
259 const std::string& number, | 251 const std::string& number, |
260 const std::string& text) | 252 const std::string& text) |
261 : TrayNotificationView(owner, IDR_AURA_UBER_TRAY_SMS), | 253 : TrayNotificationView(owner, IDR_AURA_UBER_TRAY_SMS), |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 std::string number, text; | 416 std::string number, text; |
425 if (GetLatestMessage(&index, &number, &text)) | 417 if (GetLatestMessage(&index, &number, &text)) |
426 notification_->Update(index, number, text); | 418 notification_->Update(index, number, text); |
427 } else if (notify) { | 419 } else if (notify) { |
428 ShowNotificationView(); | 420 ShowNotificationView(); |
429 } | 421 } |
430 } | 422 } |
431 } | 423 } |
432 | 424 |
433 } // namespace ash | 425 } // namespace ash |
OLD | NEW |