Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Side by Side Diff: ash/system/status_area_widget.cc

Issue 2072023003: mash: Break ash system tray dependencies on ash::ShelfWidget (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/system/status_area_widget.h ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/shelf/wm_shelf.h"
7 #include "ash/common/shell_window_ids.h" 8 #include "ash/common/shell_window_ids.h"
8 #include "ash/common/system/tray/system_tray_delegate.h" 9 #include "ash/common/system/tray/system_tray_delegate.h"
9 #include "ash/common/wm_root_window_controller.h" 10 #include "ash/common/wm_root_window_controller.h"
10 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
11 #include "ash/common/wm_window.h" 12 #include "ash/common/wm_window.h"
12 #include "ash/shelf/shelf_layout_manager.h"
13 #include "ash/shelf/shelf_widget.h"
14 #include "ash/shell.h"
15 #include "ash/shell_delegate.h"
16 #include "ash/system/overview/overview_button_tray.h" 13 #include "ash/system/overview/overview_button_tray.h"
17 #include "ash/system/status_area_widget_delegate.h" 14 #include "ash/system/status_area_widget_delegate.h"
18 #include "ash/system/tray/system_tray.h" 15 #include "ash/system/tray/system_tray.h"
19 #include "ash/system/web_notification/web_notification_tray.h" 16 #include "ash/system/web_notification/web_notification_tray.h"
20 #include "ash/wm/window_properties.h" 17 #include "ash/wm/window_properties.h"
21 #include "base/i18n/time_formatting.h" 18 #include "base/i18n/time_formatting.h"
22 19
23 #if defined(OS_CHROMEOS) 20 #if defined(OS_CHROMEOS)
24 #include "ash/system/chromeos/session/logout_button_tray.h" 21 #include "ash/system/chromeos/session/logout_button_tray.h"
25 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" 22 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h"
26 #endif 23 #endif
27 24
28 namespace ash { 25 namespace ash {
29 26
30 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container, 27 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container,
31 ShelfWidget* shelf_widget) 28 WmShelf* wm_shelf)
32 : status_area_widget_delegate_(new StatusAreaWidgetDelegate), 29 : status_area_widget_delegate_(new StatusAreaWidgetDelegate),
33 overview_button_tray_(NULL), 30 overview_button_tray_(NULL),
34 system_tray_(NULL), 31 system_tray_(NULL),
35 web_notification_tray_(NULL), 32 web_notification_tray_(NULL),
36 #if defined(OS_CHROMEOS) 33 #if defined(OS_CHROMEOS)
37 logout_button_tray_(NULL), 34 logout_button_tray_(NULL),
38 virtual_keyboard_tray_(NULL), 35 virtual_keyboard_tray_(NULL),
39 #endif 36 #endif
40 login_status_(LoginStatus::NOT_LOGGED_IN), 37 login_status_(LoginStatus::NOT_LOGGED_IN),
41 shelf_widget_(shelf_widget) { 38 wm_shelf_(wm_shelf) {
42 views::Widget::InitParams params( 39 views::Widget::InitParams params(
43 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 40 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
44 params.delegate = status_area_widget_delegate_; 41 params.delegate = status_area_widget_delegate_;
45 params.name = "StatusAreaWidget"; 42 params.name = "StatusAreaWidget";
46 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 43 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
47 status_container->GetRootWindowController() 44 status_container->GetRootWindowController()
48 ->ConfigureWidgetInitParamsForContainer( 45 ->ConfigureWidgetInitParamsForContainer(
49 this, status_container->GetShellWindowId(), &params); 46 this, status_container->GetShellWindowId(), &params);
50 Init(params); 47 Init(params);
51 set_focus_on_creation(false); 48 set_focus_on_creation(false);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 delete overview_button_tray_; 92 delete overview_button_tray_;
96 overview_button_tray_ = NULL; 93 overview_button_tray_ = NULL;
97 } 94 }
98 95
99 bool StatusAreaWidget::ShouldShowShelf() const { 96 bool StatusAreaWidget::ShouldShowShelf() const {
100 if ((system_tray_ && system_tray_->ShouldShowShelf()) || 97 if ((system_tray_ && system_tray_->ShouldShowShelf()) ||
101 (web_notification_tray_ && 98 (web_notification_tray_ &&
102 web_notification_tray_->ShouldBlockShelfAutoHide())) 99 web_notification_tray_->ShouldBlockShelfAutoHide()))
103 return true; 100 return true;
104 101
105 if (!shelf_widget_->shelf()->IsVisible()) 102 if (!wm_shelf_->IsVisible())
106 return false; 103 return false;
107 104
108 // If the shelf is currently visible, don't hide the shelf if the mouse 105 // If the shelf is currently visible, don't hide the shelf if the mouse
109 // is in any of the notification bubbles. 106 // is in any of the notification bubbles.
110 return (system_tray_ && system_tray_->IsMouseInNotificationBubble()) || 107 return (system_tray_ && system_tray_->IsMouseInNotificationBubble()) ||
111 (web_notification_tray_ && 108 (web_notification_tray_ &&
112 web_notification_tray_->IsMouseInNotificationBubble()); 109 web_notification_tray_->IsMouseInNotificationBubble());
113 } 110 }
114 111
115 bool StatusAreaWidget::IsMessageBubbleShown() const { 112 bool StatusAreaWidget::IsMessageBubbleShown() const {
(...skipping 14 matching lines...) Expand all
130 } 127 }
131 128
132 void StatusAreaWidget::OnNativeWidgetActivationChanged(bool active) { 129 void StatusAreaWidget::OnNativeWidgetActivationChanged(bool active) {
133 Widget::OnNativeWidgetActivationChanged(active); 130 Widget::OnNativeWidgetActivationChanged(active);
134 if (active) 131 if (active)
135 status_area_widget_delegate_->SetPaneFocusAndFocusDefault(); 132 status_area_widget_delegate_->SetPaneFocusAndFocusDefault();
136 } 133 }
137 134
138 void StatusAreaWidget::OnMouseEvent(ui::MouseEvent* event) { 135 void StatusAreaWidget::OnMouseEvent(ui::MouseEvent* event) {
139 Widget::OnMouseEvent(event); 136 Widget::OnMouseEvent(event);
140 if (Shell::GetInstance()->in_mus() && shelf_widget_->shelf_layout_manager()) 137 wm_shelf_->UpdateAutoHideForMouseEvent(event);
141 shelf_widget_->shelf_layout_manager()->UpdateAutoHideForMouseEvent(event);
142 } 138 }
143 139
144 void StatusAreaWidget::OnGestureEvent(ui::GestureEvent* event) { 140 void StatusAreaWidget::OnGestureEvent(ui::GestureEvent* event) {
145 Widget::OnGestureEvent(event); 141 Widget::OnGestureEvent(event);
146 if (Shell::GetInstance()->in_mus() && shelf_widget_->shelf_layout_manager()) 142 wm_shelf_->UpdateAutoHideForGestureEvent(event);
147 shelf_widget_->shelf_layout_manager()->UpdateAutoHideForGestureEvent(event);
148 } 143 }
149 144
150 void StatusAreaWidget::AddSystemTray() { 145 void StatusAreaWidget::AddSystemTray() {
151 system_tray_ = new SystemTray(this); 146 system_tray_ = new SystemTray(this);
152 status_area_widget_delegate_->AddTray(system_tray_); 147 status_area_widget_delegate_->AddTray(system_tray_);
153 } 148 }
154 149
155 void StatusAreaWidget::AddWebNotificationTray() { 150 void StatusAreaWidget::AddWebNotificationTray() {
156 web_notification_tray_ = new WebNotificationTray(this); 151 web_notification_tray_ = new WebNotificationTray(this);
157 status_area_widget_delegate_->AddTray(web_notification_tray_); 152 status_area_widget_delegate_->AddTray(web_notification_tray_);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); 201 web_notification_tray_->UpdateAfterLoginStatusChange(login_status);
207 #if defined(OS_CHROMEOS) 202 #if defined(OS_CHROMEOS)
208 if (logout_button_tray_) 203 if (logout_button_tray_)
209 logout_button_tray_->UpdateAfterLoginStatusChange(login_status); 204 logout_button_tray_->UpdateAfterLoginStatusChange(login_status);
210 #endif 205 #endif
211 if (overview_button_tray_) 206 if (overview_button_tray_)
212 overview_button_tray_->UpdateAfterLoginStatusChange(login_status); 207 overview_button_tray_->UpdateAfterLoginStatusChange(login_status);
213 } 208 }
214 209
215 } // namespace ash 210 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/status_area_widget.h ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698