| 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/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_layout_manager_observer.h" | 10 #include "ash/shelf/shelf_layout_manager_observer.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 gfx::Size GetPreferredSize() const override { | 148 gfx::Size GetPreferredSize() const override { |
| 149 return gfx::Size(kShelfItemHeight, kShelfItemHeight); | 149 return gfx::Size(kShelfItemHeight, kShelfItemHeight); |
| 150 } | 150 } |
| 151 | 151 |
| 152 int GetHeightForWidth(int width) const override { | 152 int GetHeightForWidth(int width) const override { |
| 153 return GetPreferredSize().height(); | 153 return GetPreferredSize().height(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 private: | 156 private: |
| 157 void UpdateIconVisibility() { | 157 void UpdateIconVisibility() { |
| 158 unread_label_->SetEnabledColor( | 158 unread_label_->SetEnabledColor((unread_count_ > 0) |
| 159 (!is_bubble_visible_ && unread_count_ > 0) ? | 159 ? kWebNotificationColorWithUnread |
| 160 kWebNotificationColorWithUnread : kWebNotificationColorNoUnread); | 160 : kWebNotificationColorNoUnread); |
| 161 SchedulePaint(); | 161 SchedulePaint(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 bool is_bubble_visible_; | 164 bool is_bubble_visible_; |
| 165 int unread_count_; | 165 int unread_count_; |
| 166 | 166 |
| 167 views::Label* unread_label_; | 167 views::Label* unread_label_; |
| 168 | 168 |
| 169 DISALLOW_COPY_AND_ASSIGN(WebNotificationButton); | 169 DISALLOW_COPY_AND_ASSIGN(WebNotificationButton); |
| 170 }; | 170 }; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 if (IsMessageCenterBubbleVisible()) | 447 if (IsMessageCenterBubbleVisible()) |
| 448 button_->SetState(views::CustomButton::STATE_PRESSED); | 448 button_->SetState(views::CustomButton::STATE_PRESSED); |
| 449 else | 449 else |
| 450 button_->SetState(views::CustomButton::STATE_NORMAL); | 450 button_->SetState(views::CustomButton::STATE_NORMAL); |
| 451 bool userAddingRunning = ash::Shell::GetInstance() | 451 bool userAddingRunning = ash::Shell::GetInstance() |
| 452 ->session_state_delegate() | 452 ->session_state_delegate() |
| 453 ->IsInSecondaryLoginScreen(); | 453 ->IsInSecondaryLoginScreen(); |
| 454 | 454 |
| 455 SetVisible((status_area_widget()->login_status() != user::LOGGED_IN_NONE) && | 455 SetVisible((status_area_widget()->login_status() != user::LOGGED_IN_NONE) && |
| 456 (status_area_widget()->login_status() != user::LOGGED_IN_LOCKED) && | 456 (status_area_widget()->login_status() != user::LOGGED_IN_LOCKED) && |
| 457 !userAddingRunning && (message_center->NotificationCount() > 0)); | 457 !userAddingRunning); |
| 458 Layout(); | 458 Layout(); |
| 459 SchedulePaint(); | 459 SchedulePaint(); |
| 460 } | 460 } |
| 461 | 461 |
| 462 void WebNotificationTray::ClickedOutsideBubble() { | 462 void WebNotificationTray::ClickedOutsideBubble() { |
| 463 // Only hide the message center | 463 // Only hide the message center |
| 464 if (!message_center_bubble()) | 464 if (!message_center_bubble()) |
| 465 return; | 465 return; |
| 466 | 466 |
| 467 message_center_tray_->HideMessageCenterBubble(); | 467 message_center_tray_->HideMessageCenterBubble(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 479 | 479 |
| 480 message_center::MessageCenterBubble* | 480 message_center::MessageCenterBubble* |
| 481 WebNotificationTray::GetMessageCenterBubbleForTest() { | 481 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 482 if (!message_center_bubble()) | 482 if (!message_center_bubble()) |
| 483 return NULL; | 483 return NULL; |
| 484 return static_cast<message_center::MessageCenterBubble*>( | 484 return static_cast<message_center::MessageCenterBubble*>( |
| 485 message_center_bubble()->bubble()); | 485 message_center_bubble()->bubble()); |
| 486 } | 486 } |
| 487 | 487 |
| 488 } // namespace ash | 488 } // namespace ash |
| OLD | NEW |