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/tray/system_tray_bubble.h" | 5 #include "ash/system/tray/system_tray_bubble.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 void SystemTrayBubble::UpdateView( | 366 void SystemTrayBubble::UpdateView( |
367 const std::vector<ash::SystemTrayItem*>& items, | 367 const std::vector<ash::SystemTrayItem*>& items, |
368 BubbleType bubble_type) { | 368 BubbleType bubble_type) { |
369 DestroyItemViews(); | 369 DestroyItemViews(); |
370 bubble_view_->RemoveAllChildViews(true); | 370 bubble_view_->RemoveAllChildViews(true); |
371 | 371 |
372 items_ = items; | 372 items_ = items; |
373 bubble_type_ = bubble_type; | 373 bubble_type_ = bubble_type; |
374 CreateItemViews(Shell::GetInstance()->tray_delegate()->GetUserLoginStatus()); | 374 CreateItemViews(Shell::GetInstance()->tray_delegate()->GetUserLoginStatus()); |
375 bubble_widget_->GetContentsView()->Layout(); | 375 bubble_widget_->GetContentsView()->Layout(); |
| 376 // Make sure that the bubble is large enough for the default view. |
| 377 if (bubble_type_ == BUBBLE_TYPE_DEFAULT) |
| 378 bubble_view_->SizeToContents(); |
376 } | 379 } |
377 | 380 |
378 void SystemTrayBubble::InitView(const InitParams& init_params) { | 381 void SystemTrayBubble::InitView(const InitParams& init_params) { |
379 DCHECK(bubble_view_ == NULL); | 382 DCHECK(bubble_view_ == NULL); |
380 anchor_type_ = init_params.anchor_type; | 383 anchor_type_ = init_params.anchor_type; |
381 bubble_view_ = new SystemTrayBubbleView( | 384 bubble_view_ = new SystemTrayBubbleView( |
382 init_params.anchor, this, init_params.can_activate); | 385 init_params.anchor, this, init_params.can_activate); |
383 if (bubble_type_ == BUBBLE_TYPE_NOTIFICATION) | 386 if (bubble_type_ == BUBBLE_TYPE_NOTIFICATION) |
384 bubble_view_->set_close_on_deactivate(false); | 387 bubble_view_->set_close_on_deactivate(false); |
385 | 388 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 } | 506 } |
504 | 507 |
505 void SystemTrayBubble::OnWidgetClosing(views::Widget* widget) { | 508 void SystemTrayBubble::OnWidgetClosing(views::Widget* widget) { |
506 CHECK_EQ(bubble_widget_, widget); | 509 CHECK_EQ(bubble_widget_, widget); |
507 bubble_widget_ = NULL; | 510 bubble_widget_ = NULL; |
508 tray_->RemoveBubble(this); | 511 tray_->RemoveBubble(this); |
509 } | 512 } |
510 | 513 |
511 } // namespace internal | 514 } // namespace internal |
512 } // namespace ash | 515 } // namespace ash |
OLD | NEW |