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/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 Init(params); | 320 Init(params); |
321 set_focus_on_creation(false); | 321 set_focus_on_creation(false); |
322 SetContentsView(status_area_widget_delegate_); | 322 SetContentsView(status_area_widget_delegate_); |
323 GetNativeView()->SetName("StatusAreaWidget"); | 323 GetNativeView()->SetName("StatusAreaWidget"); |
324 } | 324 } |
325 | 325 |
326 StatusAreaWidget::~StatusAreaWidget() { | 326 StatusAreaWidget::~StatusAreaWidget() { |
327 } | 327 } |
328 | 328 |
329 void StatusAreaWidget::CreateTrayViews(ShellDelegate* shell_delegate) { | 329 void StatusAreaWidget::CreateTrayViews(ShellDelegate* shell_delegate) { |
| 330 AddSystemTray(shell_delegate); |
330 AddWebNotificationTray(); | 331 AddWebNotificationTray(); |
331 AddSystemTray(shell_delegate); | |
332 // Initialize() must be called after all trays have been created. | 332 // Initialize() must be called after all trays have been created. |
333 if (system_tray_) | 333 if (system_tray_) |
334 system_tray_->Initialize(); | 334 system_tray_->Initialize(); |
335 if (web_notification_tray_) | 335 if (web_notification_tray_) |
336 web_notification_tray_->Initialize(); | 336 web_notification_tray_->Initialize(); |
337 UpdateAfterLoginStatusChange(system_tray_delegate_->GetUserLoginStatus()); | 337 UpdateAfterLoginStatusChange(system_tray_delegate_->GetUserLoginStatus()); |
338 } | 338 } |
339 | 339 |
340 void StatusAreaWidget::Shutdown() { | 340 void StatusAreaWidget::Shutdown() { |
341 // Destroy the trays early, causing them to be removed from the view | 341 // Destroy the trays early, causing them to be removed from the view |
342 // hierarchy. Do not used scoped pointers since we don't want to destroy them | 342 // hierarchy. Do not used scoped pointers since we don't want to destroy them |
343 // in the destructor if Shutdown() is not called (e.g. in tests). | 343 // in the destructor if Shutdown() is not called (e.g. in tests). |
344 system_tray_delegate_.reset(); | 344 system_tray_delegate_.reset(); |
| 345 system_tray_ = NULL; |
345 delete system_tray_; | 346 delete system_tray_; |
346 system_tray_ = NULL; | 347 web_notification_tray_ = NULL; |
347 delete web_notification_tray_; | 348 delete web_notification_tray_; |
348 web_notification_tray_ = NULL; | |
349 } | 349 } |
350 | 350 |
351 void StatusAreaWidget::AddSystemTray(ShellDelegate* shell_delegate) { | 351 void StatusAreaWidget::AddSystemTray(ShellDelegate* shell_delegate) { |
352 system_tray_ = new SystemTray(this); | 352 system_tray_ = new SystemTray(this); |
353 status_area_widget_delegate_->AddTray(system_tray_); | 353 status_area_widget_delegate_->AddTray(system_tray_); |
354 | 354 |
355 if (shell_delegate) { | 355 if (shell_delegate) { |
356 system_tray_delegate_.reset( | 356 system_tray_delegate_.reset( |
357 shell_delegate->CreateSystemTrayDelegate(system_tray_)); | 357 shell_delegate->CreateSystemTrayDelegate(system_tray_)); |
358 } | 358 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 web_notification_tray_->IsMouseInNotificationBubble()); | 425 web_notification_tray_->IsMouseInNotificationBubble()); |
426 } | 426 } |
427 if (should_show_launcher != should_show_launcher_) { | 427 if (should_show_launcher != should_show_launcher_) { |
428 should_show_launcher_ = should_show_launcher; | 428 should_show_launcher_ = should_show_launcher; |
429 Shell::GetInstance()->shelf()->UpdateAutoHideState(); | 429 Shell::GetInstance()->shelf()->UpdateAutoHideState(); |
430 } | 430 } |
431 } | 431 } |
432 | 432 |
433 } // namespace internal | 433 } // namespace internal |
434 } // namespace ash | 434 } // namespace ash |
OLD | NEW |