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