| 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/status_area_widget.h" | 5 #include "ash/system/status_area_widget.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
| 25 #include "ash/system/chromeos/session/logout_button_tray.h" | 25 #include "ash/system/chromeos/session/logout_button_tray.h" |
| 26 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" | 26 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 namespace ash { | 29 namespace ash { |
| 30 | 30 |
| 31 const char StatusAreaWidget::kNativeViewName[] = "StatusAreaWidget"; | 31 const char StatusAreaWidget::kNativeViewName[] = "StatusAreaWidget"; |
| 32 | 32 |
| 33 StatusAreaWidget::StatusAreaWidget(aura::Window* status_container) | 33 StatusAreaWidget::StatusAreaWidget(aura::Window* status_container, |
| 34 ShelfWidget* shelf_widget) |
| 34 : status_area_widget_delegate_(new StatusAreaWidgetDelegate), | 35 : status_area_widget_delegate_(new StatusAreaWidgetDelegate), |
| 35 overview_button_tray_(NULL), | 36 overview_button_tray_(NULL), |
| 36 system_tray_(NULL), | 37 system_tray_(NULL), |
| 37 web_notification_tray_(NULL), | 38 web_notification_tray_(NULL), |
| 38 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 39 logout_button_tray_(NULL), | 40 logout_button_tray_(NULL), |
| 40 virtual_keyboard_tray_(NULL), | 41 virtual_keyboard_tray_(NULL), |
| 41 #endif | 42 #endif |
| 42 login_status_(user::LOGGED_IN_NONE) { | 43 login_status_(user::LOGGED_IN_NONE), |
| 44 shelf_widget_(shelf_widget) { |
| 43 views::Widget::InitParams params( | 45 views::Widget::InitParams params( |
| 44 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 46 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 45 params.delegate = status_area_widget_delegate_; | 47 params.delegate = status_area_widget_delegate_; |
| 46 params.parent = status_container; | 48 params.parent = status_container; |
| 47 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 49 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 48 Init(params); | 50 Init(params); |
| 49 set_focus_on_creation(false); | 51 set_focus_on_creation(false); |
| 50 SetContentsView(status_area_widget_delegate_); | 52 SetContentsView(status_area_widget_delegate_); |
| 51 GetNativeView()->SetName(kNativeViewName); | 53 GetNativeView()->SetName(kNativeViewName); |
| 52 } | 54 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 delete overview_button_tray_; | 96 delete overview_button_tray_; |
| 95 overview_button_tray_ = NULL; | 97 overview_button_tray_ = NULL; |
| 96 } | 98 } |
| 97 | 99 |
| 98 bool StatusAreaWidget::ShouldShowShelf() const { | 100 bool StatusAreaWidget::ShouldShowShelf() const { |
| 99 if ((system_tray_ && system_tray_->ShouldShowShelf()) || | 101 if ((system_tray_ && system_tray_->ShouldShowShelf()) || |
| 100 (web_notification_tray_ && | 102 (web_notification_tray_ && |
| 101 web_notification_tray_->ShouldBlockShelfAutoHide())) | 103 web_notification_tray_->ShouldBlockShelfAutoHide())) |
| 102 return true; | 104 return true; |
| 103 | 105 |
| 104 if (!RootWindowController::ForShelf(GetNativeView())->shelf()->IsVisible()) | 106 if (!shelf_widget_->shelf()->IsVisible()) |
| 105 return false; | 107 return false; |
| 106 | 108 |
| 107 // If the shelf is currently visible, don't hide the shelf if the mouse | 109 // If the shelf is currently visible, don't hide the shelf if the mouse |
| 108 // is in any of the notification bubbles. | 110 // is in any of the notification bubbles. |
| 109 return (system_tray_ && system_tray_->IsMouseInNotificationBubble()) || | 111 return (system_tray_ && system_tray_->IsMouseInNotificationBubble()) || |
| 110 (web_notification_tray_ && | 112 (web_notification_tray_ && |
| 111 web_notification_tray_->IsMouseInNotificationBubble()); | 113 web_notification_tray_->IsMouseInNotificationBubble()); |
| 112 } | 114 } |
| 113 | 115 |
| 114 bool StatusAreaWidget::IsMessageBubbleShown() const { | 116 bool StatusAreaWidget::IsMessageBubbleShown() const { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); | 196 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); |
| 195 #if defined(OS_CHROMEOS) | 197 #if defined(OS_CHROMEOS) |
| 196 if (logout_button_tray_) | 198 if (logout_button_tray_) |
| 197 logout_button_tray_->UpdateAfterLoginStatusChange(login_status); | 199 logout_button_tray_->UpdateAfterLoginStatusChange(login_status); |
| 198 #endif | 200 #endif |
| 199 if (overview_button_tray_) | 201 if (overview_button_tray_) |
| 200 overview_button_tray_->UpdateAfterLoginStatusChange(login_status); | 202 overview_button_tray_->UpdateAfterLoginStatusChange(login_status); |
| 201 } | 203 } |
| 202 | 204 |
| 203 } // namespace ash | 205 } // namespace ash |
| OLD | NEW |