| 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); | |
| 218 SetContentsBackground(); | 217 SetContentsBackground(); |
| 219 tray_container()->SetBorder(views::Border::NullBorder()); | 218 tray_container()->SetBorder(views::Border::NullBorder()); |
| 220 message_center_tray_.reset(new message_center::MessageCenterTray( | 219 message_center_tray_.reset(new message_center::MessageCenterTray( |
| 221 this, | 220 this, |
| 222 message_center::MessageCenter::Get())); | 221 message_center::MessageCenter::Get())); |
| 223 WmShelf* shelf = WmLookup::Get() | 222 WmShelf* shelf = WmLookup::Get() |
| 224 ->GetWindowForWidget(status_area_widget) | 223 ->GetWindowForWidget(status_area_widget) |
| 225 ->GetRootWindowController() | 224 ->GetRootWindowController() |
| 226 ->GetShelf(); | 225 ->GetShelf(); |
| 227 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf)); | 226 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf)); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 message_center_tray_->message_center(); | 497 message_center_tray_->message_center(); |
| 499 button_->SetUnreadCount(message_center->UnreadNotificationCount()); | 498 button_->SetUnreadCount(message_center->UnreadNotificationCount()); |
| 500 if (IsMessageCenterBubbleVisible()) | 499 if (IsMessageCenterBubbleVisible()) |
| 501 button_->SetState(views::CustomButton::STATE_PRESSED); | 500 button_->SetState(views::CustomButton::STATE_PRESSED); |
| 502 else | 501 else |
| 503 button_->SetState(views::CustomButton::STATE_NORMAL); | 502 button_->SetState(views::CustomButton::STATE_NORMAL); |
| 504 | 503 |
| 505 SetVisible(IsLoggedIn()); | 504 SetVisible(IsLoggedIn()); |
| 506 Layout(); | 505 Layout(); |
| 507 SchedulePaint(); | 506 SchedulePaint(); |
| 508 if (IsLoggedIn()) | |
| 509 status_area_widget()->system_tray()->SetNextFocusableView(this); | |
| 510 } | 507 } |
| 511 | 508 |
| 512 void WebNotificationTray::ClickedOutsideBubble() { | 509 void WebNotificationTray::ClickedOutsideBubble() { |
| 513 // Only hide the message center | 510 // Only hide the message center |
| 514 if (!message_center_bubble()) | 511 if (!message_center_bubble()) |
| 515 return; | 512 return; |
| 516 | 513 |
| 517 message_center_tray_->HideMessageCenterBubble(); | 514 message_center_tray_->HideMessageCenterBubble(); |
| 518 } | 515 } |
| 519 | 516 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 534 | 531 |
| 535 message_center::MessageCenterBubble* | 532 message_center::MessageCenterBubble* |
| 536 WebNotificationTray::GetMessageCenterBubbleForTest() { | 533 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 537 if (!message_center_bubble()) | 534 if (!message_center_bubble()) |
| 538 return NULL; | 535 return NULL; |
| 539 return static_cast<message_center::MessageCenterBubble*>( | 536 return static_cast<message_center::MessageCenterBubble*>( |
| 540 message_center_bubble()->bubble()); | 537 message_center_bubble()->bubble()); |
| 541 } | 538 } |
| 542 | 539 |
| 543 } // namespace ash | 540 } // namespace ash |
| OLD | NEW |