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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 chromeos::NetworkHandler::Get()->network_sms_handler()->AddObserver(this); | 292 chromeos::NetworkHandler::Get()->network_sms_handler()->AddObserver(this); |
293 } | 293 } |
294 | 294 |
295 TraySms::~TraySms() { | 295 TraySms::~TraySms() { |
296 if (chromeos::NetworkHandler::IsInitialized()) { | 296 if (chromeos::NetworkHandler::IsInitialized()) { |
297 chromeos::NetworkHandler::Get()->network_sms_handler()->RemoveObserver( | 297 chromeos::NetworkHandler::Get()->network_sms_handler()->RemoveObserver( |
298 this); | 298 this); |
299 } | 299 } |
300 } | 300 } |
301 | 301 |
302 views::View* TraySms::CreateDefaultView(user::LoginStatus status) { | 302 views::View* TraySms::CreateDefaultView(LoginStatus status) { |
303 CHECK(default_ == NULL); | 303 CHECK(default_ == NULL); |
304 default_ = new SmsDefaultView(this); | 304 default_ = new SmsDefaultView(this); |
305 default_->SetVisible(!messages_.empty()); | 305 default_->SetVisible(!messages_.empty()); |
306 return default_; | 306 return default_; |
307 } | 307 } |
308 | 308 |
309 views::View* TraySms::CreateDetailedView(user::LoginStatus status) { | 309 views::View* TraySms::CreateDetailedView(LoginStatus status) { |
310 CHECK(detailed_ == NULL); | 310 CHECK(detailed_ == NULL); |
311 HideNotificationView(); | 311 HideNotificationView(); |
312 if (messages_.empty()) | 312 if (messages_.empty()) |
313 return NULL; | 313 return NULL; |
314 detailed_ = new SmsDetailedView(this); | 314 detailed_ = new SmsDetailedView(this); |
315 return detailed_; | 315 return detailed_; |
316 } | 316 } |
317 | 317 |
318 views::View* TraySms::CreateNotificationView(user::LoginStatus status) { | 318 views::View* TraySms::CreateNotificationView(LoginStatus status) { |
319 CHECK(notification_ == NULL); | 319 CHECK(notification_ == NULL); |
320 if (detailed_) | 320 if (detailed_) |
321 return NULL; | 321 return NULL; |
322 size_t index; | 322 size_t index; |
323 std::string number, text; | 323 std::string number, text; |
324 if (GetLatestMessage(&index, &number, &text)) | 324 if (GetLatestMessage(&index, &number, &text)) |
325 notification_ = new SmsNotificationView(this, index, number, text); | 325 notification_ = new SmsNotificationView(this, index, number, text); |
326 return notification_; | 326 return notification_; |
327 } | 327 } |
328 | 328 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 std::string number, text; | 409 std::string number, text; |
410 if (GetLatestMessage(&index, &number, &text)) | 410 if (GetLatestMessage(&index, &number, &text)) |
411 notification_->Update(index, number, text); | 411 notification_->Update(index, number, text); |
412 } else if (notify) { | 412 } else if (notify) { |
413 ShowNotificationView(); | 413 ShowNotificationView(); |
414 } | 414 } |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 } // namespace ash | 418 } // namespace ash |
OLD | NEW |