| 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/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
| 8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 WebNotificationTray::WebNotificationTray(StatusAreaWidget* status_area_widget) | 207 WebNotificationTray::WebNotificationTray(StatusAreaWidget* status_area_widget) |
| 208 : TrayBackgroundView(status_area_widget), | 208 : TrayBackgroundView(status_area_widget), |
| 209 button_(NULL), | 209 button_(NULL), |
| 210 show_message_center_on_unlock_(false), | 210 show_message_center_on_unlock_(false), |
| 211 should_update_tray_content_(false), | 211 should_update_tray_content_(false), |
| 212 should_block_shelf_auto_hide_(false) { | 212 should_block_shelf_auto_hide_(false) { |
| 213 button_ = new WebNotificationButton(this); | 213 button_ = new WebNotificationButton(this); |
| 214 button_->set_triggerable_event_flags( | 214 button_->set_triggerable_event_flags( |
| 215 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON); | 215 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON); |
| 216 tray_container()->AddChildView(button_); | 216 tray_container()->AddChildView(button_); |
| 217 button_->SetFocusBehavior(FocusBehavior::NEVER); |
| 217 SetContentsBackground(); | 218 SetContentsBackground(); |
| 218 tray_container()->SetBorder(views::Border::NullBorder()); | 219 tray_container()->SetBorder(views::Border::NullBorder()); |
| 219 message_center_tray_.reset(new message_center::MessageCenterTray( | 220 message_center_tray_.reset(new message_center::MessageCenterTray( |
| 220 this, | 221 this, |
| 221 message_center::MessageCenter::Get())); | 222 message_center::MessageCenter::Get())); |
| 222 WmShelf* shelf = WmLookup::Get() | 223 WmShelf* shelf = WmLookup::Get() |
| 223 ->GetWindowForWidget(status_area_widget) | 224 ->GetWindowForWidget(status_area_widget) |
| 224 ->GetRootWindowController() | 225 ->GetRootWindowController() |
| 225 ->GetShelf(); | 226 ->GetShelf(); |
| 226 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf)); | 227 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf)); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 message_center_tray_->message_center(); | 498 message_center_tray_->message_center(); |
| 498 button_->SetUnreadCount(message_center->UnreadNotificationCount()); | 499 button_->SetUnreadCount(message_center->UnreadNotificationCount()); |
| 499 if (IsMessageCenterBubbleVisible()) | 500 if (IsMessageCenterBubbleVisible()) |
| 500 button_->SetState(views::CustomButton::STATE_PRESSED); | 501 button_->SetState(views::CustomButton::STATE_PRESSED); |
| 501 else | 502 else |
| 502 button_->SetState(views::CustomButton::STATE_NORMAL); | 503 button_->SetState(views::CustomButton::STATE_NORMAL); |
| 503 | 504 |
| 504 SetVisible(IsLoggedIn()); | 505 SetVisible(IsLoggedIn()); |
| 505 Layout(); | 506 Layout(); |
| 506 SchedulePaint(); | 507 SchedulePaint(); |
| 508 if (IsLoggedIn()) |
| 509 status_area_widget()->system_tray()->SetNextFocusableView(this); |
| 507 } | 510 } |
| 508 | 511 |
| 509 void WebNotificationTray::ClickedOutsideBubble() { | 512 void WebNotificationTray::ClickedOutsideBubble() { |
| 510 // Only hide the message center | 513 // Only hide the message center |
| 511 if (!message_center_bubble()) | 514 if (!message_center_bubble()) |
| 512 return; | 515 return; |
| 513 | 516 |
| 514 message_center_tray_->HideMessageCenterBubble(); | 517 message_center_tray_->HideMessageCenterBubble(); |
| 515 } | 518 } |
| 516 | 519 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 531 | 534 |
| 532 message_center::MessageCenterBubble* | 535 message_center::MessageCenterBubble* |
| 533 WebNotificationTray::GetMessageCenterBubbleForTest() { | 536 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 534 if (!message_center_bubble()) | 537 if (!message_center_bubble()) |
| 535 return NULL; | 538 return NULL; |
| 536 return static_cast<message_center::MessageCenterBubble*>( | 539 return static_cast<message_center::MessageCenterBubble*>( |
| 537 message_center_bubble()->bubble()); | 540 message_center_bubble()->bubble()); |
| 538 } | 541 } |
| 539 | 542 |
| 540 } // namespace ash | 543 } // namespace ash |
| OLD | NEW |