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

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

Issue 2557593009: Fix Chrome crashes on calling OnTrayVisibilityChange (Closed)
Patch Set: address comments Created 4 years 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/common/system/status_area_widget.h ('k') | ash/common/system/tray/system_tray_unittest.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/common/system/status_area_widget.h" 5 #include "ash/common/system/status_area_widget.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/shelf/wm_shelf.h" 8 #include "ash/common/shelf/wm_shelf.h"
9 #include "ash/common/system/overview/overview_button_tray.h" 9 #include "ash/common/system/overview/overview_button_tray.h"
10 #include "ash/common/system/status_area_widget_delegate.h" 10 #include "ash/common/system/status_area_widget_delegate.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); 275 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_);
276 } 276 }
277 277
278 void StatusAreaWidget::AddImeMenuTray() { 278 void StatusAreaWidget::AddImeMenuTray() {
279 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); 279 ime_menu_tray_ = new ImeMenuTray(wm_shelf_);
280 status_area_widget_delegate_->AddTray(ime_menu_tray_); 280 status_area_widget_delegate_->AddTray(ime_menu_tray_);
281 } 281 }
282 282
283 bool StatusAreaWidget::IsNextVisibleTrayToLogout( 283 bool StatusAreaWidget::IsNextVisibleTrayToLogout(
284 TrayBackgroundView* tray) const { 284 TrayBackgroundView* tray) const {
285 if (!logout_button_tray_) {
sadrul 2016/12/13 17:06:58 Don't need {}
286 return false;
287 }
285 int logout_button_index = 288 int logout_button_index =
286 status_area_widget_delegate_->GetIndexOf(logout_button_tray_); 289 status_area_widget_delegate_->GetIndexOf(logout_button_tray_);
287 // Logout button should always exist. 290 // Logout button should always exist.
288 DCHECK_NE(-1, logout_button_index); 291 DCHECK_NE(-1, logout_button_index);
sadrul 2016/12/13 17:06:58 As discussed offline, this DCHECK can probably go
289 if (!logout_button_tray_->visible()) 292 if (!logout_button_tray_->visible())
290 return false; 293 return false;
291 294
292 for (int c = logout_button_index + 1; 295 for (int c = logout_button_index + 1;
293 c < status_area_widget_delegate_->child_count(); c++) { 296 c < status_area_widget_delegate_->child_count(); c++) {
294 if (status_area_widget_delegate_->child_at(c)->visible()) 297 if (status_area_widget_delegate_->child_at(c)->visible())
295 return tray == status_area_widget_delegate_->child_at(c); 298 return tray == status_area_widget_delegate_->child_at(c);
296 } 299 }
297 return false; 300 return false;
298 } 301 }
299 #endif 302 #endif
300 303
301 void StatusAreaWidget::AddOverviewButtonTray() { 304 void StatusAreaWidget::AddOverviewButtonTray() {
302 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); 305 overview_button_tray_ = new OverviewButtonTray(wm_shelf_);
303 status_area_widget_delegate_->AddTray(overview_button_tray_); 306 status_area_widget_delegate_->AddTray(overview_button_tray_);
304 } 307 }
305 308
306 } // namespace ash 309 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/status_area_widget.h ('k') | ash/common/system/tray/system_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698