| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 // TODO(mukai): move NINE_PLUS message to ui_strings, it doesn't need to be | 261 // TODO(mukai): move NINE_PLUS message to ui_strings, it doesn't need to be |
| 262 // in ash_strings. | 262 // in ash_strings. |
| 263 unread_label_->SetText((unread_count > 9) ? | 263 unread_label_->SetText((unread_count > 9) ? |
| 264 l10n_util::GetStringUTF16(IDS_ASH_NOTIFICATION_UNREAD_COUNT_NINE_PLUS) : | 264 l10n_util::GetStringUTF16(IDS_ASH_NOTIFICATION_UNREAD_COUNT_NINE_PLUS) : |
| 265 base::FormatNumber(unread_count)); | 265 base::FormatNumber(unread_count)); |
| 266 UpdateIconVisibility(); | 266 UpdateIconVisibility(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 protected: | 269 protected: |
| 270 // Overridden from views::ImageButton: | 270 // Overridden from views::ImageButton: |
| 271 virtual gfx::Size GetPreferredSize() OVERRIDE { | 271 virtual gfx::Size GetPreferredSize() const OVERRIDE { |
| 272 return gfx::Size(kShelfItemHeight, kShelfItemHeight); | 272 return gfx::Size(kShelfItemHeight, kShelfItemHeight); |
| 273 } | 273 } |
| 274 | 274 |
| 275 virtual int GetHeightForWidth(int width) OVERRIDE { | 275 virtual int GetHeightForWidth(int width) const OVERRIDE { |
| 276 return GetPreferredSize().height(); | 276 return GetPreferredSize().height(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 private: | 279 private: |
| 280 void UpdateIconVisibility() { | 280 void UpdateIconVisibility() { |
| 281 unread_label_->SetEnabledColor( | 281 unread_label_->SetEnabledColor( |
| 282 (!is_bubble_visible_ && unread_count_ > 0) ? | 282 (!is_bubble_visible_ && unread_count_ > 0) ? |
| 283 kWebNotificationColorWithUnread : kWebNotificationColorNoUnread); | 283 kWebNotificationColorWithUnread : kWebNotificationColorNoUnread); |
| 284 SchedulePaint(); | 284 SchedulePaint(); |
| 285 } | 285 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 494 |
| 495 void WebNotificationTray::OnMouseExitedView() {} | 495 void WebNotificationTray::OnMouseExitedView() {} |
| 496 | 496 |
| 497 base::string16 WebNotificationTray::GetAccessibleNameForBubble() { | 497 base::string16 WebNotificationTray::GetAccessibleNameForBubble() { |
| 498 return GetAccessibleNameForTray(); | 498 return GetAccessibleNameForTray(); |
| 499 } | 499 } |
| 500 | 500 |
| 501 gfx::Rect WebNotificationTray::GetAnchorRect( | 501 gfx::Rect WebNotificationTray::GetAnchorRect( |
| 502 views::Widget* anchor_widget, | 502 views::Widget* anchor_widget, |
| 503 views::TrayBubbleView::AnchorType anchor_type, | 503 views::TrayBubbleView::AnchorType anchor_type, |
| 504 views::TrayBubbleView::AnchorAlignment anchor_alignment) { | 504 views::TrayBubbleView::AnchorAlignment anchor_alignment) const { |
| 505 return GetBubbleAnchorRect(anchor_widget, anchor_type, anchor_alignment); | 505 return GetBubbleAnchorRect(anchor_widget, anchor_type, anchor_alignment); |
| 506 } | 506 } |
| 507 | 507 |
| 508 void WebNotificationTray::HideBubble(const views::TrayBubbleView* bubble_view) { | 508 void WebNotificationTray::HideBubble(const views::TrayBubbleView* bubble_view) { |
| 509 HideBubbleWithView(bubble_view); | 509 HideBubbleWithView(bubble_view); |
| 510 } | 510 } |
| 511 | 511 |
| 512 bool WebNotificationTray::ShowNotifierSettings() { | 512 bool WebNotificationTray::ShowNotifierSettings() { |
| 513 if (message_center_bubble()) { | 513 if (message_center_bubble()) { |
| 514 static_cast<message_center::MessageCenterBubble*>( | 514 static_cast<message_center::MessageCenterBubble*>( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 | 612 |
| 613 message_center::MessageCenterBubble* | 613 message_center::MessageCenterBubble* |
| 614 WebNotificationTray::GetMessageCenterBubbleForTest() { | 614 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 615 if (!message_center_bubble()) | 615 if (!message_center_bubble()) |
| 616 return NULL; | 616 return NULL; |
| 617 return static_cast<message_center::MessageCenterBubble*>( | 617 return static_cast<message_center::MessageCenterBubble*>( |
| 618 message_center_bubble()->bubble()); | 618 message_center_bubble()->bubble()); |
| 619 } | 619 } |
| 620 | 620 |
| 621 } // namespace ash | 621 } // namespace ash |
| OLD | NEW |