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