Chromium Code Reviews| 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/common/system/status_area_widget.h" | 5 #include "ash/common/system/status_area_widget.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/wm_shelf.h" | 7 #include "ash/common/shelf/wm_shelf.h" |
| 8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 AddVirtualKeyboardTray(); | 60 AddVirtualKeyboardTray(); |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); | 63 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); |
| 64 DCHECK(delegate); | 64 DCHECK(delegate); |
| 65 // Initialize after all trays have been created. | 65 // Initialize after all trays have been created. |
| 66 system_tray_->InitializeTrayItems(delegate, web_notification_tray_); | 66 system_tray_->InitializeTrayItems(delegate, web_notification_tray_); |
| 67 web_notification_tray_->Initialize(); | 67 web_notification_tray_->Initialize(); |
| 68 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
| 69 logout_button_tray_->Initialize(); | 69 logout_button_tray_->Initialize(); |
| 70 virtual_keyboard_tray_->Initialize(); | 70 virtual_keyboard_tray_->InitializeTrayItems(logout_button_tray_); |
|
varkha
2016/07/14 21:34:47
See my comment about VKT::InitializeTrayIcon. Mayb
yiyix
2016/07/26 20:27:31
N/A to the new approach
| |
| 71 #endif | 71 #endif |
| 72 overview_button_tray_->Initialize(); | 72 overview_button_tray_->Initialize(); |
| 73 SetShelfAlignment(system_tray_->shelf_alignment()); | 73 SetShelfAlignment(system_tray_->shelf_alignment()); |
| 74 UpdateAfterLoginStatusChange(delegate->GetUserLoginStatus()); | 74 UpdateAfterLoginStatusChange(delegate->GetUserLoginStatus()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void StatusAreaWidget::Shutdown() { | 77 void StatusAreaWidget::Shutdown() { |
| 78 system_tray_->Shutdown(); | 78 system_tray_->Shutdown(); |
| 79 // Destroy the trays early, causing them to be removed from the view | 79 // Destroy the trays early, causing them to be removed from the view |
| 80 // hierarchy. Do not used scoped pointers since we don't want to destroy them | 80 // hierarchy. Do not used scoped pointers since we don't want to destroy them |
| 81 // in the destructor if Shutdown() is not called (e.g. in tests). | 81 // in the destructor if Shutdown() is not called (e.g. in tests). |
| 82 delete web_notification_tray_; | 82 delete web_notification_tray_; |
| 83 web_notification_tray_ = NULL; | 83 web_notification_tray_ = NULL; |
| 84 // Must be destroyed after |web_notification_tray_|. | 84 // Must be destroyed after |web_notification_tray_|. |
| 85 delete system_tray_; | 85 delete system_tray_; |
| 86 system_tray_ = NULL; | 86 system_tray_ = NULL; |
| 87 #if defined(OS_CHROMEOS) | 87 #if defined(OS_CHROMEOS) |
| 88 virtual_keyboard_tray_->Shutdown(); | |
| 89 delete logout_button_tray_; | |
|
varkha
2016/07/14 21:34:47
nit: in a separate CL can you maybe make those own
yiyix
2016/07/26 20:27:31
N/A to the new approach
| |
| 90 logout_button_tray_ = NULL; | |
|
varkha
2016/07/14 21:34:47
Is the changed order significant?
yiyix
2016/07/26 20:27:31
N/A to the new approach
| |
| 88 delete virtual_keyboard_tray_; | 91 delete virtual_keyboard_tray_; |
| 89 virtual_keyboard_tray_ = NULL; | 92 virtual_keyboard_tray_ = NULL; |
| 90 delete logout_button_tray_; | |
| 91 logout_button_tray_ = NULL; | |
| 92 #endif | 93 #endif |
| 93 delete overview_button_tray_; | 94 delete overview_button_tray_; |
| 94 overview_button_tray_ = NULL; | 95 overview_button_tray_ = NULL; |
| 95 } | 96 } |
| 96 | 97 |
| 97 bool StatusAreaWidget::ShouldShowShelf() const { | 98 bool StatusAreaWidget::ShouldShowShelf() const { |
| 98 if ((system_tray_ && system_tray_->ShouldShowShelf()) || | 99 if ((system_tray_ && system_tray_->ShouldShowShelf()) || |
| 99 (web_notification_tray_ && | 100 (web_notification_tray_ && |
| 100 web_notification_tray_->ShouldBlockShelfAutoHide())) | 101 web_notification_tray_->ShouldBlockShelfAutoHide())) |
| 101 return true; | 102 return true; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); | 200 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); |
| 200 #if defined(OS_CHROMEOS) | 201 #if defined(OS_CHROMEOS) |
| 201 if (logout_button_tray_) | 202 if (logout_button_tray_) |
| 202 logout_button_tray_->UpdateAfterLoginStatusChange(login_status); | 203 logout_button_tray_->UpdateAfterLoginStatusChange(login_status); |
| 203 #endif | 204 #endif |
| 204 if (overview_button_tray_) | 205 if (overview_button_tray_) |
| 205 overview_button_tray_->UpdateAfterLoginStatusChange(login_status); | 206 overview_button_tray_->UpdateAfterLoginStatusChange(login_status); |
| 206 } | 207 } |
| 207 | 208 |
| 208 } // namespace ash | 209 } // namespace ash |
| OLD | NEW |