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

Side by Side Diff: ash/system/tray/system_tray_controller.cc

Issue 2886253002: mash: remove more shell/shelf WmWindow usage. (Closed)
Patch Set: Fix WmShelf::ForWindow. Created 3 years, 7 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/toast/toast_overlay.cc ('k') | ash/test/ash_test_base.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/tray/system_tray_controller.h" 5 #include "ash/system/tray/system_tray_controller.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_port.h" 9 #include "ash/shell_port.h"
10 #include "ash/system/tray/system_tray.h" 10 #include "ash/system/tray/system_tray.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void SystemTrayController::BindRequest(mojom::SystemTrayRequest request) { 144 void SystemTrayController::BindRequest(mojom::SystemTrayRequest request) {
145 bindings_.AddBinding(this, std::move(request)); 145 bindings_.AddBinding(this, std::move(request));
146 } 146 }
147 147
148 void SystemTrayController::SetClient(mojom::SystemTrayClientPtr client) { 148 void SystemTrayController::SetClient(mojom::SystemTrayClientPtr client) {
149 system_tray_client_ = std::move(client); 149 system_tray_client_ = std::move(client);
150 } 150 }
151 151
152 void SystemTrayController::SetPrimaryTrayEnabled(bool enabled) { 152 void SystemTrayController::SetPrimaryTrayEnabled(bool enabled) {
153 ash::SystemTray* tray = 153 ash::SystemTray* tray =
154 ShellPort::Get()->GetPrimaryRootWindowController()->GetSystemTray(); 154 Shell::GetPrimaryRootWindowController()->GetSystemTray();
155 if (!tray) 155 if (!tray)
156 return; 156 return;
157 157
158 // We disable the UI to prevent user from interacting with UI elements, 158 // We disable the UI to prevent user from interacting with UI elements,
159 // particularly with the system tray menu. However, in case if the system tray 159 // particularly with the system tray menu. However, in case if the system tray
160 // bubble is opened at this point, it remains opened and interactive even 160 // bubble is opened at this point, it remains opened and interactive even
161 // after SystemTray::SetEnabled(false) call, which can be dangerous 161 // after SystemTray::SetEnabled(false) call, which can be dangerous
162 // (http://crbug.com/497080). Close the menu to fix it. Calling 162 // (http://crbug.com/497080). Close the menu to fix it. Calling
163 // SystemTray::SetEnabled(false) guarantees, that the menu will not be opened 163 // SystemTray::SetEnabled(false) guarantees, that the menu will not be opened
164 // until the UI is enabled again. 164 // until the UI is enabled again.
165 if (!enabled && tray->HasSystemBubble()) 165 if (!enabled && tray->HasSystemBubble())
166 tray->CloseSystemBubble(); 166 tray->CloseSystemBubble();
167 167
168 tray->SetEnabled(enabled); 168 tray->SetEnabled(enabled);
169 } 169 }
170 170
171 void SystemTrayController::SetPrimaryTrayVisible(bool visible) { 171 void SystemTrayController::SetPrimaryTrayVisible(bool visible) {
172 ash::SystemTray* tray = 172 ash::SystemTray* tray =
173 ShellPort::Get()->GetPrimaryRootWindowController()->GetSystemTray(); 173 Shell::GetPrimaryRootWindowController()->GetSystemTray();
174 if (!tray) 174 if (!tray)
175 return; 175 return;
176 176
177 tray->SetVisible(visible); 177 tray->SetVisible(visible);
178 tray->GetWidget()->SetOpacity(visible ? 1.f : 0.f); 178 tray->GetWidget()->SetOpacity(visible ? 1.f : 0.f);
179 if (visible) { 179 if (visible) {
180 tray->GetWidget()->Show(); 180 tray->GetWidget()->Show();
181 } else { 181 } else {
182 tray->GetWidget()->Hide(); 182 tray->GetWidget()->Hide();
183 } 183 }
(...skipping 20 matching lines...) Expand all
204 ash::SystemTray* tray = root->GetSystemTray(); 204 ash::SystemTray* tray = root->GetSystemTray();
205 // External monitors might not have a tray yet. 205 // External monitors might not have a tray yet.
206 if (!tray) 206 if (!tray)
207 continue; 207 continue;
208 tray->tray_update()->ShowUpdateIcon(severity, factory_reset_required, 208 tray->tray_update()->ShowUpdateIcon(severity, factory_reset_required,
209 update_type); 209 update_type);
210 } 210 }
211 } 211 }
212 212
213 } // namespace ash 213 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/toast/toast_overlay.cc ('k') | ash/test/ash_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698